watchOS With SwiftUI by Tutorials!

Build awesome apps for Apple Watch with SwiftUI,
the declarative and modern way.

Home Unity Tutorials

Improving Game Visuals with Unity’s HDRP

Improve your game visuals and take them up by several notches using the High Definition Render Pipeline from Unity.

5/5 1 Rating

Version

  • C# 7.3, Unity 2020.3, Unity

Lighting can make all the difference in a game’s mood. From a sunny summer beach scene to a creepy haunted castle, a scene’s lighting sets the tone and gives users subtle visual cues about the setting. In this tutorial, you’ll begin exploring Unity’s High-Definition Render Pipeline (HDRP). Aimed at graphic realism, HDRP lets you configure rendering and post-processing with C# scripts. It’s part of the Scriptable Render Pipeline, first introduced in Unity 2018.

Getting started with HDRP, however, doesn’t actually require any scripting per se. Its pre-built components can deliver high-quality visuals without writing a line of code.

In this excercise, you’ll learn how to use HDRP and its Volume framework to:

  • Work with the Volume framework.
  • Use physically based skies.
  • Add post processing effects.
  • Work with lighting and global illumination.

In a few steps, you can transform some simple geometry into a rendered level and add some flair to your game visuals.

Get ready to paint with light!

RW logo lit from behind on a concrete wall

Note: Use Unity 2020.3 or newer to follow this tutorial. You should have basic familiarity with the Editor before exploring HDRP’s lighting features. Some familiarity with Unity’s lighting could also be of help.

Since HDRP targets graphical realism, it’s important to ensure you use a compatible machine to build this project. We’ve observed that the scenes appear darker than normal (especially the Daylight scene in this tutorial) on certain machines that aren’t compatible.

Getting Started

Download the project materials by clicking Download Materials at the top or bottom of the tutorial.

Now, extract the zip file to a convenient location. After extracting, you’ll notice Starter and Final project folders. Feel free to explore these projects to familiarize yourself with them. Once ready, open the HDRPBlocks-Starter project in Unity.

Project Structure showing the assets

Note that this project includes the Default HDRP Template. Every time you use the Unity Hub to create a new HDRP project, Unity begins with a few default folders under Assets to help get started:

  • HDRPDefaultResources: This includes some default and fallback assets to set up the pipeline.
  • Scenes: This contains the template’s SampleScene.
  • SampleSceneAssets: This includes assets used in that scene.

Your project will use a few of the materials and meshes from these folders, so leave them intact.

All the custom assets you’ll need for this tutorial are inside the RW folder:

  • Materials: This contains some modified versions of the template materials.
  • Meshes: This folder contains simple geometry for the level.
  • Prefabs: Use these pre-built GameObjects to save setup time.
  • Scenes: Save your scene files here.
  • Settings: These assets contain lighting and rendering settings.

Load the Start scene from the RW/Scenes folder. You’ll use this scene as a template to create other scenes for you to work with.

the starting scene view

Once open, use File ▸ Save As to save this scene as a new scene called Daylight. Remember to save it within the RW/Scenes folder to keep your project organized.

Daylight scene position in project structure

Exploring the Level

Now that you have the Daylight scene, it’s time to explore its contents.

First, the Hierarchy includes PlayerControllerFPS, which allows you to move around the level.

Lighting contains — you guessed it — the lights and lighting props used in the scene! It has one Directional Light and a bunch of CeilingSpotlights.

Expose the child objects under Level.

  • The main environment and its meshes are the children of Building.
  • Props contains several pieces of decorative set dressing from the SampleSceneAssets template.
  • LevelCollider confines the player controller to this one room to keep things simple.

components of the Daylight scene

Now, enter Play mode to explore the level yourself. Use the standard mouse movement and WASD keys to aim and translate the player. The environment consists of several gray cubes assembled to form a single room.

concrete room with stairs and two columns

What is this house?

[spoiler title=”Reveal”]
The inspiration for this level is Hanasaki House, a custom-built home in Japan. Its minimalist architecture makes the most of light and simple forms, perfect for your first foray into HDRP.
[/spoiler]

