I'm trying to fake a DOF effect for Sprites by using 2 cameras, one for the sharp objects, one for the blurred ones. I have set up the layers like Blur and Sharp accordingly.
So I have these 2 cameras, and I use Unity's Blur (optimized) script to blur things, and I have this script on only one camera, the one that is responsible for the blurred render.
I have the cameras like:
- Clear flags: Don't clear (this is the main, sharp cam)
- Culling mask: sharp layer
- has no blur effect (or any other post proc effect).
- Clear flags: don't clear (this is the blur cam)
- culling mask: blur
- Has Blur (optimized).
Now, if this blur cam is on the back, meaning its depth is LESS than the main cam's depth, I have a sharp player ground and a blurry background. However, I need a blurry foreground too that should be on top of the player ground.
The issue starts when I set the blur camera's depth higher than the main cam's. In this case, everything gets blurred, no matter that the main cam has no blur effect on it.
Question is, how to set this up so only the desired layers get the blur?