User Manual


Batching is the process of combining multiple mesh instances together into a single mesh instance, so that they can all be rendered in a single GPU draw call. PlayCanvas provides a handy feature on the Model, Sprite and Element components that lets you assign these components to batch groups which give the engine hints on how to combine meshes to reduce the overall draw call count.



The use of batching is currently not compatible with runtime lightmaps due to each lightmapped object requiring its own unique lightmap texture.


Creating Batch Groups

バッチグループはシーン設定パネルのバッチグループセクションから作成できます。 各バッチグループには多くのプロパティがあり、これらのプロパティはこのバッチグループからバッチを作成する方法についてのヒントをエンジンに示すために使用されます。



Selecting Batch Groups





Trigger re-batching

Based on Batch Groups the engine creates an optimized version of mesh instances. Further changes to many properties of the original mesh instances are not reflected in the optimized versions. To allow for good performance by using batching, while still allowing some further updates, you can request the engine to rebatch individual Batch Groups after you make changes to the original mesh instances. This is often useful with User Interface element components, where you might want to set up batching, but still need to do infrequent updates. Note that re-batching a group is a potentially expensive operation. In many cases, the impact of rebatching can be minimized by separating elements that need updating to separate Batch Group.

Here is an example of a simple script. The script updates textureAsset on an element, and marks the Batch Group as dirty.

// change textureAsset on element
element.textureAsset = this.hoverAsset;

// if this element has Batch Group set, mark it dirty to rebuild the group in the next frame
if (element.batchGroupId);

例 - 静的環境のバッチング

Western Scene


Western Animation


Western Animation Batched

このアニメーションでは、建物、サボテン、道路、地面用に4つのバッチグループを作成しました。道路と地面は1つのドローコールに結合されていない点に留意してください。これは、メッシュがバッチグループで定義されたMax AABBサイズよりも大きいためです。


This site is translated by the community. If you want to get involved visit this page