Hello Guest

Author Topic: Order in layer vs. Z-ordering priority  (Read 3197 times)

Trigve

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 30
    • View Profile
Order in layer vs. Z-ordering priority
« on: December 10, 2014, 10:14:08 am »
I was just playing with the "order in layer" and z position of the sprites and want to be sure (because found out in some previous version of unity it was working differently).

The priority has the "order in layer". That is, the sprite with higher order than some other sprite is drawn at the "top", the Z-position isn't taken into account. Only if the "order in layer" are the same, the Z-position is taken into account and could fine tune the draw order.

Am I getting this right?

One more question, what is the maximum value of the "order in layer"? Is it somehow dependent on the (Z buffer)/(near-far plane position)? I found that max positive value is (2^15) - 1.

Thanks


unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Order in layer vs. Z-ordering priority
« Reply #1 on: December 12, 2014, 03:24:01 pm »
Order in layer takes precedence over z.
You've got it right, order in layer trumps the z position.

I don't know about min and max values for it though, its a unity feature and the unity docs make no mention of limits.
Renderer.sortingOrder
I'm pretty certain it has nothing to do with zbuffer values or near clip values, its just something to manually order object draw calls.