

Mie scaterring approximated with Henyey-Greenstein phase function.įloat ComputeScattering(float lightDotView)įloat result = 1.0f - G_SCATTERING * G_SCATTERING The pseudo code for the raymarching looks like this: It’s really simple, but as often with raymarching it can quickly become expensive as it require a certain amount of rays to capture details, and that’s why the ray marching is done in a downscaled texture. For each step the light scattered in the camera direction is accumulated, using the Henyey-Greenstein phase function.

The idea is to “ray march” from the world position of the current pixel to the camera position, and for each step check if the current position can be seen by the light or not, using the informations from the shadow map. But again my laptop GPU is really slow and it would have been annoying, so I started with a really basic shadow map implementation. As there is only one light it’s easy to store the distance from the occluder. I could have created one by ray marching in my voxel grid as I’ve done with point lights. I started with a directional light, the sun light in my case, that will affect the whole scene.įirst of all I needed some kind of shadow map. You can see the slides here and the presentation here, it’s a really good source of informations. But be careful, nowadays you can be sued for being awesome …).Ī similar approch has been use in the upcoming game “Lords of the Fallen” and is described by Benjamin Glatzel for the conference Digital Dragon. You can download the slides on the Guerrilla Games publication page. It’s not just about volumetric lights, but the whole talk is really interesting (especially the part on the nice trick to achieve 60fps for multiplayer using temporal reprojection, I found it particularly awesome. There is also the excellent GDC talk “Taking Killzone Shadow Fall Image Quality into the Next Generation” by Michal Valient. While waiting for a new computer that will make my experiments with voxels more comfortable (even a 64圆4圆4 grid is slow on my laptop) I decided to try some less expensive effects, starting with the volumetric lights as described in GPU Pro 5 by Nathan Vos from Guerilla Games.įirst of all I highly recommend you to read this chapter (and the whole book !), there is a lot of useful tricks, and I only scratch the surface.
