HLOD landscape building is broken in editor

Landscape HLODs are broken in 5.7.2 (Github Release branch)

Landscape HLODs are broken when built from editor, either by clicking build on a specific landscape hold actor tile or by running the commandlet for the level via the build drop down menus.

I tested two setups, both based on the open world starter map. In test case A I modified the level such that the landscape material used RVTs. In test case B I simply modified the RGB material, no RVTs. In both test cases the landscape was nanite enabled.

Test Case A:

HLODs superimposed on Landscape

Just HLODs:

The landscape material simply writes out the green color to a RVT and then resamples said RVT to output base color. The landscape HLODs are completely black. I suspect this has something to do with the fact that the new BuildHLODWorld is not correctly setup.

When rebuilding a specific tile via the build button, the result is as follows:

I have determined that the grey color we are seeing is the world grid material being used to render the landscape tile during the rendertotexture(…) call as part of the Bake Landscape Material process. The reason for the world grid material is simply due to the fact that the shader map for the actual material used on the landscape is not ready and so it falls back to the world grid material. Later in this post is a render doc capture showing the landscape being rendered with a world grid material.

Test Case B:

Below is a screen shot of the landscape hlod superimposed over the landscape.

Here is the same, but with the landscape hidden

In test case B, when building via the commandlet, things work correctly. However, building via the landscape hlod tile by clicking the “build hlod” button leads to incorrect results.

On the first attempt to build HLODs via the tools drop down on the hlod actor (“Build HLOD” button) we get a correct result. On any subsequent attempt, on any other hlod actor results in a grey hlod tile. Here is what it looks like, after attempt > 1 (I have numbered my attempts in blue):

Here we can see the same behaviour exhibited as in Test Case A. When building a specific tile via the HLOD actor the tile is captured with the world grid material rather than the landscapes actual material. As mentioned before, this is because it can no longer find the shader to render the material in the Build HLOD temporary world. It is curious that it works on the first attempt, this is not the case when working with RVTs.

I made a Render Doc capture, with nanite disabled on the landscape for easier debugging. The bug persists and behaves the same regardless of nanite.

Render Doc Capture events 1883 and 4051 show the basepass and post process material draw calls.

BasePassParallel:

Post Process Material (Base Color):