Landscape layer painting behavior changed after recent CL

Hi Jonathan Bard,

I would like to ask about your CL 46382088 “Removed landscape “paint-time weight balancing” for the legacy weight blending layers”, which changed landscape layer painting behavior for us.

Before the CL if I painted over layer A with layer B, the paintbrush gradually erased the layer A’s weight, eventually completely replacing the surface with 100% layer B.

After the CL if I do the same, I end up with 50% layer A and 50% layer B. I have to switch back to painting layer A and manually erase it’s weight to get to 100% layer B like before.

In the changelist description you mention “weight blending is applied as the final edit layers merge step, leading to normalized weights all the time”. If I understand correctly, you are referring to PerformFinalWeightBlendingPS, which indeed does normalization. But it’s different than what bWeightAdjust did in FLandscapeEditDataInterface::SetAlphaData. Because bWeightAdjust adjusted existing layer’s weights, while the PS adjusts just the end result.

I have tried switching between Legacy Weight Blending and Advanced Weight Blending but didn’t see difference in behavior. I don’t even know what Advanced Weight Blending is supposed to do.

Are you aware of this issue? Maybe a fix is already on its way? Maybe we set up something incorrectly or did a mistake while merging?

Regards,

Gabor

Steps to Reproduce

Using a simple landscape material and a landscape with single edit layer.

[Image Removed]

Before CL 46382088

Paint dirt, grass and stones on top of each other. The result will look something like this:

[Image Removed]On Landscape Layer visualizer you can confirm that the grass completely replaced dirt and stones completely replaced grass: [Image Removed]

After CL 46382088

Repeat the same painting as before. The result will look different:

[Image Removed]On the debug you can see that the layers just “averaged out”. Painting grass over dirt resulted in 50% grass, 50% dirt and painting stones over both resulted in 33%-33%-33% blend.

[Image Removed]

Hi [mention removed]​, did you have a chance to take a look at this issue? I’d really appreciate it.

For the time being, we have reverted parts of CL 46382088 (the deletion of bWeightAdjust in SetAlphaData) to get back the old painting behavior. However we would prefer to avoid making engine changes and instead understand how the new blending method is intended to work.

Hi Gabor,

The painting behavior that used to increase weight on a given target layer and decrease weights on the other weight-blended target layers has been removed, yes. It was kinda working in the generic case of painting on a given target layers and on a single edit layer, but otherwise, it has always been a bit wonky, especially when it came to erasing a given layer, since it had to make a guess as to which other target layer to increase in order to compensate, which was based on the component being painted and led to weird behaviors, where some layers were artificially increased on a component, and while other layers were on a neighboring one.

Moreover, these weight blended layers only really worked when not using edit layers (or when using a single edit layer). Therefore, since edit layers are now mandatory in UE5.7, we’ve decided to remove that behavior and were planning on bringing it back in another fashion, a more robust one, as an opt-in (or opt-out) option in the landscape tools (e.g. a toggle in the paint mode toolbox and/or a key binding, like “Alt” or something along those lines), in order to let users paint exclusively on a given weight-blended target layer (as in UE5.6) but also to let them tweak individual target layers independently, which was impossible in the past.

Unfortunately, because of shifting priorities, we couldn’t do this in time for 5.7 and we felt that this was not a critical feature to maintain in the mean time, since (legacy) weight-blended layers were so bug-prone with edit layers in the first place (because of the aforementioned issues) and because most of the large projects we see don’t use these weight-blended layers (for those very reasons) and were therefore not affected by this behavior. Artists on these projects simply paint / un-paint target layers one by one, in order to better control the weights on a per-target layer basis.

That being said, we can see how this change can feel disruptive when you are used to work in this fashion and we have understimated how widespread weight-blended layers still are, so we are working to bring it back in a 5.7 hotfix, although this is not an easy thing to do, since the rules for such hot fixes are quite strict.

To answer your other question, advanced weight-blending has been introduced as a way to resolve these problems of target layers not working adequately with edit layers. Unlike “Final Weight Blending (legacy)”, the blending takes into accounts the edit layer’s accumulated weight of its weight-blended target layers and will use this measure as a blend factor of sorts, in order to progressively override the values of those same target layers but from the edit layers underneath, while maintaining a total sum of 1. This allows to paint some weight-blended layers on an edit layer underneath (e.g. a “base” layer, containing the “rough” weight values), and then to “override” these weights with those from an edit layer above (e.g. a “details” layer, where the user can hand-paint fine details in a non-destructive manner), which feels much more natural than the legacy blending technique, where the values from the edit layer were simply added on top of the ones from underneath and then renormalized, which was leading to target layers that felt subdued rather than overridden.

