RenderTexture looks like crap with Unity UI?

So I’m using Unity 5.2, and trying to render a full scene with post processing to a Render Texture and display it. For whatever reason, any UI element that gets rendered on my RenderTexture is rendered in some sort of partial transparency and is barely visible in the resulting texture (you can even see through it leaking the skybox behind it).

This is my basic function below for rendering the scene (also my UI is in worldspace, using the same camera as the rest of the game):

    private IEnumerator Capture(bool blur, bool ui, Action callback)
    {
        yield return new WaitForEndOfFrame();
   
        var originalMask = Camera.cullingMask;

        RenderTexture prev = Camera.targetTexture;

        if(blur){
            ToggleBlur(true);
        }
        if(!ui){
            Camera.cullingMask = ~(1 << LayerMask.NameToLayer("UI"));
        }
        else{
            Camera.cullingMask = ~(1 << LayerMask.NameToLayer("Popup"));
        }

        Camera.targetTexture = RenderTexture;
        Camera.Render();
        Camera.targetTexture = prev;

        ToggleBlur(false);
        Camera.cullingMask = originalMask;

        //Split the process up
        if(callback != null)
            callback.Invoke();
        yield return 0;
    }

IMAGE:

After Render To Texture:

Nevermind…found out it was really happening when I put the Render Texture as an image in the UI to display it…apparently the default shader doesn’t work for this. I created a new material and things display right now.

1 Like