Search Unity

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

Question Best way of rendering a procedural mesh, generated on the GPU, into a render texture?

Discussion in 'General Graphics' started by FissicsPeep, Nov 18, 2023.

  1. FissicsPeep

    FissicsPeep

    Joined:
    Jan 14, 2014
    Posts:
    79
    Hi,

    I'd like to generate a procedural mesh on the GPU - both the vertex and index counts will be unknown until its generated - though I can calculate a max for both if required.

    I then want to render the generated mesh into a render texture. I know I can do this via Graphics.DrawProcedural and pass in a specific camera to render into that camera's render texture. This would be one way of doing it. This may already be the most efficient way.

    Before using the GPU, I was thinking of generating the mesh on the CPU and then rendering it via a command buffer and overriding the projection etc.

    So I was wondering if I could use command buffers with GPU generated meshes? Is that possible? Is it a good idea? Are there any other options here? Or should I just stick with Graphics.DrawProcedural and specify the camera?

    Thanks!