Skip to content

Commit

Permalink
[Backport] [2023.2] DOCG-3077 Add and update URP/HDRP lens flare pages
Browse files Browse the repository at this point in the history
This is a backport of https://github.cds.internal.unity3d.com/unity/unity/pull/45691

- Restructure and add to the lens flare pages of the URP and HDRP manuals, to help users understand the limitations of the 2 types of lens flare.
- Remove unneeded images from the Lens Flare (SRP) Data Asset page
- Update the main manual Lens flare page with missing features

Jira ticket: https://jira.unity3d.com/browse/DOCG-3077
  • Loading branch information
markg-unity authored and Evergreen committed Mar 22, 2024
1 parent 6e4bed2 commit fee8732
Show file tree
Hide file tree
Showing 16 changed files with 259 additions and 141 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,13 @@
* [Depth of Field](Post-Processing-Depth-of-Field.md)
* [Film Grain](Post-Processing-Film-Grain.md)
* [Lens Distortion](Post-Processing-Lens-Distortion.md)
* [Lens Flare (SRP)](shared/lens-flare/lens-flare-component.md)
* [Lens flares](shared/lens-flare/lens-flare.md)
* [Choose a lens flare type](shared/lens-flare/choose-a-lens-flare-type.md)
* [Add lens flares](shared/lens-flare/lens-flare-component.md)
* [Add screen space lens flares](shared/lens-flare/Override-Screen-Space-Lens-Flare.md)
* [Lens Flare (SRP) reference](shared/lens-flare/lens-flare-reference.md)
* [Lens Flare (SRP) Data Asset reference](shared/lens-flare/lens-flare-asset.md)
* [Screen Space Lens Flare override reference](shared/lens-flare/reference-screen-space-lens-flare.md)
* [Panini Projection](Post-Processing-Panini-Projection.md)
* [Vignette](Post-Processing-Vignette.md)
* [Motion effects](motion-effects.md)
Expand Down Expand Up @@ -299,6 +305,10 @@
* [Lighting environment reference](reference-lighting-environment.md)
* [Ambient Occlusion reference](reference-ambient-occlusion.md)
* [IES Importer reference](IES-Importer.md)
* [Lens flares reference](shared/lens-flare/lens-flare-lens-flares-reference.md)
* [Lens Flare (SRP) reference](shared/lens-flare/lens-flare-reference.md)
* [Lens Flare (SRP) Data Asset reference](shared/lens-flare/lens-flare-asset.md)
* [Screen Space Lens Flare override reference](shared/lens-flare/reference-screen-space-lens-flare.md)
* [Volumetric lighting reference](reference-volumetric-lighting.md)
* [Screen Space Global Illumination](reference-screen-space-global-illumination.md)
* [Screen Space Lens Flare](shared/lens-flare/reference-screen-space-lens-flare.md)
Expand Down Expand Up @@ -389,6 +399,5 @@
* [Rendering and post-processing reference](reference-rendering-post-processing.md)
* [Dynamic Resolution component reference](reference-dynamic-resolution.md)
* [High Dynamic Range (HDR) tonemapping reference](reference-hdr-tonemapping.md)
* [Lens Flare (SRP) Data Asset reference](shared/lens-flare/lens-flare-asset.md)
* [Custom Pass reference](custom-pass-reference.md)
* [HDRP Glossary](Glossary.md)
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Screen Space Lens Flare
# Add screen space lens flares

![](../../Images/shared/lens-flare/screenspacelensflares.png)

Expand Down Expand Up @@ -50,7 +50,7 @@ To enable screen space lens flares, follow these steps:

If lens flares don't appear, check the settings of the **Bloom** override in the default volume in **Edit** > **Project Settings** > **Graphics** > **HDRP Global Settings** > **Frame Settings (Default Values)** > **Default Volume Profile Asset** > **Bloom**.

For information about screen space lens flare properties, refer to [Screen Space Lens Flare reference](shared/lens-flare/reference-screen-space-lens-flare.md).
For information about screen space lens flare properties, refer to [Screen Space Lens Flare reference](reference-screen-space-lens-flare.md).

[!include[](../../snippets/volume-override-api.md)]

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Choose a lens flare type

You can add the following types of lens flares:

- [Lens flares](lens-flare-component.md) - use a **Lens Flare (SRP)** component to create lens flares for lights that have specific locations in your scene, for example the sun or bright bulbs.
- [Screen space lens flares](Override-Screen-Space-Lens-Flare.md) - use a **Screen Space Lens Flare** override to create lens flares for emissive surfaces, bright spots, and onscreen lights.

You can use both types in the same scene.

Use the following table to help you choose a lens flare type:

