Facebook

Area Lights in Unity

by Michael Sacco Published January 5, 2024

What is a Light Type in Unity?

In Unity, light plays a crucial role in creating immersive and visually appealing game environments. Light sources are responsible for illuminating scenes, casting shadows, and contributing to the overall atmosphere of a game.

Unity offers various types of lights, each with unique characteristics and use cases. One such type is the Area Light. There are several different types of lights.

The Light Type defines the light’s attributes and different options available to configure the lighting.

Types of Lights

Before delving into Area Lights, let’s briefly explore the different types of lights available in Unity:

Point Lights

Point lights emit light in all directions from a single point in space. You would use a Point Light to simulate light bulbs or other point light sources.

Directional Lights

Directional lights emit parallel rays in a specific direction, simulating distant light sources like the sun. You would use a Directional Light to simulate a Sun, Moon, or other major light that has an infinite distance. They cast shadows and provide consistent lighting across a scene.

Spot Lights

Spot lights emit light within a cone-shaped area. You would use a Spot Light to simulate focused light sources such as flashlights or spotlights on a stage.

Ambient Lights

Ambient lights emit light equally across the entire scene. They are good for providing consistent lighting even in shadowed regions of your environment.

Related: /blog/ambient-lighting-in-unity

Area Lights

Area lights, the focus of this article, are defined by a rectangle. These lights emit light uniformly across their surface area, providing a unique lighting effect.

You would use an Area Light to simulate large, flat lighting fixtures like you might find in office spaces. You could also use Area Lights to simulate long, narrow lighting fixtures like LED strips.

Lights vs. Shadows in Unity

Understanding the difference between a light and a shadow is essential in game development.

In Unity, a light is used to illuminate objects in your scene. The object checks for the position of the position of the light, then applies complex math calculations to evaluate the lighting on the object at each point. This step does not include shadowing.

In Unity, a light can be used to cast shadows. To cast a shadow, the light uses a camera to render a shadow map.

This shadow map represents objects that block the light and it includes the distance to that object. In Unity, a shadow map is used to attenuate the lighting from a specific light in your scene.

When Unity evaluates the lighting, it also samples the shadow map. If the object is occluded, then the light is attenuated.

Properly configuring lights and shadows enhances the visual fidelity of a game and contributes to the overall gaming experience for players.

What is an Area Light?

Area lights are a type of light. An area light is defined by a rectangle. The area light emits light in all directions uniformly across the surface area of the light. The light diminishes naturally as it gets farther away from the light source.

Due to the complex math required to accurately calculate the correct falloff for the light intensity, Unity does not allow Area lights to be set to real-time mode. Instead, Area lights are limited to Baked mode only.

How to add an Area Light in Unity?

  1. In a new GameObject, Add Component > Light
  2. In the Light component Inspector, change the Type to Area
  3. Configure the Position, Rotation, Width and Height of the new Area Light

You will need to bake your lighting to see the Area Light affect your scene.

How to bake an Area Light?

  1. Main Menu > Window > Rendering > Lighting Settings
  2. Click Generate Lighting

Unity Area Lights: Real-time vs. Baked

Area lights cannot be used in real-time due to their intricate lighting calculations, which could significantly impact game performance.

Therefore, Unity only allows the use of Area lights in Baked mode. In this mode, the lighting information is precomputed and stored, resulting in improved performance during gameplay.

Area Lights with HDRP, URP, and Built-In

As you know, Unity offers three distinct rendering pipelines: HDRP, URP, and Built-In.

Out of the box, Unity only supports Area Lights in the High Definition Render Pipeline - HDRP. However, remember that these Area Lights do come with a catch: they only work in Baked mode.

Related: /blog/unity-understanding-urp-hdrp-built-in

How to Use the Area Light in Unity

Utilizing Area lights in Unity involves specific steps to ensure proper integration into your game environment. Although restricted to Baked mode, their ability to create realistic lighting scenarios makes them a valuable tool for game developers.

Incorporating Area lights involves placing them strategically within the scene, adjusting parameters such as size and intensity, and then initiating the baking process.

Area Lights vs. Ambient Lights

While both Area and Ambient lights contribute to the overall illumination of a scene, they serve distinct purposes.

Area lights focus a flat, rectangular light shape on a specific region. In contrast, Ambient lights contribute to the overall illumination across the entire scene.

You should use every type of light in your project, where appropriate, to achieve the most realistic results in your game environment.

Conclusion

It is crucial that you understand the different Light Types available to you as a game maker.

The wide variety of Light Types empower you to express your artistic vision and to communicate shape, space, and priority in a scene.

If you make use of the correct Light Type for the right contexts, you will make a better game that is more grounded in realism and helps players navigate the environment more effectively.

References

Free download: Indie Game Marketing Checklist

Download now

Category

lighting and rendering

Don't forget to share this post!

Popular assets for Unity

See all assets ->
    Cutting-edge volumetric fog and volumetric lighting with support for transparent materials.
    Volumetric clouds, day night cycles, dynamic skies, global lighting, weather effects, and planets and moons.
    A lightweight procedural skybox ideal for semi-stylized projects.
    Image-based Outlines for 2D and 3D games with variable line weight, color, and displacement options.
    Per-pixel gaussian blur on your entire screen, part of the UI, or in-scene objects.
    Drag-and-drop ready-to-use ambient, impact, and spell particle effects.

Free Indie Game Marketing Checklist

Learn how to make your game successful with this handy checklist.

Download for free