How implements Sun Shafts[S.T.A.L.K.E.R.: Clear Sky Method]

Started by
9 comments, last by ATEFred 11 years, 4 months ago
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.
Advertisement
Aren't those properly called God Rays? These seems to be a lot of good stuff on Google about them.
I search it by the word Sun Shafts,God Rays and Crepuscular rays.
However, I am found only for implementation of CryEngine.
Please Help!
there are a few demos with full source code in google just search 'screen space god rays' or 'screen space sun-shafts' and look at results on first page. I have used those when making it in my engine.
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.
I found only one information. Crepuscular rays of X-Ray Engine seems to be using the depth map.

I want to know the implementation crepuscular rays are visible even when the sun does not exist in the screen.
Thanks for the detailed reply.
I'll try to practice.
godrays.png
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.
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
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

This topic is closed to new replies.

Advertisement