Crash when combining Snapshot Rendering, Clustered Lighting, and Selection Outline

When Snapshot Rendering is enabled, the engine crashes if you select a mesh using Selection Outline in a scene that uses Clustered Lighting.

repro: Babylon.js Playground

Please let me know if I’m using this incorrectly or if Selection Outline isn’t supported with Snapshot Rendering.

Thank you for maintaining this great framework!

This will not work because, when there is no mesh in the selection array, the outline renderer does not render anything. This means that the snapshot renderer will record a snapshot without taking the outline renderer’s output into account. When you add a mesh to the selection, it creates an inconsistency between what was recorded and the current rendering state, which causes an error. You must either add a mesh to the selection before enabling snapshot rendering, or disable snapshots, add a mesh to the selection, and then re-enable snapshots:

Thank you for your information!