Wrong shadows with negative displacement

I tried enabling tessellation for my landscape with displacement that goes both up and down.
However it looks like the terrain is wrongly shadowed with this. Even when I let the displacement only go up there some black spots on the landscape.!
Using dynamic light source.

For now I will go with parallax occlusion instead.

Hmm, it looks like a problem in your material. Can you show the material?

No, it’s not my material that is causing it. At least not any nodes I added. Even with some constants plugged in the issue remains.
Also, crack free is only for meshes. Not for landscape.


Ok. It’s hard to tell without seeing the whole thing. And I don’t want to see the whole thing :wink:

I’d try ( for now ) simplifying this whole area. Make the tessellation just a constant ( maybe 5 ) and use single channel from a texture as the displacement.

If you don’t see the problem, then it’s something else you’re doing in the material.

( I’m assuming you’ve got ‘crack free’ on? )

Ok, weird.

You made the landscape with the tool, or did you import it?

I don’t know how, but I guess it must be something to do with that, but I have no idea what…

It’s generated from a heightmap

No offense but random speculation like that will not help

I made the same setup in 4.24.3 and there it works perfectly.
So, my suspicion is that is a bug in 4.25.1

No offense, but how long do you think you would have fiddled with the material, without me getting you to the point of realising it wasn’t the material?

Thanks for helping! :slight_smile:

Got back on this after a break.
Issue is confirmed with ray tracing shadows only!

I have something simiar in 4.25.4
Did you ever managed to solve it?

Same issue here :confused:

It is still a problem in 4.26
Does Anyone knows a way to fix this bug?

I only managed to solve it by disabling Raytraced Shadows for the Landscape Material.

Same, or by making the displacement go above 0 only.
These are only workarounds though, no real fixes to the bug unfortunately.

Thanks! This is the best explanation I have seen so far.
This is probably also related to the reason why I am having so much troubles with procedural foliage and raytracing shadows too.
I wonder though, is this a UE4 limitation right? I mean, all modern rendering softwares can have negative displacement and raytracing together. Arnold, mantra, redshift, even mental ray.
Isn’t this something the Unreal Engine team should try to fix?

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.

There’s a variable, “r.RayTracing.NormalBias” (default 0.1) that some people have used to hack around this. NormalBias is saying “for all raytracing casts, shift upwards along the normal by this amount”. So you can make all of the rays start higher up from where the tessellation pushed the ground down. But it changes the way all rays are cast, so keep an eye out for whether it adds other artifacts elsewhere in the scene.