Search Unity

Packing identical sheets for diffuse + normal

Discussion in '2D' started by themeshpotato, Jan 23, 2020.

  1. themeshpotato

    themeshpotato

    Joined:
    Apr 11, 2018
    Posts:
    55
    So in order for us to pack normals with Sprite Atlases we mark them as sprite and unpack them correctly in the shader, but since the shader of a SpriteRenderer only has one set of uvs the sheets generated for the diffuse textures has to be identical to the one for the normals to sample them both correctly.

    We have two Sprite Atlases; one for all diffuse textures and one for all normal textures.
    The order of them textures is the same, so I would expect them to be identically packed by Unity, but that's not the case.

    I should mention that diffuse and normals have been cropped the same and have the same max size in the import settings as well.

    So essentially I'm trying to understand if this should work if the alpha crops and texture size is the same and if yes, then I know that there probably is a small deviation somewhere in the normals we generated in our pipeline that makes them get packed differently.
     
  2. themeshpotato

    themeshpotato

    Joined:
    Apr 11, 2018
    Posts:
    55
    Found a solution. Didn't have to pack them the same way. Just had to calculate the difference in the uvs between the two sheets and use it in the shader. It works great now!