How computationally expensive are light shafts "god rays"

futurefields

Diamond Member
Jun 2, 2012
6,471
32
91
Relatively speaking how demanding is this "effect" ?

I really like the impact they have running around the island in Far Cry 3, and I don't notice any impact on my FPS when they show up in abundance, so it must be a relatively inexpensive shader effect?
 

blastingcap

Diamond Member
Sep 16, 2010
6,654
5
76
Depends on implementation/game engine I think. I remember Stalker Pripyat had a big difference in framerates with such rays. You have a high-end card, but a midrange card might suffer more.
 

Arkadrel

Diamond Member
Oct 19, 2010
3,681
2
0
I think with lights its about light sources, and how many times the light bounces.
(ei. a stray beam of light, hits a reflective surface of a window, bounces off that, and hits the floor, and lights up the pants of a character model, once shadows come into play from all the bounces too, things get complex)

Adding light sources without the rays bounceing, and effecting objects isnt very demanding. Once you do start doing things like that, lights can get very demanding though.

I recammend you try Hitman Absolution, apparently its lights/shadows are very well done.
 
Last edited:

Pottuvoi

Senior member
Apr 16, 2012
416
2
81
Relatively speaking how demanding is this "effect" ?
There are several ways to do this, most commonly used way is simple screen space postprocessing blur and produces effect that is usually quite bad. (crysis 1&2, farcry.. erc.)
http://http.developer.nvidia.com/GPUGems3/gpugems3_ch13.html

In terms of quality the right way is to sample athmospheric scattering and shadows along a ray away from the screen. (calculating light and shadow contribution along a ray.)
http://groups.csail.mit.edu/graphics/volumeshadows/
http://www.cs.berkeley.edu/~ravir/papers/singlescat/scattering.pdf
http://homepage.cs.uiowa.edu/~cwyman/publications/files/volumetricShadows/volShadows.pdf

Also an important visual cue is multi scattering component.
http://www.cse.chalmers.se/~billeter/pub/scatter/multi_scatter-lores.pdf

It's possible to have good looking approximation realtime, but there are handful of games that even try. (crysis 3 had interesting approximation.)
I think with lights its about light sources, and how many times the light bounces.
(ei. a stray beam of light, hits a reflective surface of a window, bounces off that, and hits the floor, and lights up the pants of a character model, once shadows come into play from all the bounces too, things get complex)
That is global illumination (GI), also something that all ambient lighting methods try to acomplish or mimic. (and what ambient occlusion should shadow.)
 
Last edited:

itsmydamnation

Platinum Member
Feb 6, 2011
2,765
3,131
136
if you have oblivion you can test yourself :)
OBGE allows you to see exactly how long a shader takes to run and it has two "god rays" shaders . On top of that both shaders you can edit the amount of rays/shafts and other variables. Lots to play with :)