Search Unity

Something about Sprite Atlas

Discussion in 'General Graphics' started by wechat_os_Qy0-LhlHjbAD5SS_WAdGrTe84, Aug 22, 2019.

  1. wechat_os_Qy0-LhlHjbAD5SS_WAdGrTe84

    wechat_os_Qy0-LhlHjbAD5SS_WAdGrTe84

    Joined:
    Jul 2, 2018
    Posts:
    6
    Hi.I just read “Unity normally issues a draw call for each Texture in the Scene” “A Sprite Atlas is an Asset that consolidates several Textures into a single combined Texture. Unity can call this single Texture to issue a single draw call instead of multiple draw calls to access the packed Textures”in the document about sprite atlas and I don’t understand why. From what I know, a draw command is called, when the game entity is prepared(Its mesh data get to the vbo, it’s texture get bind)and the rendering pineline begins. So how is that textures get packed in one sprite atlas will reduce any draw call?(Shouldn’t the game entities related to these textures still get draw one by one?Therefore emm... still lots of draw calls). Hopefully you can understand what I’m saying. Sorry for my poor English and thanks in advance.
     
  2. Sluggy

    Sluggy

    Joined:
    Nov 27, 2012
    Posts:
    984
    As far as I know, sprite atlases only reduce draw calls for sprite renderers. So they should't really have any effect on batching of any other type of geometry being rendered.

    In the case of sprites however, the render pipeline will attempt to combine any sprites being rendered. In order for sprites to be able to be batched together they must at the very least use the same render material, which also implies that their texture and shaders must be the same, hence the reason the Sprite Atlas exists - so that you can easily combine multiple sprite image assets into a single texture.
     
  3. wechat_os_Qy0-LhlHjbAD5SS_WAdGrTe84

    wechat_os_Qy0-LhlHjbAD5SS_WAdGrTe84

    Joined:
    Jul 2, 2018
    Posts:
    6
    Thanks for your reply. Does that mean the sprites that’s been batched will push theirs individual mesh data into one vbo, and when the draw command is called, referencing the combined texture with their texture coordinates right? If this’s true, then it would make sense to me
     
  4. Sluggy

    Sluggy

    Joined:
    Nov 27, 2012
    Posts:
    984
    Exactly what it means. :)
     
  5. wechat_os_Qy0-LhlHjbAD5SS_WAdGrTe84

    wechat_os_Qy0-LhlHjbAD5SS_WAdGrTe84

    Joined:
    Jul 2, 2018
    Posts:
    6
    Got it. Thanks a lot