Archived

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

Shadow Volumes (A different type of question)

This topic is 5625 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

As the subject suggests, I''m not going to be asking: How do you make shadows in C++ . Here is the problem I have: I have looked at the Nehe tutorial 28 which implements Stencil shadow volumes, and also the shadow volume example which comes with the DX-8.1 SDK. In both of these examples once the "rendering" of the shadow volume polys to the stencil buffer is finished, a black poly is rendererd, covering the whole of screen, which blends the stencil buffer information (0 for no shadow and >=1 for shadows) with the current value of the pixels on the screen, giving us the final result we are looking for (at least what is done is more or less like I explained above.) Then I went through a couple of papers on shadow volumes which were available on the nVidia website, and also the interview with John Carmack where he briefely explains how the Doom 3 engine works. In all of these it is stated that first the engine must do a quick pass, rendering the entire scene without any texture or lighting information basically just to fill the Z-buffer with the correct values. Then, we do the shadowing pass where we calculate the volumes and apply the necessary adjustments to the stencil buffer (same as the examples mentioned above), and finally a "final" pass is done where we redraw the scene with textures and lighting and blend with the stencil buffer shadow information. My question: What is the difference between these two methods? Obviously the method used by Carmack has some sort of advantage but I don''t see it. I thought it might be that because in the first approach we are doing the lighting before blending in the shadows, the shadow colors might not be correct. But after doing some testing I think the shadow colors seem to be correct in the Nehe and DX-8.1 examples. It could also be that drawing a poly which covers the whole screen could be creating a large overhead for fill-rate but is that really slower than redrawing the whole scene? Any feedback or references on this issue would be greatly appreciated. Thanks

Share this post


Link to post
Share on other sites
Doom3 *eats* fill rate due to the bumpmapping and other fancy effects, so the idea behind the quick-no-textures-z-fill approach is that polys that are hidden behind others are rejected earlier and don''t waste time bumpmapping etc. them. It''s almost like a variation on the ''painters algorithmn'', in that you only shade pixels that will be part of the final scene.

Share this post


Link to post
Share on other sites