Download

WorldDisplacement - no displace = black pixels

Hello all,
We know in Unreal, range displacement goes from fully black pixels to fully white pixels : world displacement works with positives values :

20200115_08h01_19.jpg

That is not the way other programs works where middle grey pixels are not affected by displacement distance (3ds, blender…): dark tones go down, and light tones go up :

The problem is, with height map generated from quixel mixer, once set in an unreal material, the surface will be moved as a whole, since where the gray pixels are not supposed to be affected, they are in unreal : we want the surface keeps its original Z locaiton as much as possible.
(for the screenshot purpose, in the 3rd image, I manually lowered the Z location of the surface)

Is there a way to uniformize the way displacement works in unreal?
Source code modification? Texture remapping by using nodes in material?
Maybe there is an option in quixel mixer to remap the heightmap before exporting?

What do you think guys?

Thanks,

Multiply your displacement by two and subtract one.

Thanks Deathrey, good point here.
But there is a ray tracing limitation with the use of negative values that causes shadow artefacts, as you can see :

So, with the use of ray tracing, we have to keep positives values.
I think the easiest way would be to get the lowest pixel value from the displacement texture and then, substract it to the texture, in order to keep a range from 0.

It could be possible to do it in C++, but is there a way calculate it directly in the shader? (With a custom node I guess…)

Why wouldn’t an absolute value setter node work for it? What is meant by subtract it TO the texture? isn’t it mathematically subtracting from the texture values?

@etiles were you ever able to figure out a fix for how this is being handled with ray traced lighting? So far the only solution I’ve come up with is clamping my displacement map between the values of .5 and 1 so that it only has the positive displacements, but then you lose have the displacement plus as you illustrated, it pushes the entire plane along with the displacement causing the shadows from the plane to be incorrect.

@IamBramer , yes. Use WorldPositionOffset instead of World displacement.
Then, you have to enable the “EvaluateWorldPosiionOffset” flag in your static mesh option (Details tab).

Then you’re losing Tessellation though, aren’t you?

Yes, you’d have to bring in a fairly high poly mesh as a base.

It’s been almost a year since this was originally posted, is there still no viable solution?

I came across the article, that solved the issue for me: Ray-Traced Landscape Tessellation with Displacement causing weird shadows? - UE4 AnswerHub (unrealengine.com)
The info on the exact function of the command is quite scares, was only able to find this via the link above: UE4 typically biases the start of the ray along the normal by a small amount when dispatching rays to avoid false self occlusions. This setting represents the furthest the ray origin is biased from the surface.The distance biased depends on how orthogonal to the surface the ray is.