Bliting to framebuffer doesn't work?

Hi everyone,
i am new to image effects. I want to apply an image effect to my game in android. Therefore i can not use OnRenderImage() ( see here ). Instead i used this:

[ExecuteInEditMode]
public class PostProcess : MonoBehaviour
{
    public Material blitMaterial;

    [SerializeField] Camera cam;

    RenderTexture myRenderTexture;
    void OnPreRender()
    {
        myRenderTexture = RenderTexture.GetTemporary(Screen.width, Screen.height, 16);
        cam.targetTexture = myRenderTexture;
    }
    void OnPostRender()
    {
        cam.targetTexture = null;
        Graphics.Blit(myRenderTexture, null as RenderTexture, blitMaterial);
        RenderTexture.ReleaseTemporary(myRenderTexture);
    }
}

The blitMaterial simply returns a green color for test purpose. However after applying everything nothing changes. The whole game still looks like it was before. The assigned camera in the inspector is correct. I also tried to blit it to a raw image and it worked but for the framebuffer it doesn’t. So it looks like it has something to do with Graphics.Blit(). I also tried without HDR and MSAA.
I realy don’t know what else might be the problem :frowning: Therefore i want to ask you for help…

Thank you so much!

Ups, I didn’t set my camera to Main.Camera. Therefore graphics.blit didn’t blit to the view. Also i had to turn of MSAA. OnRenderImage() causes a black screen on some devices so i rather not use it. It was fixed with OnPreRender and OnPostRender.

For that android build I had to put the shader under Assets/Resources to make sure it is added to the build. I think i could also add the shader to “Project Settings → Graphics → Always include shader”.

I attached the final Outline post effect (working on android). I used the command buffer explained similar to this blog…

I’m very glad it works now!

4558660–423508–Outline.unitypackage (1.45 MB)