- Home /
How would you index a texture in a compute shader to matched UV coordinates
If you have a compute shader with 16 by 16 by 1 threads, run 32 by 32 by 1 times, for a texture size 512 * 512, how would you index that in a way that would match the UV coordinates of a texture.
This would be the indexed texel of the texture:
e.g. float2 texelID = dispatchThreadID.xy
uv coordinates would come from a vertex buffer created for a compute shader:
float2 uv = inputBuffer[index].UV
Put the texelID into the UV coordinate space (scale at least)
texelID /= 512
Question is: is there any coordinate inversions I need to do to ensure I am mapping the texel into the UV coordinates correctly?
Your answer
Follow this Question
Related Questions
How can I convert the texture coordinates of the multi-spite to 0-1? 0 Answers
Compute Shader Outputting Black 0 Answers
getting texture from shader into c# script. Also: best way to get values from GPU to CPU? 0 Answers
Alpha Problems With Render Textures 0 Answers
Make a texture flicker c# 2 Answers