Hello Guest

Author Topic: Problem with blending of multiple images (Tilemap with two layers and Sprite)  (Read 3461 times)

prokopst

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 5
    • View Profile
As unikronsoftware suggested in "Tilemap draw order by y-axis" I "created" my own shader (it is basically "copy & paste and adapt" job with default shader to use alpha testing). Now I have different issue, images are not blended correctly. Ground part (z=0 + y offset) is blended into box with goods (z=-1 + y offset[1]) and then this one is blended with character (z=-1 + y offset[2]). I expect this is feature of pivot and shader thingy sorting in unity.

GIF for better illustration, notice character's legs during movement in north west (top left) direction:

(link to the image)

I'll try to limit partition size to 1 as described in the topic mentioned above (BTW actually the lowest possible value is 4 even if I specify 1, so I need to remove this limitation), but I guess it will hurt performance...

Does anyone have any idea to solve this issue without partitioning by y coordinate (i.e. by rows)?

[1] z offset is set to 1 for this layer in Tilemap settings, so I assume it's z=-1
[2] z coordinate is changing for character with some script component:
Code: [Select]
z = 0.01 * y - 1;
« Last Edit: October 08, 2014, 01:44:22 pm by prokopst »

prokopst

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 5
    • View Profile
I found quite easily how to remove partitioning limitation in tk2dTileMapEditor.cs:620
Code: (tk2dTileMapEditor.cs:620) [Select]
partitionSizeY = Mathf.Clamp(EditorGUILayout.IntField("PartitionSizeY", partitionSizeY), 4, 32);
and as expected the problem is gone with PartitionSizeY=1.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Partition size = 1 will work but it is inefficient for large tilemaps. By all means use it if it works for you :)