How implements Sun Shafts[S.T.A.L.K.E.R.: Clear Sky Method]
Started by ken2240, Nov 23 2012 10:00 AM
10 replies to this topic
#1 Members - Reputation: 146
Posted 23 November 2012 - 10:00 AM
Hi, All
I know how to implement the Sun Shafts of screen space that is used in CryEngine.
However, this way is ineffective if the sun does not exist in a screen.
I want to implement a Sun Shafts that are used in the Stalker.
How does this method implement it?
If you may know some, please teach me.
I am glad when there are documents and source code.
I know how to implement the Sun Shafts of screen space that is used in CryEngine.
However, this way is ineffective if the sun does not exist in a screen.
I want to implement a Sun Shafts that are used in the Stalker.
How does this method implement it?
If you may know some, please teach me.
I am glad when there are documents and source code.
Sponsor:
#5 Members - Reputation: 500
Posted 23 November 2012 - 01:14 PM
One technique to get volumetric shadows / godrays that are present even when the light source is not visible is marching through the shadowmap.
So for sun/directional light for example you would do a full screen pass, potentially downres-ed for performance reasons, where for each pixel you step through the scene from pixel pos to scene pos, sampling the shadow map at each step. This gives you the atmosphere amount in shadow.
So for sun/directional light for example you would do a full screen pass, potentially downres-ed for performance reasons, where for each pixel you step through the scene from pixel pos to scene pos, sampling the shadow map at each step. This gives you the atmosphere amount in shadow.
#8 Members - Reputation: 258
Posted 24 November 2012 - 11:11 AM

Uploaded with ImageShack.us
You mean this? Ray marching is the way to go! It's not even that expensive compared to a radial blur as long as you use a small shadow map. You can even do it in half resolution and blur it like SSAO.
#9 Members - Reputation: 790
Posted 26 November 2012 - 08:11 AM
Kenny Mitchell published an article in GPU Gems 3, called Volumetric Light Scattering as a Post-Process.
There is also some code in this chapter.
Best regards
There is also some code in this chapter.
Best regards
Acagamics e.V. – IGDA Student Game Development Club (University of Magdeburg, Germany)
#10 Members - Reputation: 170
Posted 26 November 2012 - 09:55 AM
I posted something similar on my blog some time ago:
jcoluna.wordpress.com/2012/06/05/light-shafts-tone-mapping/
The source code+assets are available for download, hope it helps.
-J.Coluna
jcoluna.wordpress.com/2012/06/05/light-shafts-tone-mapping/
The source code+assets are available for download, hope it helps.
-J.Coluna
Edited by Coluna, 26 November 2012 - 10:12 AM.
#11 Members - Reputation: 500
Posted 26 November 2012 - 01:22 PM
The problem with those techniques vs the marching through the SM is that you need a visible light source on screen / occluders on screen to get proper light shafts.
Using the shadow map information means they will be correct regardless of where the light source and occluders are. Your main issue becomes dealing with occluders which are not in the sm range. You can also use the ray marching pass to compute atmospheric scattering, which is a nice added bonus.
Using the shadow map information means they will be correct regardless of where the light source and occluders are. Your main issue becomes dealing with occluders which are not in the sm range. You can also use the ray marching pass to compute atmospheric scattering, which is a nice added bonus.






