Sign in to follow this  

Understanding a paper's shadow volume algorithm

Recommended Posts

Hello ;)
I have trouble to understand a part of an algo for shadows volumes.
The paper is from Eric Bruneton (thanks to him) and can be found here : 
Bruneton uses a texture for storing deltaN, deltaZ, Zmin, Zmax.
You have no need to understand what are deltaN or deltaZ, my problem is with Zmin.
Zmin is the distance from camera to the nearest shadow volume front face.
He wrotes :
We associate with each pixel 4 values deltaN, deltaZ, Zmin, Zmax initialized to 0, 0, INFINITY, 0. 
In a first step we decrement (resp. increment) deltaN by
1 and deltaZ by the fragment depth z, and update Zmin and Zmax
with z, for each front (resp. back) face of the shadow surface.
And in the rendering passes :
We draw the shadow volume of the terrain into a deltaN, deltaZ,
Zmin, Zmax texture. For this we use the ADD and MAX blending
functions, disable depth write, and use a geometry
shader that extrudes the silhouette edges (as seen from the
I understand the algorythm, all is ok except the Zmin computation.
Why it is initialized to infinity ?
Blend modes are ADD and MAX, so I suppose ADD for RGB and MAX for Alpha.
With that deltaN (Red), deltaZ (Green) and Zmax (Alpha) are easy to compute.. 
But ADD with Zmin (Blue) ? How to get it ?
I have some workarounds for this problem, but I'm interested to understand how Bruneton did it.
Hope I was clear and sorry for my poor english ;)
Thank you,
Edited by chrisendymion

Share this post

Link to post
Share on other sites

I haven't read the paper, but what value would you assume zmin to be initialized to? think about what you clear your depthtarget to before drawing with basic forward renderer.

Share this post

Link to post
Share on other sites

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

Sign in to follow this