CSM bugs with very large objects

I have a very weird bug with the CSM shadows (using r181) regarding very large objects (building-sized) that seem to go out of the shadows’ FOV, or upon inspecting with CSMHelper, seem to break when crossing a cascade. I know my way around shaders and rendering stuff but I have no idea where even to begin to debug this since CSM and shadow stuff is my weak spot. Would like to know if anyone saw something similar and might have any ideas where to investigate this issue.

Video: https://youtu.be/cVhgxqtigu8
Video with CSMHelper: https://youtu.be/Ik7JyDMwZ68

Edit: forgot to post the CSM code:

const csm = new CSM({
          maxFar: 1500,
          cascades: 4,
          shadowMapSize: 4096,
          shadowBias: -0.0002,
          camera: engine.camera as PerspectiveCamera,
          parent: this,
          lightIntensity: params.sunLightIntensity ?? 1,
          lightDirection: sun.clone().normalize().multiplyScalar(-1),
        });

Thanks in advance!

I haven’t encountered this specifically.. but my first guess would be that perhaps the buildings don’t have correct bounding boxes generated and are getting frustum culled incorrectly.

Does setting .frustumCulled = false on all the meshes in the building, change the behavior? If so, perhaps you need to mesh.geometry.computeBoundingBox() on all the geometries…