Jump to content
  • Advertisement
  • entries
  • comments
  • views

Volumetric Lighting!

Sign in to follow this  


So one topic that we all hear over and over is VOLUMETRIC LIGHTING ( caps intended ). Why? Because its so damn awesome. Why not? Because it can get expensive depending on the hardware. So after countless of tries I scrapped the code I've been wanting to shoot then resurrect then shoot again and just wrote what made sense, and it worked! :)

The implementation is actually really simple, in simple terms I did it like this: ( I havent optimized it yet, E.g. I should do it all in light view space )// Number of raymarchessteps = 50// Get world space positionpositionWS = GetPosition();// Get world space position of the pixelrayWS = GetWorldSpacePixelPos();// Get ray between world space position and pixel world space posv = positionWS - rayWS;vStep = v / steps;color = 0,0,0for i = 0 to steps rayWS += vStep; // Calculate view and proj space rayWS rayWSVS = ... rayWSPS = ... // Does this position recieve light? occlusion = GetShadowOcclusion(..., rayWSPS); // Do some fancy math about energy energy = ... * occlusion * ... color += energy.xxx;return color * gLightColor;
Results: ( Its not done yet )



Thats all! Until next time! :)
Sign in to follow this  


Recommended Comments

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!