PDA

View Full Version : Problem with Humus Shadow Volume code



unreal
07-31-2004, 03:19 AM
hello!
I have a problem with shadow volumes! I use the source code from the only humus example with shadow volumes as it is! i didnt make any modification! I have a room and at the center of the room i have a column constructed from 4 quads(I tried 8 triangles also but the same problem again...) if i try to draw the shadow of one only polygon(quad) at a time then the shadow volume works. if try to draw tha shadow volumes from all the polygons.. then.. hell...
i am saying it again... i did not do any modification on humus code and did not add anything about shadow volume creation. a simple copy-paste. the normals of the 4 quads are also correct.
anyone had the same problem?

here is the code, as I sai is exactly the same like Humus!
http://rafb.net/paste/results/VDgmWQ78.html

unreal
07-31-2004, 03:26 AM
here is the polygon coords:
http://rafb.net/paste/results/x5ce4i44.html

rgpc
07-31-2004, 05:44 PM
It would be useful if you defined "hell" and perhaps provided a screen shot.

Having a brief glance at the code it looks like the intention is that it will extrude a shadow volume for each quad in the mesh. However, it only ever references indices 0->3 (perhaps the parameter q is meant to provide an offset, and isn't actually used?).

The other thing I can see, is the following line:


glDepthFunc(GL_LESS); // <=== Important to use GL_LESS and not GL_LEQUAL, If you are drawing a number of extruded quads (ie. all 6 to make a cube) then you will have barriers between the quads where the various volumes are joined. If you use GL_LESS rather than GL_LEQUAL I would think that your shadow volume might turn out a bit weird because these "barriers" will not draw. ie. Poly2 shares an extruded edge with Poly1. Poly1 is already drawn. The extrusion for each Polygon lies at the same position in space so when the extrusion is drawn for Poly2, it will not be drawn because it is "EQUAL" to Poly1 and GL_LESS will cause it to be discarded. So this means that for Poly1 the front and back faces will be drawn. For Poly2 only the front faces will be drawn.

That's my 2cents.

unreal
07-31-2004, 10:13 PM
i dont have right now space on the internet to upload the pics. i will find and i will upload them soon.I change from GL_LESS to LEQUAL but nothing.. the same problem... the "hell" is that some shadow volumes disapear while the light moving...

unreal
08-01-2004, 12:18 PM
oops! it was my mistake! everything is ok now