Skip to main content
GameDev.net gamedev.net
🔒 Locked

Stencil Shadow Volume Flickering

Started by f_gerhar Oct 11, 2006 at 1:03 PM 1 replies 1.7k views
Original Post
f_gerhar
f_gerhar
hello GameDev community. I'm currently onto implementing shadows into my engine using shadow volumes based on stencil operations. I've made my first progress, silhouette extraction and capping seems to work fine. At the current stage, I do a full cap, front and back, after extracting quads. I run the rendering algorithm using zFail regardless of whether the volume cuts the near clipping plane or not. I do have a little problem though. For some reason, I'm getting artifacts on self shadowing areas. The shadow projected elsewhere looks perfectly fine, as mentioned, just the self shadowing goes wrong on me. The images I get remind me a little of z-fighting. When moving around character or camera, the dynamics give me an impression of flickering. I have uploaded an image to show what I mean. Please take a look below http://images6.theimagehosting.com/shadows_flicker_1.jpg Below is an image of a close up: http://images6.theimagehosting.com/shadows_flicker_2.jpg And another picture rendering the extracted shadow volumes: http://images6.theimagehosting.com/shadows_flicker_sv.jpg In the above pictures, I have a single light source right where the lantern is located. I've searched a lot over the past 2 days, and found no answers. Can anyone give me a hint as to what might cause the effect I'm getting? Any ideas would be appreciated, thanks in advance. [Edited by - f_gerhar on October 11, 2006 2:37:35 PM]
GuentherKrass
GuentherKrass
hello f_gerhar,

if you're experiencing flickering on selfshadowed objects when using the zfail-algorithm, then you've probably got to adjust the polygon-offset (glPolygonOffset(..., ...) and glEnable(GL_POLYGON_OFFSET_FILL)) for the frontfacing caps.

If you're missing the offset, then your front cap and original geometry are on exactly the same points --> z-fighting! Adjust the values of glPolygonOffset(..., ...) so that the cap is rendered behind the original object (away from the camera). I think glPolygonOffset(1.0, 1.0) will do.

Hope that helps,

GuentherKrass

[Edited by - GuentherKrass on October 12, 2006 5:47:46 AM]
f_gerhar
f_gerhar
Günther, that was fast, precise and the miracle answer I was looking for.

When I come to think about it, no miracle at all, just logic sense. It figures, the offset works perfetly. Thanks a lot, vielen Dank ;)

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.