- Home /
Question by
Riderfan · Feb 07, 2018 at 09:07 PM ·
shader programminginstancing
Texture Atlas in Vert Shader
Hello.
I'm trying to build a vert shader that supports accessing a tile in a texture atlas via that shaders instanceID
I have a texture atlas that is 1024 * 1024, there are 64 tiles in a 128*128 tile grid. I'm trying to figure out how to get my Shader's instanceID to move the UV's of that mesh instance to a tile.
instanceID 1 = Tile 1 instanceID 2 = Tile 2 ... instanceID 64 = Tile 64 instanceID 100456 = (whatever that happens to wrap around to)
Hopefully that makes more sense. NOTE, this must be done inside a shader for performance. Please don't recommend C# code to access the shader's UV, it won't work.
thanks
Comment
Your answer
