Lens flare

As mentioned in some of the recipes of Chapter 4, Postprocessing, some of the techniques we covered copy qualities common to a camera lens instead of a human eye. Lens flare is yet another camera lens imperfection commonly seen in movies. Usually seen when a very bright light source is present (such as the Sun), lens flare shows up as a series of colorful shapes that cover the scene. As an example, the following screenshot showing the Sun close to the top-right corner and a series for lens flares spread over the screenshot's diagonal:

Lens flare

For this recipe we are going to generate lens flares only for the Sun. This implementation can be easily ...

Get HLSL Development Cookbook 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.