3.9 KiB
Convert lighting and shadows
HDRP uses physical Light units to control the intensity of Lights. These units don't match the arbitrary units that the Built-in render pipeline uses.
For light intensity units, Directional Lights use Lux and all other Light types can use Lumen, Candela, EV, or simulate Lux at a certain distance.
To set up lighting in your HDRP Project:
-
To add the default sky Volume to your Scene and set up ambient lighting go to GameObject > Volume > Sky and Fog Global Volume.
-
Set the Environment Lighting to use this new sky:
- Open the Lighting window (menu: Window > Rendering > Lighting Settings).
- In the Environment tab, set the Profile property to the same Volume Profile that the Sky and Fog Global Volume uses.
- Set the Static Lighting Sky property to PhysicallyBasedSky.
- Optionally, if you don't want Unity to re-bake the Scene's lighting when you make the rest of the changes in this section, you can disable the Auto Generate checkbox at the bottom of the window.
-
Currently, the shadows are low quality. To increase the shadow quality:
-
Create a new Global Volume GameObject (menu: GameObject > Volume > Global Volume) and name it Global Settings.
-
To create a new Volume Profile for this Global Volume:
- Open the Global Volume's Inspector window and go to the Volume component.
- Go to Profile and select New.
-
To add a Shadows override:
- Go to Add Override > Shadowing > Shadows.
- Enable Max Distance.
- Set Max Distance to 50.
-
-
Configure your Sun Light GameObject.
- Select your Light GameObject that represents the Sun in your Scene to view it in the Inspector.
- Go to Emmision and set the Intensity to 100000.
- Set Light Appearance to Color.
- Set Color to white.
- To see the sun in the sky, go to Shape and set Angular Diameter to 3.
-
The Scene is now over-exposed. To fix this:
- Select the Global Settings GameObject you created in step 3.
- Add an Exposure override to its Volume component (menu: Add Override > Exposure).
- Enable Mode and set it to Automatic.
- To refresh the exposure, go to the Scene view and enable Always Refresh.
-
HDRP supports colored light cookies, whereas the Built-in light cookies use a texture format that only contains alpha. To correct the Light cookie:
- In the Project window, select your Light cookie from your Assets folder.
- In the Inspector, change the import type from Cookie to Default.
- Set the Wrap Mode to Clamp.
-
Correct spot lights:
- In the Hierarchy, select a Spot Light and view the Light component in the Inspector.
- Go to Emission and set Intensity to 17000 Lumen to represent two 8500 Lumen light bulbs.
- In the Emission, select the More menu (⋮) and enable additional properties.
- Enable Reflector checkbox. This simulates a reflective surface behind the spot Light to adjust the visual intensity.
-
Make the light bulb Material emissive:
- In the Project window, select Assets/ExampleAssets/Materials/Lightbulb_Mat.mat.
- In the Inspector, go to Emission Inputs and enable Use Emission Intensity.
- Set Emissive Color to white, and set the Emission Intensity to 8500 Luminance.
-
If you disabled Auto Generate in step 2, go to the Lighting window and press the Generate Lighting button. You can also re-enable Auto Generate.