# Batching

## What does and doesn't batch

To batch - something needs to be the same MeshId (including internal meshes like unions), the same Material (including internal materials like lower quality distant materials), and in the same bone batch (if relevant), and same transparency bucket (if relevant). Position, Size, Color are all freebies.

A rock with Automatic levels of detail and four LODs scattered all over the map at different sizes and colors will use 4 batches, one for each LOD mesh.

FastClusters: Meshes with skinning or rigging information that go into the fast cluster pipeline will not batch. Each one is a unique meshid

Bones: A drawcall can have about 24 bones max

Transparency: Stuff with real transparency (beams, particles, decals, texture instances, parts with transparency > 0) get sorted each frame. If they would normally batch together without being transparent and there is nothing else transparent in between them, they can batch. This is really rare in real scenes however.\
\
Particles and Beams never batch

\[...] Surface appearance with no diffuse channel does not break batching as they will still be considered the same material

\[...] Since surface appearances can batch aggressively, using them with transparent textures for things like bushes/grass us the fastest way to draw transparent objects.

\[...] Skinned Objects with less than 24 bones and the same material will batch with other skinned meshes

\[...] Texture Instances do not batch as well, especially for transparent textures. They're not quite as cursed as Decals, but can often to degrade into 1 drawcall each.&#x20;

\[...] Particle Systems do not batch, each one takes 1 draw call (even if the texture and properties are exactly the same).

***

## UI Batching

\[...] UIObjects get batched together better as siblings, limiting the depth of your trees for ScreenGuis can help reduce draw calls

***

## ViewportFrames / CanvasGroups are just Textures

ViewportFrames and CanvasGroups are effectively just Frames except they bake all their children into a giant texture that gets rendered as a single quad. As long as the children never have their contents modified in any visual way, the texture never needs to be redrawn. This lets you simplify your UI into 1 giant drawcall.

***
