Light Management
Tips for managing lights effectively in your scene:
- Performance: Babylon.js supports up to 4 simultaneous lights per mesh by default. You can increase this with
scene.maxSimultaneousLightsbut it impacts performance. - Include/Exclude Lists: Use
light.includedOnlyMeshesorlight.excludedMeshesto control which meshes a light affects. - Light Intensity: Use
light.intensityto control brightness. Values above 1.0 create overbright effects. - Falloff: Point and spot lights support
light.falloffTypefor realistic light attenuation. - Light Gizmos: Use the Inspector to visualize and adjust light positions and properties in real-time.
// Limit which meshes a light affects
pointLight.includedOnlyMeshes = [sphere, box]; // Only lights these meshes
// Or exclude specific meshes
dirLight.excludedMeshes = [uiPlane]; // Doesn't light the UI
// Increase max simultaneous lights (default is 4)
const material = new BABYLON.StandardMaterial("mat", scene);
material.maxSimultaneousLights = 6;