Unity’s High Definition Render Pipeline (HDRP) Lighting allows you to enhance your project’s visual appeal with ease. This new architecture is focused on performance while bringing a new level of quality to your Scene.
In this tutorial, you'll learn how to create a new project or upgrade an existing project using HDRP. You'll also learn how to configure the settings of HDRP Lights to bring a believable atmosphere to your Scenes.
Introduction to High Definition Render Pipeline Lighting
What is HDRP Lighting?
Unity’s High Definition Render Pipeline (HDRP) Lighting allows you to enhance your project’s visual appeal with ease. It uses a hybrid of Deferred and Forward Rendering Paths along with Tile and Cluster Renderers that allow the lighting to scale better than if you’re just using Unity’s built-in Rendering.
HDRP comes with a new lighting architecture as it uses a hybrid of Deferred and Forward Rendering Paths along with Tile and Cluster Renderers. This combination means lighting scales better than if you’re using the built-in Unity Rendering. This new architecture is focused on performance while bringing a new level of quality to your Scene.
HDRP comes with new light properties and a new light editor that allows you to do things like fade the light, affect only diffuse or specular lighting, and use color temperature to set the lighting color. With HDRP, you can control the inner angles and shapes of Spot Lights. HDRP also supports colored cookies and allows the use of real-time area lights.
Note: HDRP removed the Built-in Unity ‘Gamma Mode’ and uses the precise ‘Linear Mode’.
And it’s now possible to use oriented bounding box or sphere shape, proxy shape, and influence shape to change how the light probes read, collect, and bake out the lighting information, which allows for more precise lighting.
Creating a new project with HDRP
To start a new project with HDRP:
Open the Unity Editor and click the New Project button.
In the Template dropdown menu, select “High-Definition RP (Preview)” (Figure 02).
Click the Create Project button.
Once that’s done, your new Unity Project with HDRP will be ready to go.
Upgrading an existing project to use HDRP
To upgrade an existing project, you must first download HDRP using Unity’s Package Manager.
Go to the Window dropdown and select Package Manager to open the Packages Window (Figure 03).
Click on the All button on the left .
Find Render-pipelines.high-definition in the list and select it.
After the package has been installed, add the HDRP Asset to the Scriptable Render Pipeline Graphics settings field:
Go to Edit > Project Settings > Graphics.
In the Graphics Inspector, drag and drop the HDRenderPipelineAsset into the Scriptable Render Pipeline field (Figure 04).
You can now use HDPR with your existing project.
HDRP Light Settings
With HDRP, the Light Component — which controls the shape, color, and intensity of the light and whether the light will cast shadows in your Scene — comes with some more advanced settings.
To pull up the Light component window:
Go to the GameObject dropdown and select Light > Point Light to add a new light to your Scene.
Ensure the new Point Light you created is selected.
Go to the Inspector window and expand all the hidden fields.
Toggle the Show Additional Settings button under Features (Figure 05).
As you can see, there are quite a few settings. We’ll break this down into bite-sized chunks, beginning with the Features Section.
Use this section to enable or disable shadows and show additional light settings.
Shadows: This toggle allows you to create shadows.
Show Additional Settings: This toggle displays additional settings in the Light Component. Use this option if you need to fine-tune your light beyond the standard settings.
Use the Shape section to change the shape of your light.
Type: Use this dropdown to select the shape of your Light. You can choose from the following: Directional Lights, Point Lights, Rectangle, Line, and Spot. When selecting a light, it’ll add/remove settings for each specific light type.
Directional Lights will not have any additional settings to adjust.
Point Lights include the Range and Max Smoothness properties. Range determines how far the light will reach, while Max Smoothness determines the aspect of the specular highlight in order to mimic an area light. This allows you to avoid very sharp specular highlights that don’t match the shape of the light source.
Spot Lights include Range, Shape, Spot Angle, Inner Percent, and Max Smoothness. Shape determines the shape of your Spot Light. Spot Angle determines the angle of the light. Inner Percent determines where the attenuation between the inner cone and the outer cone starts. Higher values will cause the light at the edges of the Spot to fade out, while lower values will prevent the light from fading at the edges. When the Spot Light Shape is set to Pyramid, the Inner Percent changes to Aspect Ratio, which adjusts the shape of the Pyramid Spot Light. If the Shape is set to Box, Inner Percent and Spot Angle are replaced with Size X and Size Y, which determines the size of the box or rectangular light being emitted.
Line Lights have Range and Length. Length determines the length of the Line Light.
Rectangular Lights will have Range, Size X, and Size Y properties.
Color Temperature Mode: Check this box to adjust the color of your light based on a red to blue temperature scale.
Color: Determines the color of the light.
Intensity: Determines the Intensity of the light expressed in unit. The further the light travels from its source, the more it diminishes.
Indirect Multiplier: . A value of 1 applied to indirect lighting mimics a realistic light behavior. A value of 0 disables bounced lighting.
Range: Determines the distance from the light source to how far the lighting will be evaluated.
Mode: Determines if and how a light is “baked.” Possible modes are Realtime, Mixed, and Baked.
Cookie: Specify a RGB Texture that the light will project (for example, to create silhouettes or patterned illumination). Texture shapes should be Texture 2D for Spot Lights and Texture Cube for point lights.
Size X / Size Y (Directional light only): Use this to define the projection size of the cookie texture.
Additional Light Settings Section
Affect Diffuse: This enables/disables diffuse lighting.
Affect Specular: This enables/disables specular lighting.
Fade Distance: This determines the distance at which the light will fade out.
Dimmer: Use this to dim the light without changing the intensity. You can also adjust this setting with the timeline, scripting, or animation.
Volumetric Dimmer: Dims the light like the Dimmer but is used for the volumetric lighting.
Apply Range Attenuation: This doesn’t show on directional lights, but is used to enable range fade on the light. This is useful when the range limit is not visible on the screen.
Use the following settings to adjust the way shadows appear in your scene from the selected Light.
Resolution: Use this to set the resolution of the shadows cast by this light.
View Bias Scale: This is a multiplier applied to the shadow bias depending on the distance to the light.
Near Plane: Use this to set the distance from the light at which objects start casting shadows.
Baked Shadow Radius: This works for Mixed and Baked lights only. This adjusts how the shadows are rendered. High values in this field result in shadows that soften with distance.
Non Lightmapped: Toggles the light to exclude it from the lightmap.
Additional Shadow Settings Section
Enable Contact: Enables contact shadows for this light.
Fade Distance: Determines the distance at which shadows will fade out.
Dimmer: Dims the shadows cast by this light. Much like the Light Dimmer, this can be adjusted through scripting, timeline, or animation.
View Bias: Determines the minimum shadow bias in view space.
Normal Bias: Determines the shadow bias applied along the surfaces normal.
Edge Leak Fixup: Tick this box to apply a fix that helps prevent the light from leaking at the edge of the shadows.
Edge Tolerance Normal: Tick this box to use Edge Leak Fix in normal mode. Untick to use it in view mode.
Edge Tolerance: Use this to set the threshold that determines whether to apply Edge Leak Fixup.
The HDRP offers many new features and options that bring that AAA lighting to your projects. It’s important to understand how the light component is more robust than before to really bring that believable atmosphere to your scenes. HDRP also gives you much more control over light behavior within each Scene.