- Home /
Render parts of a scene semi-transparent
I have a situation where I want to be able to render parts of my scene as semi-transparent. More specifically I want the player character to be rendered as semi-transparent if certain objects gets too close.
I've tried achieving this by having one camera only rendering the player character and one camera for everything else. The problem is that (to my knowledge) it is not possible to change the transparency of a camera. Then I tried rendering to a RenderTexture on the camera rendering the player character, using Depth Only as clear flags and then render this texture to the main camera, using GUI.DrawTexture. The problem here is that every "empty" pixel from the player character cam will simply be black on the render texture and thus overwrite everything on the main camera. Furthermore, I don't see how I can change the transparency of a RenderTexture, to achieve the effect I want.
Does anyone have a solution for this? I don't want to change the texture of the player character to become more or less transparent, since that gives weird results (looks like you are looking into the character), so I'm really hoping it can be solved with cameras somehow.
Answer by SilverTabby · Jul 19, 2011 at 04:35 PM
Inside the 3D Platform Tutorial, there is a script called "FadeoutLineOfSight" inside assets/scripts/camera scripts. The script causes the renderers of all objects between the camera and the camera's target to become transparent. You can use, modify, and look through it for ideas to get the effect you are looking for.
Hope this helped
Your answer
Follow this Question
Related Questions
DrawProcedural() in OnPostRender() drawing over transparent objects 1 Answer
What is rendered when no camera is in the scene? 1 Answer
Multiple post processing profiles? 2 Answers
Camera layering with post processing? 0 Answers
Green Creep? Any idea what might be causing this visual glitch? 0 Answers