Max layers exceeded, but I do have less than 16

I get this error:

Error [SM5] error X4510: maximum ps_5_0 sampler register index (16) exceeded

Which I assume means I have too much textures. But that is not true, I have 9 diffuse textures. And I am hooking them up to a Layer Blend node. I am using Height Blend and each layer has it’s input of a B/W map set at the correct size. That makes a total of 18 inputs. I thought that may be the problem (even if technically there is only 9 layers) so I removed a couple of them. But still not working.
I does work with only 2 layers, each with its splatmap. Which is weird. Is the limit really 16?

I also painted the terrain before with the other method, Landscape Layer Weight, and it worked fine with all the textures added. There were 14 diffuse textures in total. And I imported the splat maps into the layer info.

I am using the LayerBlend method to add normals to the terrain (as far as I know I can’t do that with LayerWeight).

Any idea why it says I am exceeding the amount?
Or any idea if I can add normals and displacement with LayerWeight?

After playing around a little bit it seems to be related to “Preview Weight”

I have them set to 0.5, otherwise it won’t work. But if I set it to 0 on some of them, the material does work (leaving holes were the rest is missing)

I have only 4 layers with the texture weight set to 0.5, the rest is at 0. Of 9 total.

If any one could explain what exactly does that parameter do I may be able to understand why it doesn’t work.

Are all your 9 layers using the same texture as the B/W height map? If not, then each layer is two textures meaning you have 18 textures. Otherwise it would be 10 if they share the same height.

I did a test-case and for some reason, I could only paint 8 height-blended layers on the same component before it caused the shader to break. I could paint all 9 without problem if I made them Alphablended instead.

I think we have a lower than 16 texture limit for landscapes because of the weights and lightmaps but I am not 100% sure. Assigning to who can answer definitively.

In another post one of the staff said there was a known bug.

And no, each of my diffuse have separate height maps. I didn’t try alphablend, I don’t know how it works. Is it something like layerweight node?

This issue must be only with the layerblend node, because there is no problem at all with the layerweight.

It’s strange. Plus something I noticed is that when I change the preview weight in the layerblend node, the… i don’t recall how it’s called… in the console where errors apear, there is a number like X/16, which must be the amount of used layers. Well, when changing the preview weight sometimes that number goes up, sometimes it goes down. It a weird behavior, I can’t make any sense of it.

Hi SuIXo,

There is a shader limit of 16 texture samplers total. We are looking to increase that to 32 in an upcoming release.

But for now, the limit for use inside a material is 13 user textures, because 2 are used lightmap cooefficients, and one is used for the Specular cubemap. If you set the “Fully Rough” checkbox on the material, the Specular cubemap is not used and that gives you 14 user textures.

The landscape weightmaps (textures automatically generated from your painting) uses 1 texture for every 4 layers you use. So for a regular material with roughness and up to 4 layers, that should leave you 12 textures you can work with, or 11 with up to 8 layers.

There shouldn’t be any usage difference between the blending method (LandscapeLayerWeight or LandscapeLayerBlend).

Can you post your material .uasset files if you’re still having trouble?


1 Like

Nice, thanks for the info.

I don’t think I’ll have any more trouble. This explains it very well.

hello JackP,

do you know when the 32 textures support will be implemented ? Is it soon or further down the line ?

1 Like

2016 and still no 32 texture support :-/

1 Like

Hi Narg, we’ve had a solution to this since version 4.6 (in 2014 :slight_smile:

You just need to so set the TextureSample node’s SamplerSource property to one of the Shared inputs (probably Shared: Wrap if you want your texture to tile).

Using this method you should not run out of texture sampler slots.


2018 and still no 32 texture support :-/

1 Like

As mentioned above, we have shared samplers so this is no longer a practical limit. We limit SM5 to16 samplers so materials for that shader model will work on all platforms where we support SM5.

1 Like

I use 5 textures per 1 layer, and have a three layers… wtf ue? fk u!!

awesome, that worked. thanks

Worked perfectly. Helps so much with an Auto-Landscape setup with more than 3 or 4 texture sets.

If you change the Sampler Source of your Texture Samples to “Shared: Wrap” it will work.


Thank you so much for this reply, saved me!