Layered material issue: 4th layer painting breaks compiling

I’ve got a layered material with four layers, when I connect any texture set (and I’ve tried many) to the fourth layer blend inputs and paint onto a component, that component stops compiling and remains checkered.

I can get it to compile again by either disconnecting the fourth layer blend inputs or loading the color/rough/normals for one of the other 3 working layers into the t2d’s for that fourth layer network.

After googling extensively and struggling with this for over a day, I’m hoping someone here can recommend a fix I haven’t tried.

Images to help diagnose the issue attached. If there’s anything additional that would be helpful please let me know and I’ll reply with screens of it! Thanks!!

(Note: In the picture showing four materials rendering on the terrain, the fourth material has it’s outputs disconnected. When connected again, all components break due to my having previously painted that layer into all components layer_info’s during testing. If I had fresh layer_info, only components with that 4th layer paint on them would break.)

After more testing, I can paint any combination of 3 of the layers onto a component. As soon as the fourth is painted it stops rendering.

I rebuilt the layered material using landscapeLayeredWeight nodes instead of layerBlend nodes and the same issue remains. In the screenshot below you can see that I can paint 3 layers fine, as soon as I paint a fourth, the component’s texture breaks.

This is making me crazy.

So…If anyone ever finds themselves in my position about to blow your brains out, don’t do it. Instead, change your T2D’s sample source to “wrap”.

Image of setting attached.

Glad you figured it out :slight_smile:

For some insight:
It’s happening because you can only have at max 16 texture samplers. By setting their sampling mode to ‘shared’ (in your case shared wrap so they tile), you’re sharing those samplers across many textures. This way you can have a max texture sampler count of 128.