Hello all. In my App i need to selectively affect colors of objects in the scene. Those objects have different materials, so my first solution was to add a new camera rendering only those ones with a culling mask. The main camera rendering the whole scene with the default culling mask, including a colored transparent plane affecting the whole screen Code (csharp): Main Objects Focused Object (default Layer) (Layer "Focused") | | | | Rendered in Rendered in the Main camera Focus obj Cam Depth order : -1 Depth order : 1 (after) Clear flag: skybox Clear flag : Don't clear Everything worked perfectly until I need some post effect in the main camera. When I add any Post Effect on the main camera (wanted a blur effect and a color correction), Some weir artefacts appears on all focused object. Code (csharp): Main Objects Focused Object (default Layer) (Layer "Focused") | | | | Rendered in Rendered in the Main camera Focus obj Cam Depth order : -1 Depth order : 1 (after) Clear flag: skybox Clear flag : Don't clear + Post Effect (color correction) It appears that the does Z fighting with themselves. I think that the posteffect does not clear the Z Buffer at all. when the camera move, the z fight is huge and object disappears more and more. z buffer is written only by the second camera but never cleared. I Need my first camera to writte a good, cleared, z buffer but I don't know how to modify the post effect to do it. If anyone has an idea.... thanks a lot
I've found a workaround by adding an empty camera. Culling mask set to nothing and a big depth order ) On this camera with a greater I've added my special effects. But it does not work with effects using Z buffer. for my global color correction it works great. Anyway my previous question is still unanswered.
As I understand it, you want the first camera or the post FX to clear the depth buffer? Which you won't be able to do, I don't think. However, you can tell the second camera to clear it before it renders using the clear flags.