1
\$\begingroup\$

I am implementing the shadow map in opengl with opentk everything works fine except I have a peter panning effect that I can't solve it by changing the face culling to front then render to the depth buffer.

the model is large so I scale it to small value to render it to the shadow map.

what is the reason that may cause this problem?

enter image description here

\$\endgroup\$

1 Answer 1

2
\$\begingroup\$

To fully answer this question, let's start with an explanation of relevant shadow mapping issues and solutions:

Issue: Stippling

Cause: limited resolution of shadow maps, leading to reduced depth accuracy, this creates an alternating "in/out of shadow" artefact.

Solution: Add a "shadow bias" term to your calculations, which will move the shadows slightly, and compensate for stippling, giving you a solid shadow.

Issue: Peter Panning.

Cause: As we know that the shadow bias term moves the shadows, we can therefore assert that too small a value will not have a noticeable effect, and too large a value will visibly detach the shadow from geometry, regardless of geometry culling settings.

Normally, the ratio of geometry scale and shadow bias will be sufficient to make the panning not very noticeable, but it is reliant on that ratio being maintained.

See the following image for a visual explanation of the issue:

enter image description here

In the left image, the geometry is un-scaled, with a normal bias value. There is a small amount of panning. In the right image (zoomed a little), the geometry has been reduced in scale by a factor of 0.5, but the bias value remains the same, and because of this, the panning artifact is far more noticeable.

Solution: If you scale down the geometry (which is your use case), then reduce the bias value accordingly, but be aware that reducing it below a threshold value will cause stippling to return. Thus, scaling down your geometry may not be the best option for rendering more geometry to your shadow map. Indeed, reducing scale will actually reduce the accuracy of your shadow map eventually, which would eventually bring back stippling.

Truthfully, I don't really see much benefit to scaling down your geometry. If you wish to render more geometry to the map, move the camera back along it's "eye" vector, and increase the draw distance.

This will be more computationally expensive, but will give more pleasing results. Besides, using frustum culling and other software optimizations, you can easily compensate for any performance losses in favor of render quality.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .