Can't use Sprite Atlas Texture and some UV effects



  • Hi,

    I have described the issue here : https://forum.vetasoft.store/topic/177/can-i-use-sprites-coming-from-atlas-like-texturepacker

    Sprites Atlas is a necessary practice to use Draw Batches and get really better performances. An Atlas is a texture with a lot of sprites
    A Sprite Component uses a texture and a rect corresponding to the position of the sprite in the texture

    Actually Shadero uses the center of the texture for UV operation

    Why not add a new Shadero Item : Sprite Rect UV. A Mask for this same rect should be necessary to avoid to see some neighbors sprites : Sprite Rect Mask
    With this 2 Shadero items, Atlas could be used

    Create a 2D games without Sprite Atlas is a big mistake for performance
    Actually I can't use a lot of effects, like I use Atlas for all sprites



  • Also, Destroyer or Burn effects don't work fine, like there applied for the complete texture. The applied effect on a sprite on the Atlas is really ugly
    More is large the Atlas, like 2048x2048, and smaller the sprite, and worse is the visual result



  • There is a thread about it here:

    https://forum.vetasoft.store/topic/60/mecanim-sprite-sheet-animation-uv

    As we say in this thread, the big problem with Texture Atlas is that Unity doesn't allow to specify the good UV coordonate within the shader.

    Texture Atlas and Shader aren't real good friend because in the fondation, Shader was mainly design to work for the whole texture.

    However, you can work properly with texture atlas and bypass the limitation of the unity shader. We detail how to do that on the previous link.

    Hope it's help
    Best Regards,
    Vetasoft



  • I use Texture Atlas to regroup my sprites on one texture, but it's not a animation spreed sheet, I don't have sprites animations. Texture Atlas is generated differently each time I add a new sprite, to optimise and minimize texture size, and so the memory usage at runtime, and to use draw batches.
    Animation spreed sheet have the particularity to be "sorted" by frame order. Not a "classic" Atlas Storage
    I have only one big optimized texture 2048*2048 with my sprites disordered

    After some searches, it is possible to filter the pixels in the shaders, by passing sprites coordinates by code, but the shaders code should be changed to receive coordinates. Not convenient
    So I choose to create a texture copy by code for a sprite rect when shader is needed, add it in a cache for reuse. It adds a little more memory of course, but it works well with a generated atlas

    I will add a request for evolution to Unity

    Thanks


 

Looks like your connection to Vetasoft Assets was lost, please wait while we try to reconnect.