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.maxSimultaneousLights but it impacts performance.
  • Include/Exclude Lists: Use light.includedOnlyMeshes or light.excludedMeshes to control which meshes a light affects.
  • Light Intensity: Use light.intensity to control brightness. Values above 1.0 create overbright effects.
  • Falloff: Point and spot lights support light.falloffType for 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;