Using Sorting Layer/Sorting of MeshRenderers.

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!

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.

1 Like

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!..