Sign in to follow this  

Parallel lighting about shadow map, solid solution exists ?

Recommended Posts

Posted (edited)

Hi,
For example when you do a lighting at a timing of 12h you have a direction of light only on the direction of the bottom.
If you have some walls you end with the light direction and normal perpendicular you have N-dot-L of 0.0f which means no contribution.
The problem is about the shadow, because when you render the shadow map, then you end visually with sometimes shadow, sometimes not, a pop issue.
This is not a perpendicular issue on this case but a depth culling issue because the surface is parallel to the light direction.
Any solid solution for this popping issue ?
Thanks

Edited by Alundra

Share this post


Link to post
Share on other sites

You say for a vertical wall there is 0.0 contribution. Likewise in the shadow there is 0.0 contribution. .. of direct sunlight that is. Additionally the blue sky and the ambiente is contributing.

Share this post


Link to post
Share on other sites

That's true, maybe it's then a precission issue on the NdotL :

void Directional( in SURFACE_DATA SurfaceData, in DIRECTIONAL_LIGHT Light, inout float3 Result )
{
  float3 LightDirection = normalize( -Light.Direction );
  float NdotL = max( 0.0f, dot( SurfaceData.Normal, LightDirection ) );
  if( NdotL > 0.0f )
  {
    float3 SpecFactor = ComputeSpecFactor( SurfaceData, LightDirection, NdotL );
    float ShadowFactor = ComputeShadowFactor( SurfaceData.Position );
    Result += Light.Intensity * Light.Color * (SurfaceData.DiffuseColor * NdotL + SpecFactor) * ShadowFactor;
  }
}

When I move the camera I have a popping of shadow on the wall, like a culled shadow.

Share this post


Link to post
Share on other sites
Your specFactor is not multiplied by NdotL, which is a problem.

You can diminish this kind of shadow acne by ofsetting your shadowmap sampling position a slight distance along the normal. For your walls, that will make it sample the area in front of the wall, which hopefully has less flickering.

Share this post


Link to post
Share on other sites
Posted (edited)
You can diminish this kind of shadow acne by ofsetting your shadowmap sampling position a slight distance along the normal. For your walls, that will make it sample the area in front of the wall, which hopefully has less flickering.

I tried and indeed the issue is not there then, It's the real issue of shadow map to have lot of issue based on the kind of scene.

Edited by Alundra

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this