Using OccluderInstance3D with MultiMeshInstance3D

Godot Version

v4.2.1.stable.official [b09f793f5]

Question

How do you use occlusion culling together with MultiMesh?

The idea behind OccluderInstance3D is simple: you place it together with Mesh nodes and bake the occlusion. Unfortunately, if all your meshes are inside the MultiMesh node, this becomes impossible and OccluderInstance3D gives this error when trying to bake: “No meshes to bake. Make sure there is at least one MeshInstance3D node in the scene whose visual layers are part of the OccluderInstance3D’s Bake Mask property”.

Using MeshInstance3D, unfortunately, is impossible since I am using the “Spatial Gardener” addon, and it is it who creates these MultiMeshes. And using anything besides MultiMesh would be absurd, since I have close to 600 meshes inside these MultiMesh nodes.

Because of how a multimesh works, it is incompatible with Occlusion Culling: either none of the objects are rendered, or all 600 are. Oftentimes, a multimesh doesn’t have enough of a performance impact to require occlusion anyway.

1 Like

The geometry within the MultiMesh is incompatible with occlusion culling, but the MultiMesh itself can be occlusion culled.

You have to specify an occlusion shape for your OccluderInstance3D (instead of baking), e.g. a quad which you then place blocking visibility of the MultiMesh. The occlusion check is based on the overall bounding box of the MultiMesh, and affects visibility of the entire thing.

Whether this is useful in practice depends on your specific circumstances.

1 Like