- Home /
How to use array in cg shader
I want to use array in my shader.
I know how to pass value:
shaderMat.SetFloat("_Sample0", 150);
In my shader, I have declared:
uniform float _Sample[2];
But when I try to access the values as _Sample[0] or _Sample[1] it doesnt work. It seems all indexes has value 0 in them no matter what I do.
Please, any ideas?
Thanks
Comment
Answer by nullgobz · Jul 31, 2015 at 09:12 PM
Well you could create a texture in code using [0,1] to represent data then passing the texture. Using it as a array storage. There really is no simple array type.