- Home /
Can I blur only part of the objects on my scene?
Hi, I know this question asked a few times but i cant get it working. I have two sets of objects, blurry and everything else.( blurry are on layer BLUR)
I created two cameras. first camera is for blurry objects. Clear Flags: depth only Culling mask : BLUR Depth: 1.5
Second is for everything else Clear Flags:Skybox Culling mask: all exept blur Depth:1
The Blur effect is happening to all objects,
All other parameters are default and same for both cameras.
any ideas?
What do you see if you turn off one and then the other of the cameras?
if i turn off the blurry camera i see the scene not blured and ofcourse without the object to be blured, if i turn off only the not bblured camera i see empty scene and the blured object
Answer by PAEvenson · Jan 08, 2013 at 08:03 PM
I remember trying to do something like this before. Since the Blur is a postprocess all cameras rendering with a depth behind the BLUR camera(< BlurCamera.depth) will render blurred. A solution I found was created Blur textures for all the items I want blurred and swapped them in when I needed them. You can test this by creating another layer and camera and rendering it with a depth of 2. Those items shouldnt be blurred. This was my understanding...I could be wrong.
so are you telling me the only solution is to create a texture that is looking blured and swap it with the normal one?
This is outside my area of expertise, but there are events that Unity calls before and after rendering (e.g. http://docs.unity3d.com/Documentation/ScriptReference/$$anonymous$$onoBehaviour.OnPreRender.html).
If, as @PAEvenson says, post effects that you add to a camera appear to occur for all cameras, can you use the pre-render event to turn off the blur postprocess before rendering with the second camera?
Thats how I solved the problem....swapping textures. I, however, was blurring GUIText font. Not sure if it'll fit for your solution.
I haven't tried what @Julien.Lynge says, but I believe, the postprocess happens during the pixel shader stage of the shader pipeline. So at this point you are only dealing with the pixels about to get shown to the screen. Hence, why it blurs all the other cameras behind it. Another camera could be drawn on top, and not have the blur effect(set the camera.depth > blurCamera.depth)