While the building blocks are present in the scene, the level looks drab. Too much uniform light makes the geometry appear “flat.” The meshes lack the shadows and highlights to create the illusion of 3D form. They need something to accentuate depth and dimension. They just look like dull grey cubes.

To lighten up the mood and breathe some life into the level, you’ll add some HDRP into the mix.

Understanding HDRP

The High-Definition Render Pipeline targets high-end platforms like consoles and PCs. As the name implies, it’s a rendering pipeline. It consists of three parts:

  • Culling: Determining what GameObjects to render on-screen.
  • Rendering: How to draw those same objects.
  • Post-processing: What effects to apply to the camera after rendering.

HDRP stores its settings in a Pipeline Asset saved within the project. Create one in the project using right-click ▸ Create ▸ Rendering ▸ High Definition Render Pipeline Asset. Don’t worry about changing it’s name.

However, the standard template already includes several working Pipeline Assets. Locate them under Edit ▸ Project Settings ▸ Graphics.

HDRP graphics settings under project settings menu

In the Graphics tab, the Scriptable Render Pipeline Settings contains the default pipeline asset. Locate DefaultHDRPAsset in the project window and check it in the Inspector. These settings modify how Unity renders and post-processes the scene.

Inspector view for Default HDRP Asset

Whew, that’s a lot of settings!

The Scriptable Render Pipeline offers far greater flexibility than the built-in render pipeline. However, this means that it contains many different settings to fine-tune your visuals. Since this tutorial is to help you get started with HDRP, you can leave most of these settings as-is.

Inspect the other pre-built pipeline assets in SampleSceneAssets/Settings. You can see assets for multiple graphics qualities, allowing you to cater to a wide range of devices.

HDRP assets

To begin, in the Graphics tab, switch Scriptable Render Pipeline Settings to HDRPHighQuality.

Various default HDRP quality settings in the Project

You can also see them in Project Settings under the Quality tab. Choosing a Quality Level switches the active pipeline asset. Keep High Quality selected.

Quality tab under Project Settings Menu with High Quality selected

At this point, there’s no need to modify the other individual dropdowns and fields. You’ll simply work at a macro level and swap between high, medium or low quality settings.

Adding Some Visual Flair

Going back to the Daylight scene, notice that a single Directional Light under Lighting is active. Rename it Sun_DirectionalLight.

Renamed directional light object

Now, swing the light direction, so it enters from the window to the right. Adjust the rotation to (X: 27, Y: -79, Z: 0).

Turn on the light’s shadows. Check Enable under the Shadows component.

Shadow map enabled and resolution set to ultra in the Shadows tab for the light

To improve the shadow map resolution, switch the Resolution to Ultra. The shadow edges sharpen and become less blurry.

Raking the shadows across the concrete blocks makes for a more dynamic composition. Diagonal lines help draw the viewer’s eye into the scene.

room with beams of light entering from the upper right

Understanding Environment Lighting

Currently, the scene has a bluish cast. This stems from some existing environmental lighting. In the Scene view, three main colors represent the outer boundaries of the world:

  • A dark earthy ground color
  • A brighter, white horizon
  • A blue sky

The source of the color is DefaultHDRISky inside HDRPDefaultResources.

Preview of the default HDRI

Double-click the image to open a preview. It consists of six smaller 128 × 128 images, stitched into one larger 768 × 128 EXR file. EXR is a high-dynamic range format. It contains a wider range of color and contrast than a typical image file.

How do you generate an HDRI?

[spoiler title=”How do you generate an HDRI?”]
Changing effects to an image as its exposure is modified

A high-dynamic range image, or HDRI, merges several exposures from a digital camera into a special file format. The resulting image contains detailed information about the actual lighting conditions when photographed. Unity can then use this HDRI to approximate the environment lighting in your scene.

Want to shoot your own HDRIs? Follow these guidelines.

If you don’t want to make your own, Unity also provides an excellent HDRI Pack in the Asset Store to help you get started.

HDRI image with rocks on the ground and blue sky

