BabylonJS: Lens Flares Cheat Sheet

The syntax to create lens flare:

var lensFlareSystem = new BABYLON.LensFlareSystem("lensFlareSystem", light0, scene);

Parameters to create lens flare:

  • Name − Name given to the lensflaresystem.
  • Light − This can be light source or camera.
  • Scene − Scene to which the lens flare will be added.

To add flares to the scene, execute the following command −

var flare1 = new BABYLON.LensFlare(0.5, 0.15, new BABYLON.Color3(1, 1, 1), "images/sun1.png", lensFlareSystem);
  • Size − Floating value between 0 and 1.
  • Position − The source (the emitter) of the lens flares (it can be a camera, a light or a mesh).
  • Lensflaresystem − Object created using lensflaresystem class.

Leave a Reply

Your email address will not be published. Required fields are marked *