0
\$\begingroup\$

I'm hoping to learn what my options are for sharing the outputs of simple unlit shaders with compute shaders that will operate on the data.

Is my only course of action to use a render texture with the unlit shader, and Graphics.Blit to render the shader to a texture2D that can be set on the Compute Shader? I was hoping something like a ComputeBuffer or GraphicsBuffer might be made accessible and writable in the unlit shader and then could just be used in the Compute shader also.

\$\endgroup\$
3
  • \$\begingroup\$ Can you not pass the RenderTexture directly to the Compute shader,? They can be used in most places that a Texture2D can, without a separate blitting step. (The exception being CPU read-back) \$\endgroup\$
    – DMGregory
    Jul 5, 2021 at 10:04
  • \$\begingroup\$ @DMGregory, good to know that I don't need a second blitting step to go RenderTexture->Texture2D for compute input. If passing the result via texture is my best bet then I'll rest in that confidence. I think I've just seen so many different buffer types in the scripting api that I wondered whether one of them would help with this task as an alternative. \$\endgroup\$
    – Li Brary
    Jul 5, 2021 at 17:38
  • \$\begingroup\$ You might get better answers if you can describe what specific output you want to carry across, and why you're concerned a RenderTexture might be ill-suited for that task, or what aspect you hope to improve upon. \$\endgroup\$
    – DMGregory
    Jul 5, 2021 at 17:54

0

You must log in to answer this question.

Browse other questions tagged .