When do I need to recompute the bounding sphere and bounding box?

I use InstancedMesh and recompute the bounding sphere after each matrix update to ensure accurate frustum culling. So, I think that when I directly set the matrix of an object, I must recompute the bounding sphere and bounding box. However, when I set the matrix for a regular Mesh (with SphereGeometry), without recomputing the bounding sphere and bounding box, the frustum culling still works correctly. Why is that?
Also, I’d like to know when it’s necessary to recompute the world matrix. Suppose I have an object without any children; if I update its matrix, as long as its parent object’s matrixWorld is correct, it should render properly, right?
Thanks in advance!

Boundaries are mostly used to raycast instances correctly (and other operation for volumes calculation). If you just move instances around, there is no need to update them.

The reason to always update matrix after a change is to synchronize it with it’s commonly used vectors values (position,quaternion,scaling). Matrix is an encapsuled separated version of them.

matrix → position = need manual update.
position → matrix = auto update by default.

Without this you may quickly end with completely off results as some plugins/addon/features may not use matrix values.

matrix → position = need manual update.

Why does frustum culling still work correctly when I update a Mesh’s matrix (with matrixAutoUpdate = false ) without recomputing the bounding sphere?

To be honest… it doesn’t work correctly. :sweat_smile:
Frustrum culling is “per mesh”. I generally disable it for instanced mesh as it cause wrong camera culling. I’m intrigued if you made it work natively (it shouldn’t)

Also there is a neat addon I’m using to fix this: InstancedMesh2
It’s trending quite a lot lot lately, neat improvements were made by the author

Thanks, I’ll take a look. InstancedMesh does require manual bounding sphere updates, whereas Mesh do not. This is why I’m confused.

If I recompute the bounding sphere of an InstancedMesh , the frustum culling result should be accurate.

Well, even if the child’s matrixAutoUpdate is set to false, its matrixWorld will still be updated by its parent.

This is because the bounding sphere’s position is determined by the object’s matrixWorld . When calling .computeBoundingSphere() , it only calculates the bounds based on the geometry’s vertex data (in local space).