Many sites like HDRI Haven also offer free or low-cost HDRIs suitable for use within Unity.

[/spoiler]

The Texture Shape is set to Cube in the Import Settings.

Texture Shape of the Default HDRI is set to Cube

Unity basically unwraps the cubemap and projects it onto the interior of a sphere. Drag the preview window to rotate the projection. Adjust the -/+ slider to visualize the bracketed exposures.

Preview of the Default HDRI

This HDRI sky sphere creates the illusion of the ground, horizon, and sky.

HDRI map used in scene by Unity to give an effect of ground, horizon and sky

During the rendering process, light rays bounce around the world. Some of these rays return and strike the scene geometry. Each such reflection transfers a little bit of color from the HDRI sphere. This environment lighting and reflection creates the general bluish tint.

In this particular case, you’ll swap out the default HDRI to change the ambient color.

Adding a Sky and Fog Volume

Now, you’ll add some realism to the level using the Volume framework.

Understanding the Volume Framework

Unity uses the Volume framework to control aspects of the pipeline. An active Volume currently works as the default source of environment lighting.

Default Volume Profile Asset selected in the HDRP Default Settings tab

Return to Edit ▸ Project Settings and locate the HDRP Default Settings tab. The Default Volume Profile Asset is set to VolumeGlobal.

Click New to create a custom Volume profile. This generates an asset called DefaultVolumeSettingsProfile, which is added to the HDRPDefaultResources folder.

Scene view after a new volume profile is created

In the Scene view, the colored HDRI environment disappears. The Game view, meanwhile, becomes extremely stark. It’s completely black and white, lit only by the direct rays from Sun_DirectionalLight.

Surfaces in the path of direct sunlight turn white. The light doesn’t bounce and scatter as you would expect in real life.

The current direct lighting strikes a surface and stops. Without indirect or bounced lighting, everything just looks unnaturally black.

Game view after adding a new volume profile

You can fix that with some environment lighting.

Right-click in the Hierarchy to create a Volume ▸ Sky and Fog Volume. Now everything turns bright white. Don’t panic! This is just temporary. Parent this to the Lighting transform to stay organized.

Scene hierarchy after creating a new Sky and Fog Volume

It’s hard to see anything, so adjust the light intensity as a stopgap fix. Select the Sun_DirectionalLight. Find the Light component and locate Emission. Drag the Intensity down to something small, like 40 lux.

The blue cast disappears. The Game view now sports a warmer ambient light.

room with a brownish tone and light entering from the upper right

In the Scene view, the surrounding world changes color. The ground turns into an earthy yellow-brown, while the sky becomes a silvery light blue.

exterior view of building with light settings from the previous image

Understanding Overrides

Select Sky and Fog Volume. The Volume component allows you to influence the camera render with a series of overrides. Each override controls one part of the pipeline, giving you fine-level control of the rendered output.

Note that the Mode is set to Global. This means the component affects the entire scene. Weight and Priority help decide priority when more than one Volume is active.

Overrides tab for Sky and Fog Volume

Nested below the Volume component are three overrides:

  • Visual Environment: This override determines what type of sky appears in the background. The default is Physically Based Sky, a procedurally generated environment. You can also choose a simple Gradient color or replace this with a photographed HDRISky.
  • Physically Based Sky: This override simulates light dispersing through the atmosphere. It reproduces both Rayleigh and Mie scattering.
  • Fog: This recreates thick, cloudy air that hangs close to the ground. The fog density attenuates as it rises upward and moves away from camera.

Unity stores all the Volume overrides in a Profile asset. Be careful! Any changes you make are saved immediately to disk.

Select the Sky and Fog Settings Profile in the project window. This is located in the RM/Scenes/Daylight folder.

Rename it to Day Settings Profile. You can have more than one Profile in the same scene. Name each one descriptively to tell them apart.

Now, modify the current Profile to the Day Settings Profile.

Updated Volume profile to Day Settings Profile

Setting the Physically Based Sky

Override the Type in the Visual Environment to Physically Based Sky. Leave Ambient Mode unchecked for now.

