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. Dismiss Notice

Question Display Mesh 1 always over Mesh 2

Discussion in 'Scripting' started by SuperFranTV, Sep 9, 2023.

  1. SuperFranTV

    SuperFranTV

    Joined:
    Oct 18, 2015
    Posts:
    140
    Hi,

    I'm currently stuck with an optics problem. I have a character consisting of several quads, these rotate depending on the direction of movement, now a specific mesh should always be displayed over another specific mesh, how can this be adjusted? Layer masks would also show this mesh over other objects, I don't want that.

    Like a mesh order only inside the childs of a parent.
    Or like the Sprite render-layers + ordernumber system.

    I would be happy if someone had a good tip.
     
  2. davidnibi

    davidnibi

    Joined:
    Dec 19, 2012
    Posts:
    424
    You can arrange order according to render/camera, I'm installing a new version of Unity so can't check now, but I think it is layer based.
     
  3. angrypenguin

    angrypenguin

    Joined:
    Dec 29, 2011
    Posts:
    15,509
    Check out the stencil buffer.

    Have the first object draw a value to the stencil buffer. Have the second object in a later render queue, and only draw where that value is set in the stencil buffer.