I want to pass the first texture through a shader and render it to a second texture.

The actual task is bit more complicated, as I then want to render the second texture back to the first texture also using a shader.

I have a terrible solution at the moment involving two cameras, two quads and two materials and two rendertextures. The output of Cam1 is rendered to Texture1 used in Material1 applied to Quad1. Quad1 is in the view of Cam2 rendered to Texture2 used by Material2 applied to Quad2. Quad2 is of course in the view of Cam1. I then have to alternate turning on and off the Cameras and the Quads. It works, but the solution is terribly complicated.

Please tell me there is a better solution. With WebGL I could do this simply by swapping source and target for the shader. I'm sure this can be done in Unity too, but I have no clue what to look for.

  • \$\begingroup\$ Your solution sounds pretty good actually. Have you looked into Graphics.Blit if you want to do this without the cameras? \$\endgroup\$
    – DMGregory
    Commented Apr 26, 2020 at 11:48
  • \$\begingroup\$ Ah that looks interesting. Sounds like I can just pass in the two textures and use the material as the shader, thanks a lot! Will give it a go. \$\endgroup\$
    – marcgfx
    Commented Apr 26, 2020 at 12:03
  • \$\begingroup\$ If you find a solution to your problem, please share your working code as an Answer below so it can help others too. :) \$\endgroup\$
    – DMGregory
    Commented Apr 26, 2020 at 12:04

1 Answer 1


Turns out it's simple, if you get great advice from DMGregory.

Graphics.Blit(sourceRenderTexture, targetRenderTexture, unlitMaterial, -1);

is the answer. I'm using an Unlit Material with Shader and that's it. If you need to set a sprite to your rendertexture, this also works with Blit

Graphics.Blit(sprite.texture, renderTexture);

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .