What counts as a texture sampler?

What exactly counts as a texture sampler in your shaders? If you use the same image resource multiple times within the same material does each instance sometimes count as it’s own sampler? Do samplers nested inside material functions count? I’m asking because I have a rather complex shader set up and by MY reckoning, I’ve got a lot less texture samplers than what’s being reported.

Hi Hyperloop -

Any time you call a different texture from a Texture Sampler or Texture Object, it counts. If you use the same Texture multiple times, however, it only counts once. Samples even though they are nested in your Function still count toward that materials total count of available texture samplers. Remember however that a blank material will still have 3 samples, this is for lighting information (this assumes the Default Material Setup with Default Lit).

You can keep take of your number by going to the menu bar in the Material Editor and click Window >> Stat and it will display your Instruction Counts and Texture Samples.

Hope that helps you out -

Eric Ketchum

Does this work for Linux builds too? In windows our shader shows 16 samplers but when building for Linux it complains and says there are 17.

AFAIK this shader count limit has been raised quite a lot in the interim so it should not be an issue.

But is there a list of things that will count? The DistanceToNearestSurface node uses one. How do textures set to Shared wrap and Shared clamp work? Does clamp and wrap count differently or as seperate?

Where could I read more about these specifics?


Please see this Q : In build pack mobile samples show diff stats from UE editor - Rendering - Unreal Engine Forums