Archived

This topic is now archived and is closed to further replies.

Direct3D Stencil Shadow Volume

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

Okay, I''ve still be having lots of problems getting my stencil shadow volumes to work with the z-fail method. I''ve written up an outline (along with source and pictures) and placed it on my temporary website. If any guru''s who''ve implemented this before can please take a look and let me know of any ideas you have, I''d greatly appreciate it. Thank you very much. http://www.geocities.com/dpicco2002/

Share this post


Link to post
Share on other sites
OK, Ideas:

Your silhouette-determining code seems OK, although it took me a little while to figure it out as I have not seen it done this way before.
You are getting a smaller shadow as well as your main one because your shadow volume is being clipped by the far plane.
Thus, stencil counts are off is this area. I presume you have seen the papaer on infinite shadow volumes at nVidia? The infinite far plane trick is used to prevent the shadow volume being clipped. There was a post here recently about using an infinite far plane in D3D.

As for your other problem, it is correct that you can see the shadow of the character when you look from the other side of the hill. If you imagine the shadow volume, it will clearly intersect the back of the hill.
How to fix it? Hmm...let me think...

Oh, and the caps should face outwards, just like the rest of the volume.

http://users.ox.ac.uk/~univ1234

Share this post


Link to post
Share on other sites
Alright, I reversed my front/back caps vertex orders and now I don't get that shadow through the hill or the small shadow... actually I get small speckles where the small shadow was... kinda like little parts of it are still drawing. Almost like the back caps don't quite mask it out. Any ideas about that? Could it be because my model has cracks in it? Could it be a resolution thing?

I've posted a description and pic of this on the website again... it's right at the top with my old problems below. I guess you can ignore the bottom stuff unless they perhaps explain the top problem.

http://www.geocities.com/dpicco2002/

Edit: There's also a zoom-in shot there as well now.. follow the link to see the zoom-in.
Thanks all.

[edited by - Draigan on October 22, 2002 6:48:47 PM]

[edited by - Draigan on October 22, 2002 7:08:32 PM]

Share this post


Link to post
Share on other sites
Anyone?
I''ve uploaded a color-coded version to show the values of the stencil buffer when the artifacts appear. Normal coloring means the stencil is 0. Yellow means the stencil is 1. Red means the stencil is > 1.

Someone must have an idea or two...

http://www.geocities.com/dpicco2002/

Share this post


Link to post
Share on other sites
Just a thought: try playing around with the Z-Bias value which is one of render states. I didn''t really go through your code, so I couldn''t tell you you''re already doing that.

Share this post


Link to post
Share on other sites