Setting the Sky type to Physically Based Sky under Visual Environment

Inside the Physically Based Sky Override, select Earth (Simple) for the Type. This reduces some of the sky settings, which won’t all be necessary here.

Modified Settings for Physically Based Sky

Click the checkbox next to Ground Tint. Select different hues around the perimeter of the color wheel.

Check the boxes next to Horizon Tint and Zenith Tint. Then experiment with the colors to see how they influence the camera.

building exterior with light yellow background

Try these values to give the scene a warmer golden tone:

  • Ground Tint: (R: 200, G: 145, B: 45)
  • Horizon Tint: (R: 200, G: 200, B: 200)
  • Zenith Tint: (R: 170, G: 210, B: 255)

You can also experiment with Sea Level to shift where the ground meets the horizon. Likewise, adjust the Horizon Zenith Shift to move where the horizon blends with the zenith.

Keep the Scene view open to help you visualize the color modifications. As you adjust the color pickers, the surrounding world adjusts to match.

Game view with Physically Based Sky being toggled

The sky environment impacts the indirect light in the scene. Toggle Physically Based Sky off and on again to see the difference.

Setting Exposure and Light Emission

Changing the exposure and light emission settings can have a dramatic effect on your scene.

Understanding Exposure

You’re currently using some physically incorrect values for the sake of visualization. HDRP works much better when you respect real-world exposure and light intensity.

Exposure value in photography follows a logarithmic scale. The formula relates a camera’s shutter speed and its f-stop/aperture:

formula for exposure value

In this formula:

  • N is the f-number.
  • t is the shutter speed in seconds.
Note: Here are some common exposure settings:
  • 0 EV: Moonless night
  • 3.0 EV: Moonlit scene
  • 6.0 EV: Interior scene
  • 8.0 EV: Exterior sunset/sunrise
  • 12.0 EV: Cloudy exterior
  • 15.0 EV: Sunny exterior

Set an accurate exposure value to render the image. With the Sky and Fog Volume selected, click Add Override below the Volume component. These menu items represent all the possible overrides for this Volume.

Select Exposure. In Exposure Override, change the Mode to Fixed.

Follow the checkmarks on the Fixed Exposure slider for reference. Adjust it to a value of 11.

Mode set to Fixed and Exposure set to 11

The current lighting intensity doesn’t match real-world conditions, so the game camera goes dark. You’ll need to bring the light up to the level of sunlight.

Understanding Light Emission

Select Sun_DirectionalLight. In the Emission group, the Intensity of a directional light uses lux. This standard unit of illuminance records how much light falls over a surface area.

Following the guide marks on the slider, choose a physically accurate value. Set the Intensity to a really bright 130000 lux.

HDRP uses physically accurate Kelvin temperatures to set the light’s color.

To mimic the afternoon sun, set the temperature roughly to 6500 Kelvin. The level turns warm and golden.

Updated intensity under light emission

warm light game view

Adding More Volume Overrides

With the sunlight serving as the primary light, or key light, it’s time to start adding more overrides.

Select Sky and Fog Volume. Check Add Override. Use the following menu items, overriding a few fields:

  • Post-processing ▸ Tonemapping: This maps the high-dynamic range values into viewable, low-dynamic screen colors. Set Mode to ACES. ACES uses the same algorithm featured in film and television. It shows higher contrast than Neutral with more saturated colors.
  • Tonemapping settings

  • Post-processing ▸ Color Adjustments: This provides additional controls for contrast, color and saturation tweaks. Increasing the Contrast makes the blacks blacker and the whites whiter. Decreasing the Saturation — reducing the intensity of the colors — is a popular look for certain games. Set the Contrast to 10 and the Saturation to -20.
  • Color adjustment settings

  • Post-processing ▸ Bloom: Use this to add glowing fringes around bright light sources. Only pixels brighter than the Threshold receive the effect. Increase the Intensity to strengthen the visible glow. Set the Quality to Medium, Threshold to 0.95, Intensity to 0.25 and Scatter to 0.71.
  • Bloom settings

  • Post-processing ▸ Shadows, Midtones, Highlights: Use these settings for finer control of the dark, medium and light pixels in the final render.

    Dial down the Shadows slightly by setting its Y value to -0.3, lift the Midtones by modifying its Y value to -0.15 and increase the Highlights by changing its Y value to 0.2. This makes for a bold, high-contrast look. If you don’t see a UI interface similar to that below, just increase the Inspector window size to reveal it.

  • settings for Shadows, Midtones, Highlights

    And here’s how these settings will affect the Game view:

    Cumulative effect of the previous settings being applied, cycling through different lighting conditions

  • Lighting ▸ Ambient Occlusion: This helps darken cracks and crevasses. Though not physically accurate, it can help accentuate certain details. Using these example values helps darken the cubicles in the bookshelf, for example.
  • Ambient occlusion settings

    Ambient occlusion being toggled, with bookshelves lightening and darkening

