Search Unity

Make Inset Camera Transparent

Discussion in 'Editor & General Support' started by marty, Apr 10, 2007.

  1. marty

    marty

    Joined:
    Apr 27, 2005
    Posts:
    1,170
    How exactly do I make an inset camera (i.e. a second scene camera with its viewport rectangle and depth set so it appears on top of the main camera, like a HUD element) have a transparent background?
     
  2. Aras

    Aras

    Unity Technologies

    Joined:
    Nov 7, 2005
    Posts:
    4,770
    Set it's Clear Flags to Depth Only or Don't Clear, depending on what you need (docs)
     
  3. marty

    marty

    Joined:
    Apr 27, 2005
    Posts:
    1,170
    There are two problems with that ...

    First, with those settings, I get no background color in the inset camera. I want to have the background color set for the camera showing, only transparently. The alpha setting in the System UI color dialog doesn't seem to work for Unity camera backgrounds.

    Also, if I use a imaging effects such as Glow or Color Ceorrection in Depth Only or Don't clear modes, transparency does not work at all. The entire inset camera rectangle is filled colored.
     
  4. Aras

    Aras

    Unity Technologies

    Joined:
    Nov 7, 2005
    Posts:
    4,770
    If you want to do a "transparent clear", about the only way to do that directly is to use no clearing, and drawing a partly transparent plane that covers that camera and is behind any objects.

    Or render everything that camera would render into a Render Texture, using regular clear flags (and tweaking opacity of clear color), and then draw something with that Render Texture on screen.