Dynamic Shader Or Array of Shaders Question

Does anybody know a way to have an Array of Texture Shaders or to Dynamically create shader properties.

I’m looking for something like.

Properties
{

_MainTex( “Particle Texture”, 2D[ ] ) = “white” {}

}

where 2D[ ] would be the An Array of Textures… I know that 2D[ ] is an invalid syntax. I’m looking for the correct way to do it. Any insight would be appreciated.

Texture arrays are only supported in DX10/11 as far as i know.

1 Like

So is it not supported? I don’t know what DX10/11 is.

It’s supported with DirectX 10 upwards (or DirectX 11, not completely sure). As Unity uses DirectX 9, no it isn’t.

Thank you for your quick response. Have a nice day.

Just to avoid wasting time in seeking a solution for my problem:

I have the same requirement, but now in Unity 4. I need to pass an array of textures to the shader. Is there a solution now?

I don’t think Texture arrays are supported yet, but i’m not completely sure as i’m having quite a bit trouble finding out how to use the new DX11 features myself. What you could do is use a compute buffer, though it would only work for textures with the same size.

But as said i might be mistaken. You could just try if it works on the shader side and then try to figure out, how to best set all the textures in the array.

Texture arrays aren’t supported in Unity right now (even if they would, they’d need a very recent GPU and using DX10/11 to actually get them - before that, you just can’t do texture arrays).

1 Like