Search Unity

  1. Unity 2018.3 is now released.
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. We've updated our Terms of Service. Please read our blog post from Unity CTO and Co-Founder Joachim Ante here
    Dismiss Notice
  4. Want to provide direct feedback to the Unity team? Join the Unity Advisory Panel.
    Dismiss Notice
  5. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice

Think i found z sorting solution in chunk mode

Discussion in '2D Experimental Preview' started by o1o1o1o1o2, Dec 27, 2018.

  1. o1o1o1o1o2

    o1o1o1o1o2

    Joined:
    May 22, 2014
    Posts:
    7
    But it is a bit tricky. First of all you need to take Sprites-Default shader here https://github.com/nubick/unity-uti...Assets/Scripts/Shaders/Sprites-Default.shader and make new sprites-default-zwrite where you change ZWrite from Off to On. Now we have pure proper z ordering in chunk mode, but loose automatic Y-sorting. Because of that, to have correct sorting of tiles based on its height (position above plane if it were in 3d), we need to set each tile using pure z ordering: x = x + heigh, y = y + height, z = x + y - height. Then to get tile height first you need to have collider for each tile wich position based not only on x and y but on z too. Then height = (x+y-z)/3 . I not already test it much, but even if formula not correct it is possible to make it correct(?), try it yourself, maybe i am wrong, invented an hour ago but wanna share to maybe recieve some help in it. This solution is good cause chunk mode is much more performant than individual.

    p.s Also chunk mode work strange, so if you have artefacts try to make several tilemaps that will store less tiles 16x16 or 8x8. Or try to set custom outline on sprites
     

    Attached Files:

    Last edited: Dec 28, 2018
    Sylmerria likes this.
  2. o1o1o1o1o2

    o1o1o1o1o2

    Joined:
    May 22, 2014
    Posts:
    7
    Looks like it works!!!! huawei p10 60 fps (maximum pissible), in a chunk mode vs ~25 individual, video can not show, but everithing is very smooth, this tilemap made of chunks16*64*16 (data in 3d) and 16*16 (in iso) and with them i generate 3d mesh collider chunks to have oportunity get height of a tiles.

     
    Last edited: Dec 29, 2018