Occlusion effect is affected by mesh creation/load order - is this intentional?

When using the occlusionMaterial or the engine.setColorWrite(false) for a mesh, the occlusion only has effect on meshes loaded or created AFTER the occluder mesh itself. Is this the expected behavior?

I would expect the occlusion to have effect on other meshes based only their relative depth and not on creation order. Am I missing something I should do after creating the meshes? Should I update some buffer or something. Or is it simply a bug?

I do know that documentation for some of our other occlusion features warn that your occluders must be rendered first, followed by your occludees (e.g., Occlusion Queries | Babylon.js Documentation (babylonjs.com))
I assume the same applies for OcclusionMaterial, where the user is responsible for maintaining a rendering order that follows that principle. cc @sebavan Is this true?

1 Like

Ah yes, I did not read the docs for the Occlusion Queries. So it does indeed work like this by design. Thank you very much. This solves the issue.

1 Like