Ray-Traced Landscape Tessellation with Displacement causing weird shadows?

I’ve run into an issue with my landscape material in my ray-tracing enabled UE4 project.

I’ve got a master landscape setup using blending modes, which I’ve used in a previous version of Unreal with no issues.

For some reason when I enable tessellation and add height to the displacement, it causes inaccurate shadows to appear on my landscape. No matter where a light gets placed the shadows stay exactly where they are at the same darkness.

Anyone have any idea why this is happening? I’ve tried quite a few things to fix but haven’t been able to figure this one out.

With tessellation and displacement

No tessellation or displacement

Master Material

Material Function Setup (RDA Texture)

I’m not sure which Ray Tracing setting causes this issue, but I found that if I force all ray tracing effects on and then back off that it fixes the shadowing.

r.RayTracing.ForceAllRayTracingEffects 1
r.RayTracing.ForceAllRayTracingEffects 0

1 Like

I finally figured out the exact setting that controls the behavior of these shadows. I went through almost all the raytracing console commands and finally stumbled upon r.RayTacing.NormalBias. After playing with this I found that increasing the value produced more accurate shadows (a setting of around 20 produced what I needed). Now that I knew what command controlled this feature I found a post slightly describing it here:

It seems the default value is 0.1, so I’m not sure if changing this to something with such extreme difference has a drastically negative effect on performance or causes issues elsewhere.

1 Like

This actually isn’t a solution because this is disabling all ray tracing. Apparently my brain wasn’t working this day.

Hey! Have you fixed those incorrect shadows eventually?

Late answer, but googling led me here, and I figured it may lead others here too.

Your tessellation is moving the final location that the pixels of the terrain land, in world space, up and down. But raytracing doesn’t do tessellation. It just uses the original shapes.

So when we try to cast a ray from one of those shifted pixel locations, if it went down into the ground from where the mesh was, it will immediately hit the mesh, and “self-shadow”. No light can get past the ground mesh to the shifted ground pixel.

NormalBias is saying “for all raytracing casts, shift upwards along the normal by this amount”. So you’re just making all of the rays start higher up from where the tessellation pushed the ground down.

In my case,after I done the other things U told,I found I just set the light detail-Casecaded shadow maps-Dynamic shadow distance stationaryLight to 15000,then the shadow came.