Skip to content

Texture Partial Update

Instance data (matrices, colors, uniforms, bones) is stored in SquareDataTexture objects.
When only a few instances change, only the texture rows containing them are uploaded to the GPU, instead of the whole texture.

Every setter marks its instance for update automatically:

iMesh.setMatrixAt(index, matrix);
iMesh.setColorAt(index, color);
iMesh.setUniformAt(index, 'metalness', 0.5);

Configuration

iMesh.matricesTexture.partialUpdate = false; // always upload the full texture
iMesh.matricesTexture.maxUpdateCalls = 10; // fall back to a full update above this many uploads