I am trying to understand the logic behind Sprite Batching. It is hard for me to grasp the concept of how the “Draw Call” can just be called “Once” even if there are multiple instances of the same Sprite or Texture that are placed in a Atlas. Can someone explain to me (in a “Dumbed Down” version) what is taking place in the background to facilitate this.
Imagine you are drawing with markers, each color is 1 sprite or sprite collection batched.
Each draw call is every time you change marker.
If you have alpha and non alpha sprites you use 2 markers (2 draw calls) if you have more than X number of sprites your marker stops working and you use another marker of the same color to continue drawing. (another draw call).
If you don’t batch your sprites in the same atlas you need a marker for every single sprite, meaning that if you have 20 floors, 1 player and 9 NPC’s you will get 30 draw calls ONLY from those sprites.
Thank you for taking the time to answer my question. I have another question, how does batching handle moving objects? Also, is there a way to batch “Light Objects”?
Moving objects are exactly the same as the rest, you just render in a different place.
From the “light” I imagine you talk about “lightning” like a directional light. This can’t be batched, actually every light adds 1 extra pass to the draw calls, but not only that, every shadow that hits another object you need 1 more draw call, and every light that hits a shadow uses another draw call. Meaning that each light (in a regular 3D space) will add draw calls exponentially.