Now that you’ve learned about these overrides, try toggling each override off and on to review its effect on the Game view.

Setting Lightmapping and Global Illumination

To further improve the look of the scene, use global illumination (GI), a set of techniques that model the physical behavior of light. During global illumination, you bake the lighting into a special texture called a lightmap.

Understanding Global Illumination

For global illumination, each mesh must have:

  • Contribute GI marked in MeshRenderer.
  • A set of non-overlapping UVs. Unity can generate these automatically upon import.

Confirm this for yourself. Inspect the child objects under Building. Note how each MeshRenderer has Contribute Global Illumination checked. Receive Global Illumination should be set to Lightmaps.

Contribute GI and Receive GI for a mesh

You can also enable this from the Static menu in the top-right of the Inspector.

Contribute GI option checked in the static menu

In RW/Meshes, under the Model tab, each model geometry has Generate Lightmap UVs enabled in Import Settings.

Generate Lightmap UVs checked under Model menu for the models

Depending on the complexity, each lightmap could require several minutes to many hours to calculate. Once baked, however, playback is quite performant. Thus, your app can display high-quality GI lighting while retaining a good frame rate.

To enable lightmapping, select Sun_DirectionalLight. Switch the Mode to Mixed. The light works in Realtime for dynamic objects and Baked mode for static objects.

Light mode changed to Mixed

Select Sky and Fog Volume. Override Ambient Mode in Visual Environment to Dynamic. This allows the baking process to use the Physically Based Sky for ambient light.

Ambient mode set to dynamic for the light

The scene will temporarily become very bright, but ignore it for the moment.

room lit much more brightly than before

Go to Window ▸ Rendering ▸ Lighting.

The Lighting Settings saves your settings to an asset on disk.

Choose one of the assets provided with the project, like LightingSettings2Medium. Alternatively, create your own using New Lighting Settings.

Modified Lighting Settings highlighted

Baking Lightmaps

Use the following Lightmapping Settings:

  • Lighting Mode: Choose Baked Indirect. Unity bakes bounced lighting into lightmaps for static objects. Moving objects continue to receive real-time lighting and cast shadows.
  • Lightmapper: Use Progressive GPU (Preview) for hardware-accelerated lightmapping. This can reduce your bake times dramatically. Use Progressive CPU if your machine doesn’t meet the requirements for the GPU Lightmapper.
  • Direct Samples / Indirect Samples / Environment Samples: 50 / 250 / 50: These determine how many rays to use for lighting calculations. The higher the samples, the more accurate the results but the longer the bake times.
  • Lightmap Resolution: 40: This specifies the number of texels, or texture elements, per unit. Larger values mean higher quality and longer bake times.
  • Lightmap Padding: 5: This is the spacing between different shapes in the lightmap. Large values can reduce bleeding when lighting from one part of the mesh incorrectly appears on a different part.
  • Directional Mode: Directional: When using Directional, a second lightmap stores the general direction of the key light. This is useful with normal-mapped materials.
  • Lightmap Parameters: Default-Medium: These determine some preset quality settings for lightmap generation.

Click Generate Lighting. This begins the lightmap baking process.

If you have good graphics hardware, the GPU-accelerated lightmapping should take just a few seconds. If you need to use your CPU instead, the GI calculations may run for several minutes.

