Lens flare

The last subject we'll explore in this chapter is lens flares. You are probably already familiar with lens flares. For instance, they appear when you take a photograph directly into the sun or another bright light source. In most cases, you want to avoid this, but for games and 3D-generated images, it provides a nice effect that makes scenes look a bit more realistic.

Three.js also has support for lens flares and makes it very easy to add them to your scene. In this last section, we're going to add a lens flare to a scene and create the output as you can see in the following screenshot; you can see this for yourself by opening 07-lensflares.html:

60 FPS (33-60)

We can create a lens flare by instantiating the THREE.LensFlare ...

Get Learn Three.js - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.