- Home /
Blur only specific objects
Hey All,
I have looked through the forum and the unityAnswers for my problem. But i just can't find anything like it. I hope you guyz could help me out. Here's my situation. I'm making a first person horror/survival game. I have 1 enemy that looks like a foggy shadow. I'm trying to give this specific model a blur-effect. I tried to use 2 camera's, and give one a blur-effect. I made a second camera that is a child of the maincam, and i called it "ghostcamera", and i gave that camera an image-effect (blur). I made a second layer called "ghost". And i made a cube (for testing) and gave the cube the layer "ghost". Now the ghostcamera is a child of the maincamera.
The Depth of the ghostcam is 0, and the depth of the maincamera is 1. I don't see the cube ingame. Because only the ghostcam can see it. But if i change the depth's of the ghostcam, i can ONLY see the cube. I was hoping i could get to see a mix of both camera's. And with the blur effect only on the cube. But i guess that doesn't work like i thought. Is there anything else i could try? Or am i doing something stupid or wrong? Or maybe both?
Before i gues questions about scripting, i have zero scripting experience. But i have somebody who can help me with that. I was just thought this effect wouldn't need any scripting. If you need more information please let me know ! :)
Hey @Cyriel_$$anonymous$$ , I'm running into the same problem and got to the same point as you : the motion blur shader takes effect on all objects... Have you found a solution to this ? :)
Answer by svenskefan · Sep 17, 2012 at 08:52 AM
Hi! You need to set the clearflags on the topmost camera to depth only. This way the top camera will draw its contents on top of whats already drawn by the other camera
Hey Thanks allot !! For the cube, that did work ! But the blur effect just goes on everything. Is there a way to put the blur-effect only on the cube ?
Answer by Cyriel_M · May 14, 2017 at 07:11 PM
@martinnnnnn Hello, Sorry for my late reply. In the end I didn't find a good solution. I wanted to use this effect to create ghostly figures. And since they only show up once in a while and from a distance. We eventueally used 2d sprites. From a distance you don't see its a 2d object. And with afterFX or photoshop, you can make it look blurry and vague. For us, this effect was what we needed. But on a real 3d object we never succed this..
Here's a rough example of the effect we made. I have some fluently moving versions. But we never recorded those.. https://youtu.be/9t0CYgY5zjU?t=759
I hope this helps, and if not. I hope you find a solution :) I doubt I can do a lot for you, but If I can help with something, please let me know.
I find a solution : what you can do is have the camera with the blur shader render to a RenderTexture (I did it via script, in the "OnRenderImage" of the script attached to the camera), then use this RenderTexture in a shader used in the OnRenderImage of the main camera. You can then mix both images in this shader. I hope this is clear enough ! If someone is ever interested don't hesitate to contact me, I can send the actual code that might make it clearer. Thank you for your help @Cyriel_$$anonymous$$ , your ghost looks really cool ! it's good to know you can get away with just 2d sprites in some senarios :)
Your answer
![](https://koobas.hobune.stream/wayback/20220613081128im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Zoom camera based on position between player an object 2 Answers
With multiples cameras, How to change what is rendered without using layers? 2 Answers
Camera Orbiting Character: How to make an object move with another with no rotation 1 Answer
Make object follow mouse, while actually moving camera, instead of object 2 Answers
Attaching an object to a camera movement weird, Help! 2 Answers