In accordance with WestLangley's suggestion, it would be advisable to explore the THREE.WebglRenderer
for information on renderer.info and review the corresponding logic.
The process of drawcalls varies slightly. For instance, if you have a single geometry like cubeGeometry
, one material such as cubeMaterialRed
, and five cube nodes labeled [c1,c2...,c5]
, there will be five draw calls. The binding of geometry would occur once in three.js, followed by five consecutive draw calls using the same shader and mostly similar uniforms (with only changes to position/rotation/scale matrix, while the color red might be bound just once).
If there are five distinct materials [cMatRed, cMatBlue... cMatPink]
, each with the same geometry, then five draw calls will be necessary but with varying uniform settings for the color of the material.
In the scenario of five different geometries present in five separate nodes, the binding of geometry must happen prior to each draw call.
To streamline this process, instancing can be utilized where applicable. In the second illustration, the geometry would be bound for instancing once, along with the configuration of attributes containing position/rotation/scale data and colors. Subsequently, a single draw call would render 5 geometries positioned and colored as specified in the attributes.
It is worth noting that Three.js does not currently handle batching or optimization of this nature automatically, so manual instancing is required.
Ultimately, the relationship between the number of nodes containing geometry and draw calls is typically a direct 1:1 ratio. For example, Object3D->Object3D->Mesh
structure may consist of three nodes resulting in just one draw call.