Optical Flare System

Overview

The new Lens Flare Editor is integrated into CryENGINE 3. It uses the element based concept to build customizable flares instead of physically correct ones.

The instance of Flares is bound to light objects. When the Lens Flare item is assigned to a light entity, the proper material for rendering lens flare will be assigned to the light entity.

Important concepts

There are lots parameters for each type of flare element. Here some important concepts/functions will be explained.

Common / Position

The position relative to the light. For example, a value of (1,1) means always stick with the light.
(-1,-1) means the position should be symmetric with the light about the screen center
(0,0) means sit in the screen center and non-movable.

Common / Perspective Factor

This property controls how the flares react to perspective shortening.
Intuitively a higher-than-1 value means exaggerated perspective,
a value between 0~1 means reduced perspective shortening. Try to play with negative values.

Common / Correct aspect ratio

When it's on, the object will always appear in its original shape regardless of the screen aspect ratio.
i.e; a circle will not become an ellipse, a square will not look like a wide rectangle.

ChromaticRing / Lock to light

This property tells the renderer to ignore the positioning factor, and let system to choose the appropriate position for the ring.

Glow / Focus Factor

Similar to Photoshop brush's softness setting.

CameraOrbs / Enable Lens Detail Shading

Usable only when Lens Texture is enabled. This only will allow renderer to render a bump-mapped dirt instead of a flat one.
Currently the red channel of lens texture is used as height map.

Multi Ghost / Scattering range, position factor, position offset

These params control how the sub ghosts should be placed. Scattering range tells the max possible start and end diagonal positions for every sub ghost.
Position factor is a multiplier for the scattering range, consist of x-axis factor and y-axis factor. Position offset is the max possible offset for every sub ghost.

Root / Lateral chromatic abr

Enable this option and the normal chromatic aberration will become edge-effected.
Towards the the edge of the screen, chromatic abr becomes severer, whereas center of the screen is free from such aberration.

Root / Affected by light radius

Use light light radius as the flare falloff control, ignoring distance fading factor.

All / Sensor image size variation factor

Physical optical effects vary their appearances with different light incident angles and positions.
This parameter controls the multiplication factor of how the size of the flare element should be changed when approaching to the edge of the screen.
For example, 1 means stay unchanged; 0.7 means the flare element will shrink to 0.7 of its original size when at the edge.

All / Sensor image brightness variation factor

Same as sensor image size variation factor, just to affect brightness other than size.

Root / Custom sensor variation map

Sensor image xxxx variation factor uses this map as a soft mask to determine where the fade should happen. Bigger values mean higher fading strength.

All / Occlusion interaction

Currently affects only ghost, multi-ghosts, camera orbs and iris shafts. With this option enabled, the flare elements will react to how the light source is occluded by its surroundings.
For ghost and orbs, user can observe eclipse effect when an occluder swipe past the light-eye path.
For iris shafts, the shafts' appearance will be altered so that shafts' distribution and strength will focus more on non-occluded areas.

If enabling an option gives no result, it's best to check if the parent containers also have this option checked. Parameters are chained in hierarchy structure in flare system.

Flare Types

Ghost

The most common lens artifact in optical flare phenomenon's category. It's normally created by internal reflections between different lens glasses.

In CryENGINE, it's rendered as a textured quad. To save bandwidth, the quad's size is automatically adjusted according to the texture's dimensions.

Multi Ghost

A collection of Ghosts. You can control their static distribution behaviors via parameters like, scattering range, position range and offset range.

Glow

This is actually not a single physical phenomenon. In optical flare system, this can either form from light's scattering in participating media or lens' internal de-focusing.

In CryENGINE optical flare system, it's rendered as a circular polygon with optional gradient texture. It's static, not a screen space effect.

Chromatic Ring

Quite visible with cheap cameras. This phenomenon is the combination of light reflection, refraction and diffraction. CryENGINE treats it as a hoop shaped aurora and corresponding set of spikes (more spike based features to be implemented).

You can specify a spectrum texture to mimic the chromatic aberration along the light's path.

Iris Shafts

The cause for this effect has some similarities as chromatic ring, both have diffraction involved. However, this phenomenon has more to do with the uneven lens surfaces and internal density variation.

CryENGINE renders this as an array of textured spikes.

Volumetric shafts

This is not a lens flare effect in strict sense. Commonly seen in fog days, volumetric shafts is the result of light's air scattering.

This is approximated as a screen space effect. You cannot achieve off-screen volumetric shafts using this flare type.

Camera Orbs

This is a simple phenomenon from the bokeh of on-lens dirt or scratches. This effect can be heavy on graphics bandwidth due to potential overdraw areas.

Optionally, you can enable a dirt texture illuminated by near lights, which simulates dirt/scratches on visor or lens filters instead of lens glass itself.

Presets

Sample presets

Sample presets are provided (Libs\Flares\sample_presets.xml). Each of them demonstrates different aspects of the parameter combinations. Playing with the presets is best way to get yourself familiarized with this system.

Sometimes the streaks appear very thick unlike the images shown below, that is because of the perspective factor settings. Try to move away from the light to a proper distance, the thickness should be normal.

Funky Stuff

Challenge yourself to achieve more funky creations!