Ok, so I have an InstancedBufferGeometry using a plane geometry as the geometry to be instanced and I am instantiating it 256 times in different positions. I am also applying a 256x256 image texture as the material map which is succesfully being applied to all the instances.
However, what I would actually like to do is have only different sections of the texture being applied to each instance rather than the standard 0,0 - 1,1 uv map being applied to all instances.
At the moment, I have tried passing in a vector4 per instance defining the desired top left and bottom right uv-co-ordinates per instance, then in the shader I check if the uv parameters are either 0 or 1 and change them accordingly to the equivalents that i put into the vector4. But this doesn’t seem to work very well.
Any idea as to how I could do this better?
Your help would be appreciated.