Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Always render behind or above a particular object

Discussion in 'General Graphics' started by Catinightmare, Dec 22, 2015.

  1. Catinightmare

    Catinightmare

    Joined:
    Sep 18, 2013
    Posts:
    11
    How to easily arrange an object like a plane of glow effect to always render behind or above a particular object, e.g. a weapon?
     
  2. MV10

    MV10

    Joined:
    Nov 6, 2015
    Posts:
    1,889
    Move your objects out of the visible play area, then set up multiple cameras using the camera Depth values to control the order in which they render. For example, a -20 Depth will render before (below) a 10 Depth camera. Remember to set the Clear Flags to Depth as well. Layers and Culling are also useful here to control what each camera (and lights) can see/affect.
     
    theANMATOR2b likes this.
  3. Catinightmare

    Catinightmare

    Joined:
    Sep 18, 2013
    Posts:
    11
    Thank you for your reply^^
    Setting up different cameras with different depth works but I wonder is this the approach that normally those 3D online games do when a character is holding a magic staff with a glow effect which just always renders behind that staff? How do people manage the rendering order when they just want ONE object renders behind/above another ONE object in a 3D game?
     
  4. MV10

    MV10

    Joined:
    Nov 6, 2015
    Posts:
    1,889
    I'm no expert, and I think you could achieve a similar effect by overlaying 2D sprites or something similar, but I really think the camera approach is the easiest. Perhaps most importantly, multiple cameras lets you use 3D assets (weapons, forearm and hand, animations, etc).