Hubs-Foundation / hubs

Duck-themed multi-user virtual spaces in WebVR. Built with A-Frame.
https://hubsfoundation.org
Mozilla Public License 2.0
2.13k stars 1.41k forks source link

Remove intermediate THREE.Group #5311

Open takahirox opened 2 years ago

takahirox commented 2 years ago

Related: #5294

Is your feature request related to a problem? Please describe.

There are a lot of intermediate THREE.Groups in the scene graph, for example this is the dump of the scene graph of the Gathering hall scene and one avatar (yourself).

scene.txt

This (unnecessarily) large scene graph can cause the performance problem especially in matrices update and project objects because they can traverse the entire scene graph.

Describe the solution you'd like

Remove (unnecessary) intermediate THREE.Groups as much as possible.

Additional context

An A-Frame entity has a THREE.Group as .object3D and adds objects (eg: mesh) under it. If an entity has a single child we may be able to replace the group with the single object.

The optimization should be done on A-Frame end rather than Hubs Clietne end?

takahirox commented 2 years ago

Probably this optimization should be done in our A-Frame refactoring.