# Understanding a paper's shadow volume algorithm

This topic is 1467 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## 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
sun).

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,

Chris
Edited by chrisendymion

##### 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.

1. 1
2. 2
3. 3
Rutin
18
4. 4
JoeJ
14
5. 5

• 14
• 10
• 23
• 9
• 32
• ### Forum Statistics

• Total Topics
632630
• Total Posts
3007521
• ### Who's Online (See full list)

There are no registered users currently online

×