| Feature | Lens Flare (SRP) component | Screen Space Lens Flare override |
|-|-|-|
| Typical uses | Lens flares from the sun and specific lights, custom flare shapes, and cinematics | Lens flares on vehicles and water, first-person games, and science-fiction environments |
| Supported platforms | All platforms except XR | All platforms |
| CPU and GPU use | CPU and GPU | GPU |
| Types of light | All Light objects, except Area Lights | All bright spots and visible lights |
| Placement | Attach to individual lights. Place lens flares manually | Generate inside a volume. Place all lens flares automatically with a single setting |
| Lens flares from offscreen lights | Yes | No |
| Light streaks | No, unless you create them manually | Yes |
| Configure flares | Configure per lens flare or per element | Configure for all lens flares together |
| Configure flare elements | Configure many settings for each element, per lens flare | Configure several settings for elements, for all lens flares together |
| Configure attenuation | Yes | No |
| Affected by clouds, fog and water | Volumetric clouds and background clouds only | Yes |
| Preserve aspect ratio | Yes | No |
| Chromatic aberration | No | Yes |
| Blend modes | Additive, Lerp, Premultiplied and Screen | Additive only |
| Occlusion | Screen space occlusion, and geometric occlusion for offscreen lights. Configurable. Occlusion might not always work at the edge of the screen. | Screen space occlusion, generated from the color buffer. Not configurable |
| Examples in [package samples](../../HDRP-Sample-Content.md) | Yes | No |

## Additional resources

- [Lens Flare (SRP) reference](lens-flare-srp-reference.md)
- [Lens Flare (SRP) Data Asset reference](lens-flare-asset.md)
- [Screen Space Lens Flare override reference](reference-screen-space-lens-flare.md)
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Unity’s [Scriptable Render Pipeline (SRP)](https://docs.unity3d.com/Manual/ScriptableRenderPipeline.html) includes the **Lens Flare Data** asset. You can use this asset to control the appearance of [Lens Flares](lens-flare-component.md) in your scene. This is the SRP equivalent of the Built-in Render Pipeline's [Flare](https://docs.unity3d.com/Manual/class-Flare.html) asset, which is incompatible with SRPs.

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](lens-flare-component.md).
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](lens-flare-component.md).

## Properties

Expand Down Expand Up @@ -38,7 +38,7 @@ The Lens Flare Element asset has the following properties:

#### <a name="circle"></a>Circle

![](../../images/shared/lens-flare/lens-flare-shape-circle.png)
#### Circle

| **Property** | **Description** |
| ------------ | ------------------------------------------------------------ |
Expand All @@ -48,7 +48,7 @@ The Lens Flare Element asset has the following properties:

#### <a name="polygon"></a>Polygon

![](../../images/shared/lens-flare/lens-flare-shape-polygon.png)
#### Polygon

| **Property** | **Description** |
| ------------ | ------------------------------------------------------------ |
Expand All @@ -60,8 +60,6 @@ The Lens Flare Element asset has the following properties:

## <a name="color"></a>Color

![](../../images/shared/lens-flare/lens-flare-Color.png)

| **Property** | **Description** |
| ----------------------- | ------------------------------------------------------------ |
| Tint | Changes the tint of the lens flare. If this asset is attached to the light, this property is based on the light tint. |
Expand All @@ -71,8 +69,6 @@ The Lens Flare Element asset has the following properties:

## <a name="transform"></a>Transform

![](../../images/shared/lens-flare/lens-flare-Transform.png)

| **Property** | **Description** |
| ----------------------- | ------------------------------------------------------------ |
| Position Offset | Defines the offset of the lens flare's position in screen space, relative to its source. |
Expand All @@ -83,7 +79,7 @@ The Lens Flare Element asset has the following properties:

## <a name="axistransform"></a>AxisTransform

![](../../images/shared/lens-flare/lens-flare-axis-transform.png)
### Axis Transform

| **Property** | **Description** |
| ----------------- | ------------------------------------------------------------ |
Expand All @@ -95,8 +91,6 @@ The Lens Flare Element asset has the following properties:

## Distortion

![](../../images/shared/lens-flare/lens-flare-radial-distortion.png)

| **Property** | **Description** |
| --------------- | ------------------------------------------------------------ |
| Enable | Set this property to True to enable distortion. |
Expand All @@ -116,8 +110,7 @@ The Lens Flare Element asset has the following properties:
| Length Spread | Controls how spread out multiple lens flare elements appear. |
| Relative To Center | If true the distortion is relative to center of the screen otherwise relative to lensFlare source screen position. |

### <a name="uniform"></a>Uniform
![](../../images/shared/lens-flare/lens-flare-multiple-elements-uniform.png)
#### Uniform

