How to have seperate image effects on different cameras without affecting the others. ie bloom

Hi, I have been trying for days to come up with a solution for having seperate image effects on seperate cameras, but am having no luck.

I want to have my UI camera have its own bloom and scanline effects, seperate from the ones used on the main camera. The problem is that they will apply to all cameras.

I have two cameras, rendering only the layers applied to them.

I have tried rendering both cameras to a render texture, merging them with a simple shader, and then using a material to blit them and apply to a quad in the scene, this doesnt work either, but I was under the impression that it should.

material script:

public class MixRenderTextures : MonoBehaviour {

    public Material effectMaterial;

    void OnRenderImage(RenderTexture source, RenderTexture destination)
    {
        Graphics.Blit(null, destination, effectMaterial);
    }
}

Shader Code:

Shader "Examples/2 Alpha Blended Textures" {
    Properties {
        _MainTex ("Base (RGB)", 2D) = "white" {}
        _BlendTex ("Alpha Blended (RGBA) ", 2D) = "white" {}
    }
    SubShader {
        Pass {
            // Apply base texture
            SetTexture [_MainTex] {
                combine texture
            }
            // Blend in the alpha texture using the lerp operator
            SetTexture [_BlendTex] {
                combine texture lerp (texture) previous
            }
        }
    }
}

This doesnt work, I still get the bloom effect applied to both cameras.

There must be a really simple way that I am overlooking as surely this is pretty common setup in game development!

Any help would be greatly appreciated.

Are both camera’s on the same game object? (Then split them to two game objects.)

Any OnRenderImage in a MonoBehaviour should only be called for camera’s on the same game object. Not for all camera’s in the scene.

I tried that no difference.

I also now tried rendering both camera’s to a render texture, placed two quads in the scene, the UI in front of the game, then added an ortho camera for the main view using the quads… this works, but now I have a problem that the new unity post processing stack doesnt have transparency in the shader, so the UI shows up white and I have no idea how to fix that.

ugh… why is this so difficult for something that must be pretty much industry standard setup…

Don’t apply effect on camera, apply them on the resulting texture much later after rendering.

Im sorry, I’m not sure what you mean, could you explain please?