Shadows volumes: what's wrong ??!

Started by
25 comments, last by RipTorn 19 years, 5 months ago
Hmmm could you post screenshots of:
- shadow volumes drawn (no stencil) frontface in a color, backface in another color (with blending enabled so we can see everything).
- GL_INCR pass.
- GL_DECR pass (did you intialize the stencil buffer with 1 ? The result you obtain is weird).
SaM3d!, a cross-platform API for 3d based on SDL and OpenGL.The trouble is that things never get better, they just stay the same, only more so. -- (Terry Pratchett, Eric)
Advertisement
Hmmm could you check that you didn't forget to set the stencil mask ?

glStencilMask(~0);
SaM3d!, a cross-platform API for 3d based on SDL and OpenGL.The trouble is that things never get better, they just stay the same, only more so. -- (Terry Pratchett, Eric)
i've done something better: i've downloaded the shadows volumes code from codesampler and inserted my object class.

i've uploaded code and bin here:
http://www.neoborn.com/users/b3rs3rk/shadow%20demo.rar

F1 shows the volume.

something strange happens: the shadow is rendered only from a point of view, if you rotate the camera it disappear :/
maybe the shadow volumes you render are incorrect..
I can imagine if you render each shadow volume triangle both front and back faced you could end up with lines because of slight differences between the triangles?
just a guess.
i'd run your demo if my computer at work would be capable at actually running your demo..
Quote:Original post by LogicalError
i'd run your demo if my computer at work would be capable at actually running your demo..


why? what's the problem? video card?
I looked at your demo. The shadow volume for the quad is wrong.
Do you want me to try and fix it ?

BTW the shadow volume for the teapot is wrong as well :D
SaM3d!, a cross-platform API for 3d based on SDL and OpenGL.The trouble is that things never get better, they just stay the same, only more so. -- (Terry Pratchett, Eric)
Quote:Original post by rodzilla
I looked at your demo. The shadow volume for the quad is wrong.
Do you want me to try and fix it ?

BTW the shadow volume for the teapot is wrong as well :D


yes!thanks!
OK. To get a quick fix for your example, you'll just have to reverse the orientation of the first triangle in your model (swap 2 vertices).

Your demo will work (kind of) but basically your shadow volume generation algorithm is broken (will only work for *some* models).
You will probably want to read the following article: http://legion.gibbering.net/projectx/paper/paper.pdf
It describes an excellent algorithm that will work with *all* models.

Another point is the floor. Look below the floor and you'll see the shadow as well. To avoid this, the floor should cast a shadow as well.

Hope it helps (sorry, I wish I'd have time to help you more).
SaM3d!, a cross-platform API for 3d based on SDL and OpenGL.The trouble is that things never get better, they just stay the same, only more so. -- (Terry Pratchett, Eric)
thanks for your help :) let me see if i'm able to fix it ^_^
I'll post my implementation of the paper's algorithm if you wish (as soon as I reboot to Linux).

BTW, the paper was written by RipTorn (forgot to mention it ; thanx RipTorn !).

Hmmm and thanx ! I had only coded z-fail method until you mentionned your problems. I have z-pass as well now. :D
SaM3d!, a cross-platform API for 3d based on SDL and OpenGL.The trouble is that things never get better, they just stay the same, only more so. -- (Terry Pratchett, Eric)

This topic is closed to new replies.

Advertisement