How to multiply two RenderTextres and recive RenderTexture with result?

I was thinking about Graphic.Blit but it only use one texture as input. :confused:

There is a way to render material to Render Texture? I would stuff my textures to material of this shader and render it on Render Texture.


You can pass a material to Blit. You can set all possible parameters on the material. Blit simply calls mat.SetTexture(β€œ_MainTex”, source).

So something along the lines of

Material mat = new Material(yourShader);
mat.SetTexture("InputTexture1", texture1);
mat.SetTexture("InputTexture2", texture2);
Graphics.Blit(null, renderTexture, mat); // you might have to pass a non-null value for source, haven't tried
Destroy(mat);
1 Like