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. By Wilmer Lin.
Sign up/Sign in
With a free Kodeco account you can download source code, track your progress, bookmark, personalise your learner profile and more!
Create accountAlready a member of Kodeco? Sign in
Sign up/Sign in
With a free Kodeco account you can download source code, track your progress, bookmark, personalise your learner profile and more!
Create accountAlready a member of Kodeco? Sign in
Contents
Improving Game Visuals with Unity’s HDRP
35 mins
- Getting Started
- Exploring the Level
- Understanding HDRP
- Adding Some Visual Flair
- Understanding Environment Lighting
- Adding a Sky and Fog Volume
- Understanding the Volume Framework
- Understanding Overrides
- Setting the Physically Based Sky
- Setting Exposure and Light Emission
- Understanding Exposure
- Understanding Light Emission
- Adding More Volume Overrides
- Setting Lightmapping and Global Illumination
- Understanding Global Illumination
- Baking Lightmaps
- Debugging the Render Pipeline
- Adding Volumetric Fog
- Understanding Volume Settings
- Understanding Light Settings
- Adding Lights
- Exploring a More Complex Scene
- Understanding the Light Explorer
- Where to Go From Here?
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!
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.
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.
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.
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.
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.
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.
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]
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.
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.
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.
To begin, in the Graphics tab, switch Scriptable Render Pipeline Settings to HDRPHighQuality.
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.
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.