Again, this new technique answers the needs of most big projects we’ve consulted, which didn’t have that “paint-time weight balancing” behavior of legacy weight-blended target layers and we didn’t want to introduce it in the same form, since its behavior was so erratic in the first place. And that is why our plan was to bring it back in a more robust fashion and in a way that works with any blending method (hence, the “opt-in” or “opt-out” paint option).

We apologize for the inconvenience caused. Rest assured we are working towards a solution, hopefully in time for one the UE5.7 hotfixes.

Jonathan

Hi Jonathan,

Thank you for the exhaustive answer. We have p4 access so receiving the fix as a 5.7 hotfix is not a priority for us. When you have the new paint option ready and submitted to your main branch, feel free to send us the CL number. We will gladly test it out and provide feedback.

I will also discuss the use of Advanced weight-blending with our artists. It would be beneficial to align more closely with the workflow of other big projects, to prevent relying on features which are considered unused.

Regards,

Gabor

Sure, I’ll update this ticket when the new paint option is submitted. Thanks!

In the meantime, the original change will be backed out in UE5.7.2

Jonathan

I have to chime in with a grievance here and a question.

Why would you make Edit Layers mandatory now? Our whole landscape editing has been halted because we can’t disable Edit Layers now that they are mandatory, and most of our paint layers are weight (height) blended. And we cannot properly paint anymore.

[mention removed]​ The slight engine change you did, does it bring back the old blending behavior?

Hi again,

FYI, the backout of the change has been submitted in the UE5.7 branch (for UE5.7.2) : https://github.com/EpicGames/UnrealEngine/commit/242a1833c436261adc7a7df004fe5b5e54739d24

Also, the new “exclusive paint” mode that does this the proper way for all types of weight-blended layers has been submitted in UE5. This has not been thoroughly tested just yet, but I mention it in case you want to see what it will look like in UE5.8. You’ll need all of these changes :

The gist of it is there’s now an “Exclusive Paint” mode (activated by default) that behaves more or less like it used to in UE5.6 for weight-blended layers (erasing the weights on the other weight-blended layers of the same blend group as you paint), without all the weirdness when erasing. There is also an icon on the target layer thumbnail indicating the type of operation applied to this target layer by the tool (a plain icon for the selected target layer, a hollowed-out one for the other ones of the blend group, that will be inversely affected by the tool while “exclusive painting”). This mode can be turned off by pressing Ctrl while painting, in order to only paint the currently select target layer (UE5.7-style). Erasing disables exclusive paint mode (i.e. it only affects the current target layer).

This will probably get some improvements depending on user feedback until the UE5.8 release. Feel free to get back to us with comments or suggestions if you happen to try it out.

Thanks,

Jonathan

Hi Tomislav,

Regarding your grievance, Edit layers have been part of UE since UE4.24 now, and the burden of supporting both the non-Edit layers and the Edit layers part was becoming too great for the small team that we are, with no real benefit. After all, a non-edit layers landscape is identical to an edit layers one with a single edit layer, so the conversion is trivial and we made sure that existing landscapes remained 100% compatible on load. Therefore, from the user’s perspective, the switch to edit layers landscape should be transparent. The 2 systems used very different code paths (the former is CPU-only, the latter runs on the GPU and is read back on the CPU) and more and more features and optimizations we are making are only possible on the edit layers system.

What prevented us from doing so up until now was :

1) No support for the Retopologize tool (i.e. the XY offset texture system + convex collision mesh) when using edit layers

2) Edit layers are bound by VRAM and could lead to out of (video) memory situations on particularly large landscapes due to how the GPU merge of edit layers was previously implemented

The reasons we moved ahead with the removal of non-edit layers landscape in UE5.6 are:

1) The Retopologize tool was hardly understood by users, its impact, almost inexistent with the type of landscape resolutions that are used in games (including Mobile ones) nowadays, plus it didn’t allow for overhangs. It ended up being rarely used as a result (or it was, but by mistake). It also had a very bad impact on memory and performance both on the GPU (it requires an additional texture to store and sample the XY offsets) and on the CPU (it turned the landscape heighfield collision component into a full-blown convex mesh collision component, which requires more memory than heightfields and is less efficient). We deprecated the tool in UE5.5 for non-edit layers (it was already disabled for edit layers) with a CVar to let users know and prepare themselves for the full removal in UE5.6, should they ever need it. There was not a single complaint or comment to that effect, so we decided to move forward with the removal in UE5.6

2) For several UE versions we implemented a new way that edit layers get merged on the GPU with the so-called “batched merge” code path, which we finally enabled by default in UE5.6. The benefits of the new algorithm is mainly the VRAM consumption which is now capped (if you don’t user BP brushes), instead of being unbound in the past. This means that even for very large landscapes, the merge will now happen on smaller landscape regions, avoiding the problem of running the algorithm on the entire landscape (if all landscape actors are loaded in the editor), which could quickly lead to Out Of Memory issues. The new algorithm also opens the door for several optimizations in the future, since the notion of locality is now embedded in the system. The 2 previous versions of the algorithm were still ready to use in UE5.6 but the batched merge system is now solid enough that we’ve been able to remove the 2 old code paths in UE5.7

