Blended landscape weightmap contains ghost of cleared layer

Hi,

During landscape weightmap painting sometimes we end up with “ghosts” in the weightmap (see repro). These ghosts cause that the weightmaps don’t add up to 1.0 anymore and that is ruining layer blending in the material.

I have looked at the render capture using landscape.RenderCaptureLayersNextWeightmapDraws 1 (see attachment).

The problem is probably caused by the fact that in the “Blend Layer” step the engine writes to ScratchRT0 only the layers which contain data (layer B in my case). But in “Render Final Weight Blend” step it reads from all ScratchRT0 layers. And it seems that after an operation which clears the whole layer there is no code which would clear the corresponding slice of the ScratchRT0 texture.

The fix could be either to exclude unused layers from “Render Final Weight Blend” step, or to properly clear unused slices of ScratchRT0 texture.

Regards,

Gabor

Steps to Reproduce

  1. Create a landscape with multiple layers
  2. Paint something in a layer weightmap (layer “C” in my case)
  3. Clear the layer either by “Right Click->Clear Layer” or by selecting a large brush and shift-clicking the whole Component at once.

[Image Removed]

4.Observe the remaining layer weightmaps. Some of them (layer “B” in my case) will contain a ghost of the deleted layer. It is visible using “Visualizers -> Layer Debug” as well.

[Image Removed]

I have found a workaround fix: paint something in the C layer again, this will force the layer to be re-evaluated and that will clear the ghost. Unfortunately when the terrain has many layers it is difficult to figure out which layer is causing the ghosting. And nobody wants to go through all layers in all components.

Hi Gabor,

Thanks for reporting. By a weird coincidence, this is a bug that I fixed this very morning (here’s a public ticket for tracking : Unreal Engine Issues and Bug Tracker (UE\-313488\)). Unfortunately it’s not in the plans to make another hotfix after UE5.6.1 and the fix won’t make the cut. But if you are building the engine yourself, you can integrate the following commit to get the fix : https://github.com/EpicGames/UnrealEngine/commit/007710b3353341a72031abd6cfdc51a13385a9b4

Cheers,

Jonathan

Hi Jonathan,

Thanks for the quick fix. We are building the engine ourselves and we’ll look into integrating your commit.

Regards,

Gabor

Thank you for this fix Jonathan. Edited: We’ve integrated it into 5.6.1 and it has resolved some of the issue, however we still have several areas where a similar issue is present.

Actually there are still quite a few artifacts. Let me know if I can provide any info to assist.

Hey Chris,

Sorry to hear this didn’t fully solve the problem. Can you provide more details on the artefacts you’re still seeing? Is this with the same repro steps? Can you attach a video with those?

Thanks,

Jonathan

Right now the repro is unclear - we have a large terrain with ~15 layers. The issue seems to semi-randomly hit areas when the layer weightmaps are recalculated. I’ll work to narrow things down a bit and report back.

So it looks like our remaining issue is actually corruption in individual masks, rather than a runtime blending issue. Here is one of the masks exported from the editor showing the rectangular corruption:

[Image Removed]TLDR - Our remaining problem is clearly an unrelated issue that we’ll investigate. Thanks!

Ok thanks for the information.

Don’t hesitate to update this ticket if you find the source of this other issue. There was a big code refactor happening around landscape edit layers in 5.6 and we’re planning on removing the previous code paths entirely in 5.7 since we’re supposed to be 100% backwards-compatible with those. So if there is any issue with the new code path, we need to know.

Cheers,

Jonathan