Why is everything dark in HDRP?

If you are new to the High Definition Render Pipeline (HDRP) then you may have noticed that the scene sometimes is way too dark or much too bright.

Pitch black shadows

If you create a new scene in an HDRP project then it will look like this:

The surfaces look somewhat okay but the sky is very dark and the shadows are pitch black. Why is that?

The first thing to understand is that HDRP does physically based rendering and thus the lighting tries to get as close as possible to reality.

In an empty space with only one directional light source (the sun) the shadows are very dark and so is the sky. So actually, the rendering above is correct if compared with nature. Look at this image from the moon for comparison (notice the dark shadows and sky).

Source: Public Domain

Now how do we get some earth-like lighting in our scene?

Light at the end of the tunnel

In preparation, I recommend you watch the "Exposure" section of this very nice video. It's a bit lengthy but it definitely is worth the watch. It explains a lot of the nuances in HDRP lighting.

Step 1: Add a volume

In HDRP lighting is volume-based. This means the lighting conditions can change based on where (inside which volume) the camera is. In order to control the lighting we need a volume and a volume profile.

In a new HDRP project there usually are some premade volume profiles. To learn and understand we will ignore those and make our own from scratch.

First, add a volume to the camera:

By default, the volume is a global volume. Change it to a local volume and add a collider (make the collider a trigger), like this:

We are not using a global volume because global volumes automatically affect the Scene View in the Editor and typically we do not want that to happen. It's just convenient to disable all the effects in the editor.

Whether or not a volume's effects are active depends on whether the currently rendering camera is inside the volume. In the game view the rendering camera is always the active camera object. In the scene view it's the independent scene view camera.

By adding the local volume (collider) directly to the camera object we ensure it's always active in the game view (the camera object is always inside the sphere collider). The trick is that the scene view camera usually is outside the local volume of the game camera object, hence no effects are applied in the scene view.

Step 2: Add a volume profile

Our new volume has no profile assigned and thus no changes are visible at the moment.

Hit the "new" button to create a new profile. Then press "Add Override" and choose "Exposure". Your setup should look like this:

If you turn the Mode on then you will notice that your game view suddenly became all white.

That's because your exposure is set to 0 (night) by default but your light intensity is set to 100 000 lux (bright daylight).

Exposure:

Source: Lighting & rendering tutorial for HDRP | Unite Now 2020

Light Intensity:

Source: Lighting & rendering tutorial for HDRP | Unite Now 2020

In order to get a proper image your exposure has to match the lighting conditions. For 100 000 lux an exposure of 12 or 13 would suffice, like this:

Now your game view should look like this:

Step 3: Fix the sky

To change the sky to something physically based we add another override (Visual Environment) and set the sky type to "physically based sky". Make sure the ambient mode is set to "Dynamic" so it updates properly (Source).

If you want to use the HDRI Sky then you need to add the HDRI Sky override and set the proper exposure, like this:

And that's it. If you chose and configure your exposure values according to your lights then you should get nicely lit scenes in HDRP.

Video Recommendation

Here is a nice video to deepen your understanding of lighting in digitally created scenes. This one is about Blender but the lessons also apply to Unity.

Asset Recommendations

I hope you liked this short introduction to HDRP lighting. Here are some assets I'd like to recommend.

Disclosure: This text may contain affiliate links, which means we may receive a commission if you click a link and purchase something that we have recommended. While clicking these links won't cost you any money, they will help fund this project! The links are created by Unity and Partnerize (Unity's affiliate partner).