- Home /
Blur Effect on camera slice - How do I blur only only the rendered portion of a camera which clear flag is set to Depth only ?
Blur Effect blurs the entire frame and I only want to blur the portion which is rendered. How do I do that ?
this is what I want (photoshopped): http://img263.imageshack.us/img263/9816/screenshot20100424at115.jpg
but this is what I get when the blur effet of camera 2 is turned on - the whole frame is blured, not just what camera 2 is rendering http://img97.imageshack.us/i/screenshot20100424at115.png/
here is my set up
Camera rig : camera 2 is the foreground camera http://img641.imageshack.us/img641/9429/screenshot20100424at120.png http://img708.imageshack.us/i/screenshot20100424at115.png/
entire scene http://img6.imageshack.us/i/screenshot20100424at115.png/
view through camera 2 blurr off http://img72.imageshack.us/img72/8194/screenshot20100424at121.png turned on... http://img217.imageshack.us/img217/3470/screenshot20100424at122.png
Answer by sean · May 06, 2010 at 10:05 PM
Short answer is that my best guess for the process is as I put down in http://answers.unity3d.com/questions/8983/can-you-use-a-camera-effect-that-only-applies-to-a-certain-layer
Try doing it with two cameras in the same position set to render to the same part of the game window. One has a blur filter and only renders objects on one set of layers, one has no filter and only renders objects on the other layers.
If the objects on the respective layers interclip eachother... then the process goes into the realm of the hypothetical, but you may be able to use some shader wizardry to render-to-texture a mask that contains info on whether a given screen pixel contains an object tagged for one layer or another.
Based on your description, you seem to be doing something similar... I'd double-check that the foreground camera is set to not render your background objects and vice-versa. If all else fails, you may need to do something hack-ish like render each camera independently to a texture in real time and layer those textures as GUI elements :P
So with two intersecting cubes on different layers, one camera rendering only one layer and set to Do Not Clear, the two cubes intersect
But as soon as I add the dof on the skybox/ rest of the scene camera, they no longer intersect.
So it seems the dof shader overwrites the camera's depth ... and I logged bug #397887
This is a realm where what you're trying to do may go against some fundamental hacks/assumptions in the graphics pipeline; I'm not sure. The skybox is going to be treated somewhat specially, since it isn't supposed to have a position per se, just to render "behind" everything regardless, and to do this, it may need to use certain buffer bits in unusual ways. Also, any blur effect is going to be strictly 2D postprocessing, and may assume a final screen render target and thus play fast-and-loose with setting e.g. depth bits as there is no way for them to be relevant.
Your answer
Follow this Question
Related Questions
Simulate Shutter Speed 1 Answer
Blur the alpha part of a shader 1 Answer
need help with javascript for underwater blur effect 1 Answer
OnRenderImage with 16 bit framebuffer 0 Answers