
Problem: z-fighting with carmack's reverse !
hi, i tried to implement the carmack''s reversed Stencil Shadow Algorithm, but i got some problems.
The shadowvolume gets rendered like it should but when it comes to drawing the "lit" and "unlit" modelparts the output is something like that on the picture below.
(I hope my webspace is still online)
I''m not sure if this IS z-fighting.
If I''m right.. what could be the problem and how to solve it ?
thanks forwards, stryx

Anything that requires finding convex hulls in realtime isstarting to sound like a bad idea. -- John Carmack
Have you tried using glPolygonOffset to move the shadow volume cap so it doesn''t conflict with the model geometry? If so, are you sure it was in the right direction?
hmm, glPolygonOffset ?
never heard of that function.
Can u point me somewhere. how this function works and how to get it.
is it an extension ?
thanks for your help, stryx
never heard of that function.
Can u point me somewhere. how this function works and how to get it.
is it an extension ?
thanks for your help, stryx
Anything that requires finding convex hulls in realtime isstarting to sound like a bad idea. -- John Carmack
I don''t think it''s an extension. Linux man page says it is standard as of version 1.1, so I don''t think you need anything special to use it.
As for how to use it, man pages / help files / google it / red-blue books are fairly obvious.
Where are you getting your information for shadow volumes from? I am pretty sure I saw glPolygonOffset used in nvidia''s shadow demo ( here ), so you might want to check it out.
As for how to use it, man pages / help files / google it / red-blue books are fairly obvious.
Where are you getting your information for shadow volumes from? I am pretty sure I saw glPolygonOffset used in nvidia''s shadow demo ( here ), so you might want to check it out.
Are you drawing your unshadowed polygons using the depth comparison GL_LESS?
-----------------------
"When I have a problem on an Nvidia, I assume that it is my fault. With anyone else''s drivers, I assume it is their fault" - John Carmack
-----------------------
"When I have a problem on an Nvidia, I assume that it is my fault. With anyone else''s drivers, I assume it is their fault" - John Carmack
-----------------------"When I have a problem on an Nvidia, I assume that it is my fault. With anyone else's drivers, I assume it is their fault" - John Carmack
Well.... this is (hopefully) the way i draw it. I hope this helps.
thanks for the link... i'll watch at the code.
I used a icq message of an friend of mine for my attempt and a bit of carmack's reversed
thanks for all your help.
[edited by - stryx on August 3, 2003 10:25:00 AM]
glClearStencil(0); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); glEnable(GL_DEPTH_TEST); glDepthFunc(GL_LEQUAL); glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE); glDepthMask(GL_TRUE); //DRAWMODEL glDepthMask(GL_FALSE); glEnable(GL_STENCIL_TEST); glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE); glStencilFunc(GL_ALWAYS, 0, 0); glDepthFunc(GL_LESS); glEnable(GL_CULL_FACE); glFrontFace(GL_CCW); glBegin(GL_QUADS); for (int k = 0; k < 2; k++){ if (k == 0){ glCullFace(GL_BACK); glStencilOp(GL_KEEP, GL_INCR, GL_KEEP); } else { glCullFace(GL_FRONT); glStencilOp(GL_KEEP, GL_DECR, GL_KEEP); } //draw volume } glEnd(); glDisable(GL_CULL_FACE); glDepthFunc(GL_LEQUAL); glStencilFunc(GL_EQUAL, 0, 0xFFFFFFFF); glStencilOp(GL_ZERO, GL_KEEP, GL_KEEP); glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); //draw lit surfaces glDisable(GL_STENCIL_TEST); glDepthMask(GL_TRUE); glDepthFunc (GL_LESS); //draw shadowed surfaces
thanks for the link... i'll watch at the code.
I used a icq message of an friend of mine for my attempt and a bit of carmack's reversed

thanks for all your help.
[edited by - stryx on August 3, 2003 10:25:00 AM]
Anything that requires finding convex hulls in realtime isstarting to sound like a bad idea. -- John Carmack
the light comes from above.
so the view is not in the shadowvolume.
so the view is not in the shadowvolume.
Anything that requires finding convex hulls in realtime isstarting to sound like a bad idea. -- John Carmack
what are the values of the near and far clipping planes ?
how far (Z value) is the model rendered approximatively ?
how far (Z value) is the model rendered approximatively ?
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement