[OpenGL] Landscape layers rendering issue

This is a extension of this report: OpenGL4 Landscape Rendering Issue - Platform & Builds - Unreal Engine Forums

This is still an issue. I did open a separate question regarding this as I thought it is me doing something wrong here: Landscape material normals - Rendering - Unreal Engine Forums

The issue manifests itself when three or more landscape layers meet.

An easy way to reproduce this is in the linked question. Or you can take some asset from the marketplace(I have this one that I have tested works ok on Windows and is broken on Linux Graveyard and Nature Set in Environments - UE Marketplace, opening the preview map).

The same project
On Windows:

On Linux:

On Linux with only one landscape layer applied:

I have tested this on:
Kernel: 4.13.12
nvidia driver: 387.34 on 980 TI

OpenGL renderer string: GeForce GTX 980 Ti/PCIe/SSE2
OpenGL core profile version string: 4.5.0 NVIDIA 387.34
OpenGL core profile shading language version string: 4.50 NVIDIA
OpenGL shading language version string: 4.60 NVIDIA
OpenGL ES profile version string: OpenGL ES 3.2 NVIDIA 387.34
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.20

DE: Gnome 3.26.2

The engine version that I tried was 4.17.2 but from what I have tried previously this is still an issue on 4.18.

This is a major pain. To answer Yaakuro question, tessellation is used(but it is not the cause - this is still happening with it disabled) crack free displacement changes nothing.

I have managed to reproduce this on Windows with the OpenGL backend also (but not the DirectX) backend (so removing the linux tag).

I am still digging into this but I took a look at the shaders and removing the link to Ambient Occlusion fixed part of the issue for me but there are still some black textures coming from the Normal map at certain LODs. I have a feeling there are potentially some NaN or INF values running through the shader somewhere as this is one of the major differences between the DirectX and OpenGL spec. There are sometimes issues where code will multiply inf by 0 instead of clamping or branching and this would be NaN in OpenGL but 0 in DirectX.

Hi Ant, thanks for looking into it. I do have a feeling that it is a question of number of textures used for the for the landscape material. Did not test it though as my focus is elsewhere instead of fighting the impossible.

What leads me to believe this is that as long as I have only two textures everything works including AO I think(it has been some time), but once the number of textures reaches X things start behaving strange.

Hey, is this in process or do I need to resubmit it through the new bug tracking tool?

Hi Aknarts,

Looking into the issue more deeply, it is most likely still hitting the maximum number of textures and trying to read from an invalid texture which is used for some part of the reflection vertex shader or height map. In a few of the RHIs you can easily hit 32 textures when using multiple landscape layers. Even though the landscape material itself might use less than 32 the other textures are bound in the engine itself for the actual landscape layers.

I would suggest testing with 4.19 and using vulkan and submit a bug if it still occurs. It will be easier to get more traction if the issue occurs on vulkan as I doubt the 32 texture limit would be raised on the OpenGL RHI.

Sorry to reopen this, just wanted to report back. The issue seems better even under OpenGL in 4.19, the Vulkan version of the engine crashes when switching to lit mode( already reported the crash). but the artifacts do not seem to be there. Thanks for the hint and thanks for making me try the Vulcan build.