Hi, i need to create a render texture and set it as a Tex2DArrayto a compute shader and then work on every texture in the array. How one can access a specific index of the array in Compute Shader… let’s say i would just like to apply a red color to the first texture, green to the second and blue to the third… !?
rendTex = new RenderTexture(1024, 1024, 24, RenderTextureFormat.Default, RenderTextureReadWrite.Default);
rendTex.dimension = UnityEngine.Rendering.TextureDimension.Tex2DArray;
rendTex.enableRandomWrite = true;
rendTex.Create();
rendTex.volumeDepth = 3; // NOT SURE - IS THIS THE TOTAL TEXTURE ELEMENTS IN THE ARRAY !?
shader.SetTexture(kernel, "rendTex", rendTex);
// Than in the Compute Shader there is a UAV resources:
RWTexture2D<float4> rendTex : register(u0);
[numthreads(8, 8, 1)]
void CSMain(uint3 DTid : SV_DispatchThreadID, uint3 GTid : SV_GroupThreadID)
{
// SO THE QUESTION IS HOW TO REFERENCE FOR EXAMPLE THE 2ND ELEMENT IN THE ARRAY
// WITH SPECIFIC X,Y COORDINATES...
}