Blend render targets with post effects
Is it possible to apply post effects to just the objects rendered by the camera. It looks like the post effect is applied to the render target. But if you have an input texture applied, the post effect is applied to that as well.
My set up is.
Camera - Render Target (input device camera)
Camera Foreground objects - Render Target
+ Post effect Pixelation.
I want the pixellation to only apply to the foreground objects.
This didn't work so i tried rendering the Foreground camera to a new render target. But i'm at a lost as to how to blend that render target over the top of the Main render target.
Hi, Emile Swain!
Looks like you were doing everything correctly! But there is one tricky part. Anyway I'll include all the steps in case if someone wants to use it too:
1. Create a Camera and objects, that are rendered to this camera and you want a post effect to be applied to them.
2. Add a Post effect rendered to the same Camera
3. Create New Render Target in Resources. Assign it as a render target of a camera from 1.
4. Create new Screen Image in a Scene (New Orthographic camera will be created) Set previously created Render Target as a Texture of an image. Set Stretch Mode to Stretch. We will use this Sprite to render Output From Camera 1 with transparency over the Device Camera Texture
5. Now we can see our objects but background is not transparent. To fix this go to Render Target created in 3. and set an Opacity of a Clear color to 0. At this point you'll probably see nothing, so here is a trick: Since we have set a Clear Color to be transparent we actually need shaders to write to the alpha channel. So select a Material of an objects and set Color Mask A parameter to True
Now it should work!
You can check out example project here
Thanks, I'll try this. Will make things a lot easier.