Documentation

Unity Engine


Unity Engine


Lens Flare (SRP) Data Asset in URP

Reference for the Lens Flare (SRP) Data Asset.
Read time 7 minutesLast updated a month ago

Unity’s Scriptable Render Pipeline (SRP) includes the Lens Flare Data asset. You can use this asset to control the appearance of Lens Flares in your scene. This is the SRP equivalent of the Built-in Render Pipeline's Flare asset, which is incompatible with SRPs.
For examples of how to use Lens Flares, refer to the Lens Flare samples in URP Package Samples.
To create a Lens Flare Data asset, select Assets > Create > Lens Flare (SRP). To use this asset, assign it to the Lens Flare Data property of a Lens Flare (SRP) component.

Properties

The Lens Flare Element asset has the following properties:

Type

Property

Description

TypeSelect the type of Lens Flare Element this asset creates:

Image

Property

Description

Flare TextureThe Texture this lens flare element uses.
Preserve Aspect RatioFixes the width and height (aspect ratio) of the Flare Texture. You can use Distortion to change this property.

Circle

Property

Description

GradientControls the offset of the circular flare's gradient. This value ranges from 0 to 1.
FalloffControls the falloff of the circular flare's gradient. This value ranges from 0 to 1, where 0 has no falloff between the tones and 1 creates a falloff that is spread evenly across the circle.
InverseEnable this property to reverse the direction of the gradient.

Polygon

Property

Description

GradientControls the offset of the polygon flare's gradient. This value ranges from 0 to 1.
FalloffControls the falloff of the polygon flare's gradient. This value ranges from 0 to 1, where 0 has no falloff between the tones and 1 creates a falloff that is spread evenly across the polygon.
Side CountDetermines how many sides the polygon flare has.
RoundnessDefines how smooth the edges of the polygon flare are. This value ranges from 0 to 1, where 0 is a sharp polygon and 1 is a circle.
InverseEnable this property to reverse the direction of the gradient

Ring

Property

Description

GradientControls the offset of the circular flare's gradient. This value ranges from 0 to 1.
FalloffControls the falloff of the circular flare's gradient. This value ranges from 0 to 1, where 0 has no falloff between the tones and 1 creates a falloff that is spread evenly across the circle.
InverseEnable this property to reverse the direction of the gradient.
AmplitudeAmplitude of the sampling of the noise.
RepeatFrequency of the sampling for the noise.
SpeedScale the speed of the animation.
Ring ThicknessRing Thickness.

Lens Flare Data Driven SRP

Property

Description

AssetLens Flare Data SRP asset as an element.
Unity support an Lens Flare Data SRP recursive, but with a hard cutoff after 16 recursions call. For instance asset A constains asset B which constains asset A (infinite recursion). That will trigger a warning and execution 16 recursions:
"LensFlareSRPAsset contains too deep recursive asset (> 16). Be careful to not have recursive aggregation, A contains B, B contains A, ... which will produce an infinite loop."

Color

Property

Description

Color TypeSelect the color type of Lens Flare Element this asset creates:
TintChanges the tint of the lens flare. If this asset is attached to the light, this property is based on the light tint.
Modulate By Light ColorAllows light color to affect this Lens Flare Element. This only applies when the asset is used in a SRP Lens Flare Override Component that is attached to a point, spot, or area light.
IntensityControls the intensity of this element.
Blend ModeSelect the blend mode of the Lens Flare Element this asset creates:
  • Additive
  • Screen
  • Premultiplied
  • Lerp

Constant Color

Property

Description

TintChanges the tint of the lens flare. If this asset is attached to the light, this property is based on the light tint.

Constant Color

Property

Description

Tint RadialSpecifies the radial gradient tint of the element. If the element type is set to Image, the Flare Texture is multiplied by this color.

Constant Color

Property

Description

Tint AngularSpecifies the angular gradient tint of the element. If the element type is set to Image, the Flare Texture is multiplied by this color.

Common

Cutoff

Property

Description

Cutoff SpeedSets the speed at which the radius occludes the element.

A value of zero (with a large radius) does not occlude anything. The higher this value, the faster the element is occluded on the side of the screen.

The effect of this value is more noticeable with multiple elements.
Cutoff RadiusSets the normalized radius of the lens shape used to occlude the lens flare element. A radius of one is equivalent to the scale of the element.

Transform

Property

Description

Position OffsetDefines the offset of the lens flare's position in screen space, relative to its source.
Auto RotateEnable this property to automatically rotate the Lens Flare Texture relative to its angle on the screen. Unity uses the Auto Rotate angle to override the Rotation parameter.

To ensure the Lens Flare can rotate, assign a value greater than 0 to the Starting Position property.
RotationRotates the lens flare. This value operates in degrees of rotation.
SizeUse this to adjust the scale of this lens flare element.

This property is not available when the Type is set to Image and Preserve Aspect Ratio is enabled.
ScaleThe size of this lens flare element in world space.

Axis Transform

Property

Description

Starting PositionDefines the starting position of the lens flare relative to its source. This value operates in screen space.
Angular OffsetControls the angular offset of the lens flare, relative to its current position. This value operates in degrees of rotation.
Translation ScaleLimits the size of the lens flare offset. For example, values of (1, 0) create a horizontal lens flare, and (0, 1) create a vertical lens flare.

You can also use this property to control how quickly the lens flare appears to move. For example, values of (0.5, 0.5) make the lens flare element appear to move at half the speed.

Distortion

Property

Description

EnableSet this property to True to enable distortion.
Radial Edge SizeControls the size of the distortion effect from the edge of the screen.
Radial Edge CurveBlends the distortion effect along a curve from the center of the screen to the edges of the screen.
Relative To CenterSet this value to True to make distortion relative to the center of the screen. Otherwise, distortion is relative to the screen position of the lens flare.

Multiple Elements

Property

Description

EnableEnable this to allow multiple lens flare elements in your scene.
CountDetermines the number of identical lens flare elements Unity generates.
A value of 1 appears the same as a single lens flare element.
DistributionSelect the method that Unity uses to generate multiple lens flare elements:
Length SpreadControls how spread out multiple lens flare elements appear.
Relative To CenterIf true the distortion is relative to center of the screen otherwise relative to lensFlare source screen position.

Uniform

Property

Description

ColorsThe range of colors that this asset applies to the lens flares.
RotationThe angle of rotation (in degrees) applied to each element incrementally.

Curve

Property

Description

ColorsThe range of colors that this asset applies to the lens flares. You can use the Position Spacing curve to determine how this range affects each lens flare.
Position VariationAdjust this curve to change the placement of the lens flare elements in the Lens Spread.
RotationThe uniform angle of rotation (in degrees) applied to each element distributed along the curve. This value ranges from -180° to 180°.
ScaleAdjust this curve to control the size range of the lens flare elements.

Random

Property

Description

SeedThe base value that this asset uses to generate randomness.
Intensity VariationControls the variation of brightness across the lens flare elements. A high value can make some elements might invisible.
ColorsThe range of colors that this asset applies to the lens flares. This property is based on the Seed value.
Position VariationControls the position of the lens flares. The X value is spread along the same axis as Length Spread. A value of 0 means there is no change in the lens flare position. The Y value is spread along the vertical screen space axis based on the Seed value.
Rotation VariationControls the rotation variation of the lens flares, based on the Seed value. The Rotation and Auto Rotate parameters inherit from this property.
Scale VariationControls the scale of the lens flares based on the Seed value.