Watch the progress bar in the lower-right corner.

baked lightmaps for the scene

When the process completes, the brightness level in the Game view returns to normal. Lighting bakes into the surfaces of each static mesh.

Switch to the Baked Lightmaps tab to view the actual maps. Click Open Preview to see the image in closer detail.

preview of baked lightmaps

Debugging the Render Pipeline

Changes to your lighting may be hard to troubleshoot. Thus, HDRP includes a debugging tool to help you dissect the rendered frame.

Go to Window ▸ Render Pipeline ▸ Render Pipeline Debug.

Select the Lighting tab. Locate Debug Mode.

lighting debug mode

Watch the Game view as you toggle modes in the dropdown.

toggling Game view as different debug modes are selected

Some terms may be useful here:

  • Diffuse light contacts a rough material and scatters. This forms the basis of a surface’s color.
  • Specular light hits a smooth or shiny material. The light rays form highlights as they reflect back toward the camera.
  • Direct light travels from the light source to the surface.
  • Indirect light is bounced light. Global illumination calculates how light rays physically react to the surfaces along their path.

The effect of indirect light can be subtle. It’s essential, however, for that extra touch of realism.

Sometimes it’s hard to tell the source of a lighting issue. Is it the result of global illumination? Is it just a reflection? The answer may not be obvious. The Debug Pipeline tool can help you investigate. Keep it handy in your bag of tricks!

Set your Debug Mode back to None. Then, close this dialog for now.

Adding Volumetric Fog

To make the scene slightly more dramatic, add fog, which makes the atmosphere visible and dense.

Understanding Volume Settings

To begin, in Sky and Fog Volume, locate the Fog Override.

Fog override for sky and fog volume

Check Enable. Set the starting Base Height at 0 and fade the fog off at a Maximum Height of 3.

Set the Fog Attenuation Distance to 20 units. Smaller values make it dense and thick. Larger values make it dissipate more gradually.

Check Volumetric Fog. This creates the illusion of light shafts or “god rays.”

Override the Denoising Mode to Both. This will produce high quality results when removing noise from the fog, but will be more resource intensive.

Understanding Light Settings

Scene view with volumetrics, bright light entering room

Select Sun_DirectionalLight. The Light component has a group of parameters called Volumetrics. To exaggerate the effect, override the Multiplier. Then, drag the slider to 16. The volumetric fog appears much stronger.

Enter Play mode to check how the level feels in first-person. Turn right to face the windows, and strafe side-to-side. Light shafts stream through the windows.

level with volumetrics, light ray entering through window

The Shadow Dimmer controls the strength of the volumetric shadows. A value of 0 makes the shadow invisible and fills the entire room with conventional fog. Use a value of 1 to cut out a volume based on the window openings. This just leaves the light shafts themselves. An in-between value blends how strongly the volumetric shadow affects the cutout.

Toggling Scene view with various values of Multiplier and Shadow Dimmer, room getting brighter and dimmer

Experiment with the Multiplier and Shadow Dimmer until you achieve your desired look. This example shows values of 2 and 0.95, respectively.

view panning around the room with light coming in the windows

You can also select Sky and Fog Volume to adjust the volumetric fog.

Adding Lights

You may need to add lighting to accentuate the forms of the mesh. For example, you can throw a spotlight onto the steps to separate them from the shadowed back wall.

Scene view showing an added spotlight

Create a new Spot Light using right-click ▸ Light ▸ Spotlight. Rename it StairsFill_SpotLight and parent it to Lighting.

Set Mode to Baked. This light won’t cast shadows.

Use these values for the Transform:

Position (X: 1.3, Y: 1.5, Z: -0.38)
Rotation (X: 24.2, Y:-95, Z: 0)

Set Shape to Pyramid. In HDRP, you can use shapes other than a cone. In this case, the pyramid shape helps you accent the stairs without catching the wall.

Dial Spot Angle to 29 and Aspect Ratio to 0.4.

Keep the falloff Radius small at 0.1.

