Landscape material very long compile time

I’ve ran into an issue when making 18-layers terrain material. My problem lies in its compile time, which exceeds several hours for terrain with only 16 components.
To briefly describe the structure of my material, I am using 18 individual material functions for landscape layers, then blending them in another material function using LandscapeLayerSample and LandscapeLayerSwitch and slightly modified version of MatLayerBlend_Standard with height lerp.

Sshots:

Layer function

Material

Part of layer blend function, it is repeated for 18 layers.

On top of that, with tesselation and displacement pins connected, there is an error about compiled material being longer than 32768 lines.

Worth mentioning here that using LandscapeLayerBlend nodes instead of abovementioned blend function does not improve material compile time noticably.

Am I doing something terribly wrong here?

Hey Deathrey,

So your landscape material is pretty complex, and the warning message is an indication of that. When it comes to the LandscapeLayerBlend nodes, try setting each of your texture samples to the ‘Shared:Wrap’ to see if that helps with your instruction count and allows your material to compile.

I will say that the compile time is going to be long as your material is quite intense. I think what could be the issue is the length of your blend function in combination with you calling that 18 times. Let me know once you have tried the suggested implementation, or if you need further assistance.

Cheers,

Thanks for reply. All of my samplers are already set to shared wrap.

If you would like and have the space, you can share this material with me in a blank project and zip it up into a compressed folder so I can open and dissect it on my end. It is going to be hard to determine what the issue is unless I have the material on hand.

Simply zip up your .Uproject, Config, and Content files and folders and upload them to an external file sharing program like Google Drive. You can then share the project via a private message link on the forums to my name, AndrewHurley.

Let me know if you have questions or need further assistance.

Cheers,

I’ve sent You a PM.

As I expected, this material is incredibly complex and the expected wait time for compiling this shader is going to be quite long. Also, if you are exceeding the lines, this is an indication of your shader being quite bulky and in need of optimization.