Hi everyone,
Super mean bug here. I have not figured out yet how to reproduce. So I can only the describe and hope. In sum, I cannot have shadows and clustered lighting. More specifically, the bug throws a WebGL warning
[.WebGL-0x47fc04470d00] GL_INVALID_OPERATION: glDrawElements: It is undefined behaviour to use a uniform buffer that is too small.
and leaves the one affected mesh “B” invisible (it is there in the Inspector).
Here are the prerequisites
- Clustered Lights activated: there must be PointLIghts in the container. They must have certain properties. Cannot replicate with arbitrary numbers. There is no NaN or undefines.
- 1 DirectionalLight with: Dir: 0.5, -0.5, 0.5 and Pos: -31.999999847888077, 32, -41. A zeroed-out light will not trigger the bug.
- Have mesh A and B
- Add both meshes to the DirectionalLight’s “includedOnlyMeshes” list. Leaving out mesh A will not trigger the bug.
- Other unknown requirements

To trigger it, I can start the render loop or render mesh B directly.
For what it is worth, here is my test code:
const mesh = scene.getMeshByName("LevelMegaTerrain");
await mesh.material.forceCompilationAsync(mesh); //just trying
console.log( mesh.isReady(true) ); //true
console.log( mesh.material.isFrozen ); //false
console.log( mesh.material.isReady(mesh, false) ); //true
console.log( mesh.material.isReadyForSubMesh(mesh, mesh.subMeshes[0], false) ); //true
mesh.directRender(); //will break it (so will starting the render loop)
If I dispose the DirectionalLight, fixes it
If I dispose the ClusteredLights container, bug remains.
If I dispose mesh A, bug remains.
Replacing material, bug remains.
Any tips welcome. I am stuck ![]()
Best wishes
Joe
For own reference : Babylon.js Playground


