Search Unity

Using Sorting Layer/Sorting of MeshRenderers.

Discussion in 'General Graphics' started by jagttt, Apr 6, 2015.

  1. jagttt

    jagttt

    Joined:
    Nov 2, 2012
    Posts:
    10
    Hi. I'm currently working on a scene full of transparent 3D meshes and the render order is wrong some times. I figured duplicate shaders and set render queue can work, but later I found that setting sort order/sorting layer on MeshRenderer can do exactly the same thing (controlling object render order).

    My question is that is using sorting order/sorting layer the correct way to do this? Seems it's barely used outside of 2D and MeshRenderer don't expose them, and there's few documentation about using it ouside of SpriteRenderer. I suspect there's some huge performance hit or something. Anyone can give some clue on this?

    Thanks in advance!
     
  2. raja-bala

    raja-bala

    Joined:
    Jul 11, 2012
    Posts:
    29
    Setting the render queue only guarantees relative draw ordering among the various queues. Within a queue, you're still subject to Unity's optimized ordering (based on projected size, distance, lod, overdraw,etc)
    If you have several meshes that need to be rendered in a particular order, using a different queue for each of them might not be the right way to do it.

    I faced a similar issue recently -- Graphics.DrawMeshNow is what you're looking for.
    Check out this q&a.
     
    theANMATOR2b likes this.
  3. Kumar89

    Kumar89

    Joined:
    Oct 30, 2015
    Posts:
    1
    Hi I m new this unity 3d . i use GAF Plugin for animation How to control GAF animation propertes. for example : how to change sorting layer and sorting layer order plz help me!..