| **Property** | **Description** |
| --------------- | ------------------------------------------------------------ |
Expand All @@ -126,7 +119,7 @@ The Lens Flare Element asset has the following properties:

### <a name="Curve"></a>Curve

![](../../images/shared/lens-flare/lens-flare-multiple-elements-curve.png)
#### Curve

| **Property** | **Description** |
| ---------------- | ------------------------------------------------------------ |
Expand All @@ -137,7 +130,7 @@ The Lens Flare Element asset has the following properties:

### <a name="random"></a>Random

![](../../images/shared/lens-flare/lens-flare-multiple-elements-random.png)
#### Random

| **Property** | **Description** |
| ------------------- | ------------------------------------------------------------ |
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Lens Flare (SRP)
# Add lens flares

![](../../images/shared/lens-flare/lens-flare-header.png)

Expand All @@ -10,7 +10,7 @@ Use the Lens Flare (SRP) component to create lens flares for lights that have sp

## Create a lens flare in SRP

The Lens Flare (SRP) component controls where the lens flare is as well as properties such as attenuation and whether the lens flare considers occlusion. For properties that define how the lens flare looks, SRP uses the [Lens Flare (SRP) Data](shared/lens-flare/lens-flare-asset.md) asset. Each Lens Flare (SRP) component must reference a Lens Flare (SRP) data asset to display a lens flare on-screen.
The Lens Flare (SRP) component controls where the lens flare is as well as properties such as attenuation and whether the lens flare considers occlusion. For properties that define how the lens flare looks, SRP uses the [Lens Flare (SRP) Data](lens-flare-asset.md) asset. Each Lens Flare (SRP) component must reference a Lens Flare (SRP) data asset to display a lens flare on-screen.

To create a lens flare in a scene:

Expand All @@ -21,32 +21,7 @@ To create a lens flare in a scene:
5. In the Lens Flare (SRP) component Inspector, assign the new Lens Flare (SRP) Data asset to the **Lens Flare Data** property.
6. Select the Lens Flare (SRP) Data asset and, in the Inspector, add a new element to the **Elements** list. A default white lens flare now renders at the position of the Lens Flare (SRP) component. For information on how to customize how the lens flare looks, see [Lens Flare (SRP) Data](lens-flare-asset.md).

## Properties

### General

| **Property** | **Description** |
| --------------- | ------------------------------------------------------------ |
| Lens Flare Data | Select the [Lens Flare (SRP) Data](lens-flare-asset.md) asset this component controls. |
| Intensity | Multiplies the intensity of the lens flare. |
| Scale | Multiplies the scale of the lens flare. |
| Attenuation by Light Shape | Enable this property to automatically change the appearance of the lens flare based on the type of light you attached this component to.<br/>For example, if this component is attached to a spot light and the camera is looking at this light from behind, the lens flare will not be visible. <br/>This property is only available when this component is attached to a light. |
| Attenuation Distance |The distance between the start and the end of the Attenuation Distance Curve.<br/>This value operates between 0 and 1 in world space. |
| Attenuation Distance Curve | Fades out the appearance of the lens flare over the distance between the GameObject this asset is attached to, and the Camera. |
| Scale Distance | The distance between the start and the end of the **Scale Distance Curve**.<br/>This value operates between 0 and 1 in world space. |
| Scale Distance Curve | Changes the size of the lens flare over the distance between the GameObject this asset is attached to, and the Camera. |
| Screen Attenuation Curve | Reduces the effect of the lens flare based on its distance from the edge of the screen. You can use this to display a lens flare at the edge of your screen |

### Occlusion

| **Property** | **Description** |
| --------------- | ------------------------------------------------------------ |
| Enable | Enable this property to partially obscure the lens flare based on the depth buffer |
| Occlusion Radius | Defines how far from the light source Unity occludes the lens flare. This value is in world space. |
| Sample Count | The number of random samples the CPU uses to generate the **Occlusion Radius.** |
| Occlusion Offset | Offsets the plane that the occlusion operates on. A higher value moves this plane closer to Camera. This value is in world space. <br/>For example, if a lens flare is inside the light bulb, you can use this to sample occlusion outside the light bulb. |
| Volumetric Cloud Occlusion | When enabled, HDRP uses the volumetric cloud texture to occlude the lens flare. HDRP always considers the lens flare to be behind the volumetric clouds because it calculates occlusion in screen space. |
| Occlusion Remap Curve | Specifies the curve used to remap the occlusion of the flare. By default, the occlusion is linear, between 0 and 1. This can be specifically useful to occlude flare more drastically when behind clouds. |
| Volumetric Cloud Occlusion | When enabled, HDRP uses the volumetric cloud texture to occlude the lens flare. HDRP always considers the lens flare to be behind the volumetric clouds because it calculates occlusion in screen space. |
| Allow Off Screen | Enable this property to allow lens flares outside the Camera's view to affect the current field of view. |
Refer to the following for more information:

