More notes on how Three seems to render the scene graph, roughly.
The traversal happens in the renderer, WebGLRenderer.
First, a renderlist is constructed in projectObject. It contains a flat list of renderables constructed from traversing the scene from top to bottom.
Then, the renderlist is rendered in sequence in renderObjects(), renderObject(), renderBufferDirect()
The modelViewMatrix() is computed and stored per object or mesh, as well as the world transform of the object.
So for multi-parenting this is where either cloning would be necessary, probably when constructing the renderlist. Or, there could be a separation, by introducing a renderObject which references the mesh and world related matrices separately:
update one group = THREE.Objject3D and all createInstance(group) will update
Here;s how its done:
I basically introduced another hook onBeforeUpdate and manage the matrix updates manually. It can be cleaned up some more, with better dirty flags. Also wasn’t sure if this should be done on the cpu, could limit the level of nesting and do matrix0 * matrix1 * matrix2... * vec4(position,1.);.