• Advertisement
Sign in to follow this  

Odd self shadowing question

This topic is 1061 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi!

I've solved a self shadowing issue, but the solution was the opposite to what I expected. I had a mesh and a simple plane with the meshes' shadow being rendered on the plane via shadowmapping.

 

When rendering from the light's POV of course I culled front faces and rendered back faces of the mesh. There was some pretty bad self shadowing on the final image so I thought that the back and front sides of the mesh may have been too close to each other leading to problems in the depth values being compared. Therefore I thought scaling the mesh would help.

 

I scaled the mesh to 200% of its size in every direction, with the thought that the two sides of the mesh would be further apart and so the depth values for comparison would be wider apart. Yet, the self shadowing was in fact much worse.

 

I then tried the counter-intuitive solution of making the mesh smaller by 50% in each direction, and that solved the problem. 

 

Why is this?

Share this post


Link to post
Share on other sites
Advertisement

You use the term "self shadowing" which can have several definitions and causes. Among the causes for artifacts (a more general term) is the closeness of depth values between the shadow map and the scene depth. That closeness can result from several factors - one of which is the difference between shadow map texels and scene pixels. That is, the shadow map characterizes a texel at a single depth. From the scene point of view, that texel may be sampled for several pixels to be rendered. If the scene depth varies over those pixels (particularly along edges or faces with high slope values with respect to the view direction), those depths will all be compared to the same depth in the shadow map. EDIT: that is, when pixels are rendered close to the edge of an object, some of the pixels are at "background" depth. When the edge of the object is rendered adjacent to a "background" pixel, the depth decreases dramatically. However, both the "background" pixels and the closer object pixels may all be at the same texel location in the shadow map.

 

The closer an object is to the near-plane in a scene, the more pixels are rendered, and the more likely a single shadow map texel will be sampled for multiple pixels. It may be that by scaling the mesh, you're reducing the number of pixels in the scene that are compared to a single texel.

Edited by Buckeye

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement