Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question Use custom/multiple render targets with Graphics.RenderMeshIndirect

Discussion in 'General Graphics' started by Lusorio, Nov 22, 2023.

  1. Lusorio


    Sep 17, 2023
    I would like to render the results of an invocation of RenderMeshIndirect, into two RenderTextures. My current simplified approach looks something like this:

    Code (CSharp):
    1. RenderTexture colorTexture = new RenderTexture(w,h,24,...);
    2. RenderTexture normalTexture = new RenderTexture(w,h,24,...);
    3. RenderBuffer[] renderBuffer = new RenderBuffer[] {colorTexture.colorBuffer, normalTexture.colorBuffer};
    5. Graphics.SetRenderTarget(renderBuffer, colorTexture.depthBuffer);
    6. Graphics.RenderMeshIndirect(renderParams, commandBuf, commandCount);
    However the RenderTextures are not being used with this approach. Any help on where I am going wrong would be appreciated