Hi,
I have a number of character meshes that can dynamically change their clothing, hair or weapons.
To do this I simply load the required mesh and attach it to the character’s skeleton.
As there can be a lot of these added meshes I would like to extend the mechanism that exists within Babylon.js to evaluate the active meshes (frustrum culling) so that if a character is judged to be visible, then all of the character’s hair, clothing and weapons are also judged to be visible.
This way I avoid frustrum checking on many small meshes and I avoid drawing the meshes if the character is not deemed to be visible.
I was thinking of performing this logic for the characters and it’s submeshes within my own custom version of scene.getActiveMeshCandidates, in which I:
- Call the original scene.getActiveMeshCandidates to get a list of meshes.
- Frustrum check each character mesh
- Set any character (along with all of it’s additional meshes) not within the frustrum to be inactive
- Set any character (along with all of it’s additional meshes) within the frustrum to be active and alwaysSelectAsActiveMesh=true
- Return the array of all meshes for standard evaluation by scene._evaluateActiveMeshes() knowing that the characters and all submeshes are already set to be drawn or ignored.
Before I implement this I wanted to confirm that I wasn’t missing an existing mechanism that would be better than my plan.
Thanks.