Jump to content
  • Advertisement
Sign in to follow this  

Shadow Volume Problem

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

I currently working on Stencil Shadow Volumes, i figured it out how to draw the shadow but my problem is, that all the shadows have the same grey color. How can I make them darker when the point shadowed is in two volumes??? And how can I apply lighting from a second light source to the shadow?? undo

Share this post

Link to post
Share on other sites
What you could do is draw the schene to the depth buffer, then do the stencil shadows for the current light and draw the scene (stencil test to draw only outside shadows), lighted according to the current light, with no textures, and repeat that for every light in the scene. Use src+dst for blending.
When you're done drawing the lighting draw the scene textured using the src*dst blending equation.

This way you don't actually draw the shadows as greyness but you just don't draw the light there, which, i think, will give better looking results).

This might not be the fastest way but i think it is the easiest.

Share this post

Link to post
Share on other sites
Ok, probably you are Drawing the shadows, but thats not the way.
You have to make it like in real life.
In real time, its not the shadow that is drawn, but the lighting :)
So you make your shadow volume, and define the place where you will have shadow. Like you did probably.
Now, you have to render the scene with lighting only where there is no shadow. Like in real life so.
And then, if you add another lights, they will be add to the current luminosity and your shadow will be perfect, and you will got something like doom3. :)
And after drawing the lighting, you can now multiply your textures on the top.
So, you have 3 passes to do :

So draw all your scene on the depth buffer, and desable writing to color buffer. So you should not see it.

In this one, you pass each light, and for each light :
Draw your shadow area on the stencil buffer, draw the scene with NO texture with this light On and Blending On. Fonction of blending : glBlendFunc(GL_ONE, GL_ONE);. Then, clear the stencil buffer and proceed to the next light. (ya, you have to rerender the scene for each light, thats why doom3 is lagging so much ;)) (ho, and do not write to the depth buffer, you allready did it in the first pass DrawOnDepthBuffer(), just put the GL_LEQUAL function to the depth "multipass technic")

Then, you redraw the scene with texture ON and blending ON again, but change the blending function to multiply : GL_DST_COLOR, GL_ZERO
Now you have something like doom3, except the bump map :)

If you have any further problems, e-mail me. I'm currently working on a real time shadow engine, so I'm in currently and I can help you on detail.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!