Push the color Temperature toward the blue end of the spectrum. Try 13000 Kelvin.

Dial the Intensity to about 20000 Lumen. Because key light is over 100,000 lux, this spotlight will need to be brighter than an average interior light.

Set the Range to about 6.

Light settings for spotlight with values

The effect is subtle, but this pops the stairs from the darkness.

Effects of the new spotlight. The stairs can be seen much more clearly

What are lumen, lux and candela?

HDRP uses physical light units to match the intensities of real light sources:

  • Lumen is a “unit of luminous flux.” This is the total amount of light emitted from a source. This is more accurate than wattage when judging a bulb’s brightness.
  • Lux is a measure of illuminance. This is the total amount of light falling on a surface.
  • Candela represents the intensity of one common wax candle.

Measuring illuminance varies by context. You can read lux with a handheld light meter. Lumens requires a more sophisticated goniophotometer.

When trying to recreate an actual light fixture, use the exact specifications from the manufacturer. HDRP will match its real-world intensity. With a factory IES profile, you can also match how a light spreads in real life.

With the layered effects and lighting settings in place, your level should be taking shape nicely now.

a room that is mostly dark with some light entering from the right side

Exploring a More Complex Scene

This scene, of course, represents a simple lighting example. Try another set of lights with the same environment.

Open the Start scene, and save it as Night, like before. Disable the Lighting object to turn off the existing lights.

From the RW/Prefabs folder, find and drag the Lighting Night prefab into the Hierarchy. Rather than relying on a single directional light for the key light, this setup uses spotlights and area lights.

Night scene with Lighting Night prefab added and Lighting disabled

The Sky and Fog Volume located in the Lighting Night prefab will use the Night Settings Profile in the RW/Settings folder.

The Game view suddenly appears bright and foggy. Disregard how the scene looks for the moment. Baking lightmaps will fix it.

Open the Lighting window. Swap the Lighting Settings to use LightingSettings4Ultra. Otherwise, the lightmapping may appear too blotchy. You might also want to flip the Max Lightmap Size to 2048 if not already set. This increases the Lightmap texture size for higher resolution.

lighting settings window

Then, click Generate Lighting.

Wait for the scene to bake. Lightmapping takes longer since the scene has more lights. Once complete, it’s literally the difference between night and day!

Night view of the room

Understanding the Light Explorer

Open Window ▸ Rendering ▸ Light Explorer. This dialogue helps manage large sets of lights.

Light Explorer showing various lights in the scene

Tip: Name your lights descriptively. A naming convention can help you find them in the Light Explorer.

For example, you can easily highlight the four CeilingLight_Spot_1600lm spotlights. Shift-select multiple lights to edit them at once. Then, adjust their color and temperature to your liking.

Walk the room with the FPS controller. Note these differences with the Daylight scene:

  • Area lights spill from the top and bottom staircase. They also form long, thin accents near the windows.
  • Blue and gold colors compliment one another. This borrows from traditional cinematic lighting.
  • The four spotlights on the ceiling cast volumetric shadows. Adjust their angles and multipliers to enhance their conical light shafts.

room with night lighting viewed from a different angle

Use the Light Explorer to tweak and rebalance light values. Don’t be afraid to experiment! Different settings can create a completely different mood and atmosphere.

Where to Go From Here?

You can download the completed project files by clicking Download Materials at the top or bottom of the tutorial.

This tutorial, of course, just scratches the surface of HDRP. To continue exploring this very deep pipeline, see the official documentation.

You can also open the HDRP template’s SampleScene, as seen below, from the Scenes directory. This showcases three distinct lighting setups with several HDRP workflows.

View from the SampleScene provided by Unity

Once ready, go back to the Night or Daylight scenes. Feel free to add some additional assets to fill out the bare room. Then, build a new lighting setup from scratch. Try your hand at designing with light!

Night scene spruced up with some custom props and some lights

With a little practice, you can channel your inner cinematographer. You might not look at a cube the same way again. :]

We hope you enjoyed this tutorial, and if you have any questions or comments, please join the forum discussion below!

More like this

Contributors

Comments