- [Lens Flare (SRP) reference](lens-flare-reference.md)
- [Lens Flare (SRP) Data Asset reference](lens-flare-asset.md)
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Lens flares references

Property descriptions for lens flares.

| Page|
|-|
| [Lens Flare (SRP) reference](lens-flare-srp-reference.md) |
| [Lens Flare (SRP) Data Asset reference](lens-flare-asset.md) |
| [Screen Space Lens Flare override reference](reference-screen-space-lens-flare.md) |
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Lens Flare (SRP) component reference

Refer to [Add lens flares](lens-flare-component.md) for information on how to use the Lens Flare (SRP) component.

## General

| **Property** | **Description** |
| --------------- | ------------------------------------------------------------ |
| Lens Flare Data | Select the [Lens Flare (SRP) Data](lens-flare-asset.md) asset this component controls. |
| Intensity | Multiplies the intensity of the lens flare. |
| Scale | Multiplies the scale of the lens flare. |
| Light Override | Specifies the light component Unity gets the color and shape values from, if you enable **Modulate By Light Color** or **Attenuation By Light Shape**. If you don't specify a light component, Unity uses the Light component from this GameObject. |
| Attenuation by Light Shape | Enable this property to automatically change the appearance of the lens flare based on the type of light you attached this component to.<br/>For example, if this component is attached to a spot light and the camera is looking at this light from behind, the lens flare is not visible. <br/>This property is only available when this component is attached to a light. |
| Attenuation Distance |The distance between the start and the end of the Attenuation Distance Curve.<br/>This value operates between 0 and 1 in world space. |
| Attenuation Distance Curve | Fades out the appearance of the lens flare over the distance between the GameObject this asset is attached to, and the Camera. |
| Scale Distance | The distance between the start and the end of the **Scale Distance Curve**.<br/>This value operates between 0 and 1 in world space. |
| Scale Distance Curve | Changes the size of the lens flare over the distance between the GameObject this asset is attached to, and the Camera. |
| Screen Attenuation Curve | Reduces the effect of the lens flare based on its distance from the edge of the screen. You can use this to display a lens flare at the edge of your screen |

## Occlusion

| **Property** | **Description** |
| --------------- | ------------------------------------------------------------ |
| Enable | Enable this property to partially obscure the lens flare based on the depth buffer |
| Background Clouds | When enabled, the occlusion is attenuated by background clouds and volumetric clouds. |
| Occlusion Radius | Defines how far from the light source Unity occludes the lens flare. This value is in world space. |
| Sample Count | The number of random samples the CPU uses to generate the **Occlusion Radius.** |
| Occlusion Offset | Offsets the plane that the occlusion operates on. A higher value moves this plane closer to Camera. This value is in world space. <br/>For example, if a lens flare is inside the light bulb, you can use this to sample occlusion outside the light bulb. |
| Occlusion Remap Curve | Specifies the curve used to remap the occlusion of the flare. By default, the occlusion is linear, between 0 and 1. This can be useful to occlude flare more drastically when behind clouds. |
| Allow Off Screen | Enable this property to allow lens flares outside the Camera's view to affect the current field of view. |

Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Lens flares

Lens flares simulate the effect of lights refracting inside a camera lens. Use lens flares to represent bright lights, or to add atmosphere to a scene.

|Page|Description|
|-|-|
| [Choose a lens flare type](choose-a-lens-flare-type.md) | Understand the differences between lens flares and screen space lens flares. |
| [Add lens flares](lens-flare-component.md) | Use the Lens Flare (SRP) component to create lens flares for lights that have specific locations in your scene, for example bright bulbs. |
| [Add screen space lens flares](Override-Screen-Space-Lens-Flare.md) | Use the Screen Space Lens Flare override to create lens flares for emissive surfaces, bright spots in your scene that appear depending on the camera view, and all onscreen lights. |
| [Lens Flare (SRP) reference](lens-flare-srp-reference.md) | Reference for the Lens Flare (SRP) component. |
| [Lens Flare (SRP) Data Asset reference](lens-flare-asset.md) | Reference for the Lens Flare (SRP) Data Asset. |
| [Screen Space Lens Flare override reference](reference-screen-space-lens-flare.md) | Reference for the Screen Space Lens Flare override. |
Loading

0 comments on commit fee8732

Please sign in to comment.