Illuminating the Dark: Crafting Complete Darkness in Unity
In the realm of game development, darkness is not merely the absence of light; it’s an entity that shapes the player’s experience, accentuating the unknown and heightening tension. Me and my fellow developer Brandon have decided on a building our first horror game “Lanterns Grip”, and to make it feel like a true horror experience we needed to engulf the player in true darkness with nothing but a flicker of light. We will explore the mystical arts of creating complete darkness in Unity and how to bring a single source of light to life within it. This guide is perfect for scenes that require a single area light, like the flickering lantern in our upcoming game, to reveal the mysteries shrouded in shadows.
Understanding Unity’s Lighting System
Before we plunge into the abyss, it’s crucial to comprehend the core of Unity’s lighting system. Unity offers various types of lights, each with its purpose and behavior. For our task, we require a setup that allows for total darkness, illuminated solely by our lantern’s area light.
Setting the Scene for Darkness
The first step to achieving impenetrable darkness is to adjust the ambient light. This global illumination affects every corner of your scene and must be tamed to prevent unwanted visibility.
- Navigate to
Window > Rendering > Lighting Settings
. - Set the
Environment Lighting Source
toColor
. - Change the
Ambient Color
to pitch black.
Adjusting the Light Source
With the ambient light subdued, we turn our attention to the lantern. We’ll be using an Area Light to simulate the lantern’s glow.
- Create an Area Light by right-clicking in the Hierarchy, selecting
Light > Area Light
. - Position the light to match the location of the lantern in your game object hierarchy, if you’re using a lantern. The same applies for any light source however.
We got our lantern from the synty studios asset packs, which you can checkout at syntystore.com. We’re using dungeon realms, and dungeon packs for our game.
Fine-Tuning the Area Light
The Area Light in Unity doesn’t cast light in all directions; instead, it emits light within a defined shape and direction, perfect for our lantern’s glow.
- Adjust the
Range
to control how far the light travels. - Modify the
Width
andHeight
to match the lantern's physical dimensions. - Play with the
Intensity
andColor
to simulate the flame's flicker and warmth.
For us, we chose a range of about 2 to default. We will be using a script to create an artificial flickering to appear as though the flame is lighting the way.
Embracing the Shadows
To deepen the darkness, we must ensure our light casts realistic shadows.
- In the Area Light settings, set the
Shadow Type
toSoft Shadows
. - Adjust the
Baked Shadow Radius
to create a more natural transition from light to dark.
We’re not applying any shadow radius until later, because we’re creating a flicker. The flicker is adjusting the radius and intensity and the range of the light source so quickly that there didnt seem to be a real adjustment needed here yet and the default 0 worked for us. We’re probably going to change this later though as we adjust our flicker script for a more natural transition.
The Final Touch: Post-Processing
Post-processing is the final spell to cast, enhancing the contrast between light and dark.
- Add a
Post-Process Volume
to your scene. - Enable
Color Grading
and lower thePost-exposure
to darken the unlit areas further.
Testing the Darkness
Now, it’s time to test. Play your scene and witness how the lantern’s light becomes the sole guide through the consuming darkness.
Wrapping Up the Shadows
Creating a scene draped in darkness, with only an area light to guide the way, is a powerful method to evoke mood and focus player attention. By following the steps outlined above, you can craft an environment where every flicker of light promises both safety and peril.
We hope this guide illuminates your path as you delve into Unity’s lighting mechanics. Stay tuned for more insights and behind-the-scenes looks at our game development process.
If you want to learn how we made our flicker script, or how to set up post processing and a first person camera, comment to let us know.