Can I use multiple Texture2D on a Material definition?

Like this:

MaterialParameters {
    Texture2D ColorMap1
    Texture2D ColorMap2


I’d like to extend the spritesheet shader for using multiple sprite sheets.

Of course you can. For an example, see “almost every JME default material”.


As far as I remember you can set up to 16 texture parameters for a material instance.

1 Like

Is it true? On the TerraMonkey page is written “OpenGL supports a maximum of 16 samplers in any given shader”, and it means exactly this?

For every texture given as a parameter you need to have sampler inside your shader. So … yes, 16 textures at one time.
You can define even 100 textures in material definition, but only 16 you can pass to the shader at one time.

1 Like

16 are reliable, each opengl specification is free to allow far more, some actually allow 1024 and more, but do not bet on it.

1 Like