With those 2 issues solved, there was no benefit to keeping non-edit layers so this is why we went ahead with its removal in UE5.7. That also opened the door for implementing the new “advanced weight-blending” technique in UE5.7, which runs on the GPU and only as part of the batched merge algorithm. It solves the most nagging features of weight-blended layers when they’re being used on multiple edit layers, as described in the post above.

That being said, the removal of the “weight-time paint balancing” system was something else entirely and it was done to solve other recurring issues that users had when using weight-blended target layers on edit layers landscapes (with more than one edit layer). Once again, I apologize for the sudden removal, it was meant to be replaced by a better system that supports both weight-blended and advanced weight-blended layers and is user-togglable, which will be added to the engine in the coming days (available in UE5.8). We simply failed to meet the UE5.7 deadline and hoped that it would not feel too disruptive (based on the arguments in the post above) in the meantime, although we were probably wrong here.

As for UE5.7 users, we will submit a backout of that removal in early December, targeting UE5.7.2 (it’s ready but we cannot yet submit on this branch, because UE5.7.1 is being finalized ATM), so that users can find back the same behavior for weight-blended target layers than they had in UE5.6.

Hopefully you’ll be able to integrate either the new UE5.8 tool or the UE5.7.2 backout when it’s submitted.

Cheers,

Jonathan

Hey, Jonathan.

Thanks for the detailed info on this.

It’s pretty frustrating as a fair amount of our work relied on our current landscape workflow where we didn’t utilize Edit Layers and where we normally painted the Target Layers that were Weight Blended (we use Height Blend option in the shader Landscape Layer Blend node).

Because “early December” is too far away of a timeline to wait for something that might re-enable our workflow, what would be the avenue for us to move to the new system? Are there any training videos, documents or anything regarding Edit Layers, and how they work with weight/height blended Target Layers?

Is the idea of creating 1 Edit Layer for each Target Layer and paint the Target Layer exclusively in that Edit Layer (e.g. we paint Layer_1_Snow ONLY in the Painter_Layer_1 edit layer)?

Or do you suggest any other way of going about this? Because we have a LOT of landscapes and we would need A LOT of work to adapt them to the new workflow where Edit Layers are mandatory.

And also, the actual problem we are having that we cannot properly paint our Target Layers using a single Edit Layer. Is that a know limitation/issue, or am I doing something wrong on my part?

Cheers,

Tomislav

Hi Tomislav,

There is some confusion here, I think. Edit layers don’t change anything to the problem we’re discussing here. I just mentioned them to explain the underlying reasons for why we removed the “paint-time weight balancing” behavior on weight-blended target layers. The removal of that behavior is what causes you friction at the moment but it’s actually unrelated to the fact that edit layers are mandatory, it simply turns out that in UE5.7 we both made them mandatory and removed that paint-time behavior with weight-blended target layers.

When using a single edit layer, landscapes work exactly the same as they used to with non-edit layers. The conversion is actually seemless, so loading a map containing an old, non-edit layers-enabled landscape in UE5.7 will auto-convert it to edit layers, and it will import the existing landscape onto a single, default, edit layer. That is where you will keep on working, so in practice there’s zero change as far as the user is concerned : you don’t need to add a new edit layer if you don’t want to, there will always be one and only one edit layer selected in the UX (i.e no extra-click needed) and we prevent removing the last edit layer anyway, so effectively you don’t have to worry on which edit layer you work if you keep on using a single one.

Edit layers are documented here and we’re in the process of updating the entire landscape documentation and in particular, that of the new weight blending method, the one meant to solve the issues with weight-blended layers when used in the context of several edit layers. Again, if you restrict your landscapes to a single edit layer and the legacy weight-blending method, there will be no difference (except for the removal of the paint-time weight balancing behavior) so you don’t have to change anything with the way you currently work, regarding edit or even target layers.

The one thing that does change is that without the paint-time weight balancing behavior, when you paint on one layer, you have to “un-paint” (Shift-click) the other layers from the same blend group, so that is what causes you trouble here, even with a single edit layer. Don’t get me wrong, I understand that this is a major pain point for you, but my hands are tight by the UE release process here and there’s no way I can fix this faster. If you cannot afford to wait for Dec 1st (the day we are allowed to start submitting fixes for 5.7.2), you can do what Gabor did and backout CL 46382088 , it’s pretty close to what I will submit then.

Cheers,

Jonathan

Hey Jonathan,

Thanks for the clarification. I understand the whole situation a bit better.

We’re gonna see internally if we can back-out the specific CL you mentioned.

Cheers!