Hi, I’m currently facing high draw call due to objects being placed multiple times in the scene (a true classic: trees). I documented my tests below but maybe you can speed this up.
The model containing the object is exported from blender as .glb. It contains 168 tree instances (all aptly named “GN Instance”) and all are referencing the same underlying meshes and materials.
Baseline without trees
203 drawcalls
With trees as-is
1547 drawcalls
Reload (locally, no cache) to first frame takes about ~3s
GPU Instancing enabled for tree materials
722 drawcalls
But the first frame is now stalled for ~4s, resulting in about ~7s until first visible frame
During that time there are quite a few log entries like this:
[Instancing] Growing Buffer
Mesh: "GN_Instance_235"
Max count 16 → 32
Max vertex count 1100359 -> 2135991
Max index count 5600034 -> 11030370
GPU Instancing enabled for tree materials + preview compression / production build:
800something drawcalls
>30s until first frame, some missing textures for the trees.
lots of errors like the one below:
Failed adding mesh to instancing (object name: "GN_Instance_209", instances: 5/16, vertices: 1,166,886/2,204,118, indices: 2,073,942/7,604,454)
RangeError: Array buffer allocation failed
at new ArrayBuffer (<anonymous>)
at new Float32Array (<anonymous>)
at BatchedMesh._initializeGeometry (three.module.js?v=987edefb:33765:22)
at BatchedMesh.addGeometry (three.module.js?v=987edefb:33928:8)
at InstancedMeshRenderer.addGeometry (RendererInstancing.js?v=987edefb:678:44)
at InstancedMeshRenderer.grow (RendererInstancing.js?v=987edefb:617:22)
at InstancedMeshRenderer.add (RendererInstancing.js?v=987edefb:467:22)
at InstancedMeshRenderer.addInstance (RendererInstancing.js?v=987edefb:447:18)
at InstancingHandler.tryCreateOrAddInstance (RendererInstancing.js?v=987edefb:91:34)
at InstancingHandler.setup (RendererInstancing.js?v=987edefb:29:26)
When starting this topic I did not know yet I’d run into problems with compression. I thought the main problem using instancing was the +4s stalling (maybe due to buffer allocations?).
But asking in a more general way: What are the best options to handle many (static) instances of the same mesh?




