[SM5] error X4510 maximum samplers reached (16), only 14 active in material

Hi there,

Stats say that I am using more than 16 texture samplers, but, having counted them by hand I can only find 14 samplers. Are there any other parameters that consume sampler slots? are there hidden ones that I’ve missed?

When I remove a sampler in one of the layers it compiles just fine, meaning that I’ve got 17 samplers in there, which in turn means that there’s 3 that I cannot find.

When I remove the “incandescent cloth” material layer, it says I have 14 samplers active, while, at that point it should be 11.

The samplers in sequence are the following:

Master Material:

  • Albedo (RGB)
  • Layer Mask 1 (RGBA)
  • Layer Mask 2 (RGBA)
  • Detail Mask (RGBA)
  • Normalmap (RGB)

Steel, 1 sampler (RGBA)
Chrome, 1 sampler (RGBA)
Rubber, 1 sampler (RGBA)
Painted Metal, 2 samplers (RGBA, Nrm)
Metal 1 sampler (RGBA)
Incandescent Cloth, 3 samplers, (RGBA, RGB, Nrm)

With that said, I must be blind, or something strange is going on.

Below you can see the spagetti of everything, all samplers are highlighted with a red border.

(The warning above the sampler error can be disregarded as it goes away when the error is resolved)

Thank you in advance.

http://i.imgur.com/pEhXDh7.png

http://i.imgur.com/uTTtW0O.png

http://i.imgur.com/RN35D4c.png

http://i.imgur.com/GiaHLCI.png

http://i.imgur.com/ql2cW9O.png

http://i.imgur.com/gfus0Nk.png

http://i.imgur.com/yZQCMJy.png

http://i.imgur.com/7a55z7c.png

Answering my own question. 3 Samples are used for lighting information that are otherwise hidden.

Yep various code features like lightmaps use samplers. Note that you can use the shared samplers to get past the 16 limit (up to 128 unique textures).