Lights and Fog and in Unity’s HDRP

The lighting of a scene is really what sets the mood. Join me as I venture into the wonderful world of using lights and creating fog in Unity and the High Definition Render Pipeline.

The HDRP has the same directional, spot and point lights as the URP, only with some beautiful additions. Let’s get started by creating a new Area Light in the Hierarchy by navigating to Light>Area Light.

Here is a the default Area Light in the scene view. It is a small invisible square plane, projecting light downwards.

The Area Light has some really helpful options that come with the General, Shape, Emission and Shadows options.

The size of the Area Light can be adjusted in the scene view by dragging one of the four resize handles.

The General dropdown has Type option, where you can change your light from an Area Light to a Spotlight for instance. It also has a Mode option where you can select how you want your lighting information to update. Realtime, Mixed and Baked are all available.

The Shape dropdown has options to change the Area Light from a Rectangle, to a Tube (Realtime only), or a Disc (Baked only).

The Tube light is the perfect shape for a fluorescent bulb lighting setup.

Once you select the Tube option under Shape, the Length value will appear and can be adjusted.

The light on the floor and reflections on the wall are really what the HDRP is all about!

Let’s take a step outside and add a few Rectangular Area Lights on the façade of the building. The flowers in this scene have been updated to have a new emission map, which is great for some sci-fi environment telling about the magical world this lab is stationed on.

Ok, back inside with the a Rectangular Area Light. The Emission dropdown has some powerful features that are not to be overlooked. The Filter option can be used to select a color and tint the overall light color scheme. This can be seen a few images below with a Red Tint. The Temperature slider can be dragged back and forth to change the light from warm to cool, and vice versa.

Here is the Temperature adjustment.

Here is a Red Filter, and I actually have it turned down pretty low. You can really blast some light saturation with the Filter alone.

Unity has some absolutely creative icons when it comes to telling the developer what temperature relates to what kind of light. The candle icon represents the warmest temperature, which is measured in Kelvins. As you move from warm to cool, increasing in Kelvin units, the icon changes to incandescent and then fluorescent. After that you move into real world sunlight based icons.

The Intensity slider also begins with the candle icon, advances to bedroom lamp, interior light and eventually exterior light. All of these are based in Lumens.

The Shadows option let’s you choose if the light will cast shadows from objects in it’s path.

This gif shows a single Rectangular Area Light with the Enable shadows being toggled on and off. You can see the cast shadow under the desk appear and disappear.

The scene can really come to life when blending lights with emission channels. Because these columns are Prefabs, I can add two Area Lights to the front of the column facing outwards. This will enhance the emission channel by adding an actual light to the source!

Saving the Overrides on the Prefab will automatically update all column Prefabs in the scene with the lighting changes.

Now the columns are really starting to add some light to the game scene!

I move through the entire scene adding Area Lights to all of the remaining column and wall objects with white emissions. You can see the light Gizmos here for all of the new additions.

The game scene is getting quite reflective.

The stairs have a new emission channel, which is getting a small glow with the help of the Global Volume using a Bloom effect. We can’t having anyone trip and fall because the stairs are unlit can we?! Safety first…

The HDR Albedo channel is where you want to look when making big adjustments to the intensity of the object’s light emission. This reactor looks like it’s going to explode.

That’s better. It just needed a little maintenance.

Area Lights are added above the two item boxes so that the player more easily knows they are available. I would highly recommend picking up one of these pulse rifles, courtesy of Filebase by GamedevHQ (as are all of the assets in this game scene).

It’s time to go back outside and talk about environmental Fog.

Start by enabling or creating a Fog override and changing the Color Mode. I change from Sky Color to Constant Color. This is a desert scene anyways, so maybe a dust storm is brewing.

The horizon is already getting nice and foggy.

Let’s choose a bright saturated yellow just to see what this thing can do.

That’s a nice saturated warm horizon.

Time to bring the fog closer to the camera and game scene.

The Fog Attenuation Distance is a measure in meters, that tells how far you can see through the Fog based on it’s density. The Base Height can be lowered if you want your ground to be seen through some thick fog, for instance. The Maximum Height will keep the Fog from rising too high and blocking your background/ skybox. The Max Fog Distance is also measured in meters, and represents how far away in your game scene Fog will still be applied. Volumetric Fog can be enabled here as well. The Volumetric Fog Distance value has to do with the clipping plane of the camera. The lower the value, the better the Fog quality.

This fog is starting to look rather toxic.

Let’s reduce the Base Height to expose more of the ground through the fog.

That’s better.

It’s time to take leave of these glowing trees and see what we can do about some internal fog.

I bring in a Fog Prefab from GameDevHQ’s Filebase. The Shader is not ready for the HDRP, so let’s change it to be Sprites/Default.

Now some too obvious looking smoke appears in the scene.

The Alpha Channel can be reduced to add transparency to the smoke. The color can also be adjusted here if desired.

With some tweaks to the particle settings, the fog prefab is now looking good in the game scene.

Thanks for joining me on this voyage through lighting and fog. I hope to see you next time!




I am an artist and musician, that is currently diving headfirst into game development with C# and Unity3D.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

[press release] ttinolja Co.,

Lambda design patterns

Mastering DP-500 Exam: External Tools in Power BI!

LGMSOC’21 Experience

Web Storages and Cookies

NFTGO New Listing — — 5 October 2021

Start the Observability with OpenTelemetry

Extra-Strength Methods

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Jared Amlin

Jared Amlin

I am an artist and musician, that is currently diving headfirst into game development with C# and Unity3D.

More from Medium

Working with Screen Space Reflections in Unity’s HDRP

Adding a new ability to our prototype — The Triple Shot

Framing Transposer Virtual Camera Explained in Unity’s Cinemachine

2.5D Platformer — Improving the Ledge Grab #10