Chapter 6. Lights and Effects

In this chapter, we will cover:

  • Using lights and cookie textures to simulate a cloudy day
  • Adding a custom Reflection map to a scene
  • Creating a laser aim with Projector and Line Renderer
  • Reflecting surrounding objects with Reflection Probes
  • Setting up an environment with Procedural Skybox and Directional Light
  • Lighting a simple scene with Lightmaps and Light Probes

Introduction

Whether you're willing to make a better-looking game, or add interesting features, lights and effects can boost your project and help you deliver a higher quality product. In this chapter, we will look at the creative ways of using lights and effects, and also take a look at some of Unity's new features, such as Procedural Skyboxes, Reflection Probes, Light Probes, and custom Reflection Sources.

Lighting is certainly an area that has received a lot of attention from Unity, which now features real-time Global Illumination technology provided by Enlighten. This new technology provides better and more realistic results for both real-time and baked lighting. For more information on Unity's Global Illumination system, check out its documentation at http://docs.unity3d.com/Manual/GIIntro.html.

The big picture

There are many ways of creating light sources in Unity. Here's a quick overview of the most common methods.

Lights

Lights are placed into the scene as game objects, featuring a Light component. They can function in Realtime, Baked, or Mixed modes. Among the other properties, they can have their Range, Color, Intensity, and Shadow Type set by the user. There are four types of lights:

  • Directional Light: This is normally used to simulate the sunlight
  • Spot Light: This works like a cone-shaped spot light
  • Point Light: This is a bulb lamp-like, omnidirectional light
  • Area Light: This baked-only light type is emitted in all directions from a rectangle-shaped entity, allowing for a smooth, realistic shading

For an overview of the light types, check Unity's documentation at http://docs.unity3d.com/Manual/Lighting.html.

Lights

Different types of lights

Environment Lighting

Unity's Environment Lighting is often achieved through the combination of a Skybox material and sunlight defined by the scene's Directional Light. Such a combination creates an ambient light that is integrated into the scene's environment, and which can be set as Realtime or Baked into Lightmaps.

Environment Lighting

Emissive materials

When applied to static objects, materials featuring the Emission colors or maps will cast light over surfaces nearby, in both real-time and baked modes, as shown in the following screenshot:

Emissive materials

Projector

As its name suggests, a Projector can be used to simulate projected lights and shadows, basically by projecting a material and its texture map onto the other objects.

Projector

Lightmaps and Light Probes

Lightmaps are basically texture maps generated from the scene's lighting information and applied to the scene's static objects in order to avoid the use of processing-intensive real-time lighting.

Light Probes are a way of sampling the scene's illumination at specific points in order to have it applied onto dynamic objects without the use of real-time lighting.

The Lighting window

The Lighting window, which can be found through navigating to the Window | Lighting menu, is the hub for setting and adjusting the scene's illumination features, such as Lightmaps, Global Illumination, Fog, and much more. It's strongly recommended that you take a look at Unity's documentation on the subject, which can be found at http://docs.unity3d.com/Manual/GlobalIllumination.html.

The Lighting window
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.129.216.7