Hey all,
I’m trying to implement some basic post-processing with multiple render targets with a simple setup like this:
public class CameraPostProcessing : MonoBehaviour {
public Material postProcessingMaterial;
private Camera cam;
private RenderTexture mainTex;
private RenderTexture effectsTex;
void Start () {
mainTex = new RenderTexture(Screen.width, Screen.height, 24, RenderTextureFormat.ARGB32);
effectsTex = new RenderTexture(Screen.width, Screen.height, 0, RenderTextureFormat.
ARGBHalf
);
cam = GetComponent<Camera>();
RenderBuffer[] rb = new RenderBuffer[] {mainTex.colorBuffer, effectsTex.colorBuffer};
cam.SetTargetBuffers(rb, mainTex.depthBuffer);
postProcessingMaterial.SetTexture("_EffectsTex", effectsTex);
}
void OnRenderImage(RenderTexture src, RenderTexture dest) {
Graphics.Blit(mainTex, dest, postProcessingMaterial);
}
}
It works great except one little detail: UI is not rendered at all. I assumed it has something to do with me discarding the src in OnRenderImage, but it appears to be not the case: this texture is pure white.
I’m using Unity 5 standard UI Canvas with Render Mode “Screen Space — Overlay”.
Can’t really figure it out, any help is much appreciated!


