Transparency Sort Custom Axis Meaning

Hello,

I have my ‘Transparency Sort Mode’ set to ‘Custom Axis’ with X:0, Y:0.1, Z:1
This may be a stupid question but there is nothing in the documentation or from searching that I could find on how these values actually work / interact with one another. Can someone please shed some light onto this?

The above seems to work in my case where I still want z-depth ordering for the camera, but also order sprites via their Y-axis, I just want to make sure I understand how these numbers work so I don’t screw something up in the project long term and have to re-think sorting… especially since putting the ‘Y’ value any higher ends up making sprites not visible.

Any insight here would be greatly appreciated.

Yeah, there’s not a lot about Custom Sort Axis in the manual…

Custom Axis sort modeIsometric Tilemaps to sort and render the Tile Sprites correctly on the Tilemap. Refer to Creating an Isometric Tilemap for further information.

Source: Unity - Manual: 2D Sorting

This blog might help shed some more light on its usage.

https://bigcheeseapp.com/2018/12/23/transparency-sort-axis-for-2d-top-down-games/

I know this thread is 6 months old, but I was looking for the answer to this exact question and still cannot find anything. Sure, there’s “a lot” about custom sort axis in the manual and various blogs and forums, at least in terms of how/when to use it - but I’ve found no explanation of what the actual numbers mean.

I’ve been trying to make a 2D game “act 3D” (a game like CrossCode, for example), where entities can be at different “heights” - go up ramps, jump off cliffs, sort behind upper floors and above lower ones, drop through “holes” in the floor, etc. Sorting all this is really tricky. (Also, fwiw, doing this tool-agnostically, using only renderers, transforms and colliders - not relying on Grids/TileMaps or SpriteShapes, though those are fine ways to generate those colliders and renderers).

I’ve managed to get it working by representing heights with different Z values and relying on a custom sort axis of BOTH Y and Z to sort them properly. But I have no idea WHY my custom sort axis of (0, 1, 4) works. Anything lower than 4 on the Z makes elements sort incorrectly.

Like the OP, I’d love more details about what the custom sort axis is really doing.

you are creating an average point between 1y and 4z where sprites are sorted, with a (0,1,4) sorting you give 4x more priority to sorting by z than by sorting by y

Aha that is exactly what I was looking for, thank you rarac! So the numbers themselves are arbitrary and just relative to each other? So would 0.1 and 0.4, or 10 and 40, behave exactly the same?

yes, you have the correct idea