Sign in to follow this  
SiS-Shadowman

Shadow Volumes question

Recommended Posts

SiS-Shadowman    359
I think I've read a dozen papers about shadow volumes and I finally decided to implement them. But I still got some questions. Am I right that this approach to generate the volume can be used (assuming an indexed mesh) 1. Loop through each triangle and insert an edge into a vector (or any respective array) if that triangle faces the light 3. When this is done, I will look for edges, that don't have a partner, because the triangles which's d(n, l) = 0 should have minimum 1 edge that is "outside". For each of those edges, I copy this edge and extrude it away from the light. In theory this should work, but I still have a hard time thinking about constructing the actual vertex and indexbuffer from this edged buffer. Can this be done in the second pass, that is when I extrude the border edges? I would have to insert 2 triangles for each extruded edge. I'm just unshure if this works and need some confirmation or hints for this approach :)

Share this post


Link to post
Share on other sites
MJP    19755
Sorry to bring this off-topic...but why shadow volumes? These days shadow maps are generally accepted as having better quality and performance characteristics, and there's constantly new techniques and research published for improving them.

Share this post


Link to post
Share on other sites
JNT    148
Better quality characteristics... Well, that depends on how you wish to define "quality". Shadow volumes are pixel-perfect, whereas shadow buffers have the pixel precision of the texture memory allotted to them. You can, on the other hand, shade the edges of the shadow buffer in order to make it look really nice.

Share this post


Link to post
Share on other sites
SiS-Shadowman    359
Quote:
Original post by MJP
Sorry to bring this off-topic...but why shadow volumes? These days shadow maps are generally accepted as having better quality and performance characteristics, and there's constantly new techniques and research published for improving them.


I got shadow maps to work for me before, but they looked badly. Ofcourse I only implemented a standard shadowmapping algo. But I have no freakin' idea how the other algos work and I really don't have the time and patience to learn the math for it. Concerning shadow volumes, I only have to implement them and that's it. I don't need to tweak some paremters and care about z-buffer precision issues. Besides, to add more shadows from different light sources, I would need to alter my shaders to work with 1, 2, 3... shadow maps. And I got enough different shaders for different kind of lights and materials.

About shading the shadow buffer. I tried a 3x3 PCF, but it didn't look that good (because of the poor quality of normal shadow mapping). I also got some screen space algo done, that looked quite nice, but was quite expensive because I needed to blur the entire screen buffer, where I rendererd the shadow in a different pass to it and alpha blended it over the original scene.
Maybe I can implemented something like that with shadow volumes as well. "Just" render the entire scene in another buffer and then do a small blur over it and I should end up with a buffer that contains smooth shadows. A simple overlay with the original scene should do it.

I did look at the Shadowmap example, but I still have to go through each line. I think it'll be faster to just understand how to construct the shadow volume, instead of copying the code.
What I do understand, is that they do the extrusion in the vertexshader, where they just extrude the polygons to infinity (the far clipping plane). But why can't I just use the original geometry and extrude the faces in the vertexshader? Why do they undergo that difficult process, write about 500 lines of code to create a second mesh. What do they exactly do there?

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