- Home /
Shader output to a texture
I'm using a shader which has a base texture and a stencil which masks the base texture. I would like to draw the "result" of this masking to another texture where I want to be able to draw multiple times.
How am I supposed to do it? Is there a way to write the output to a third texture in the same shader so that I can access it's data through getPixels32()?
I read the documentation and googled for a way to use it from a shader but couldn't find an answer. Would you have an example?
Answer by SantosR · Mar 25, 2014 at 08:47 PM
This solved my problem:
https://docs.unity3d.com/Documentation/ScriptReference/Graphics.Blit.html
Just need to pass in a material using the shader, so it will be taken into account when drawing to the destination texture.
Thanks,