Hellooo, I'm working on post-processing effect to draw outlines around objects. It already works but I'd like to optimize the amount of Blit() calls. My problem: Blitting from source to source won't work. So you have to first blit to a temporary rendertexture... Code (CSharp): commandBuffer.Blit(BuiltinRenderTextureType.CameraTarget, tmpRenderTexture); commandBuffer.SetGlobalTexture("_OutlineTex", outlineTexture); commandBuffer.Blit(tmpRenderTexture, BuiltinRenderTextureType.CameraTarget, overlayMaterial); Is there a more elegant / more performant way to do this? Is there no way to avoid two Blit() calls? I'm also thinking about drawing the outline texture on a UI.RawImage to avoid both of those Blits. Hm.
Alright. I'm using OnRenderImage() now to do the final Blit() showing the result. Not sure if this really saves performance but... it's one less Blit() in code. Code (CSharp): private void OnRenderImage(RenderTexture source, RenderTexture destination) { Shader.SetGlobalTexture("_OutlineTex", outlineTexture); Graphics.Blit(source, destination, overlayMaterial); }