Lighting, Lightmapping and Shadows

From ETC Public Wiki
Jump to: navigation, search

If you've done lighting inside a 3D Package, you'll be right at home in Unity.

  • Unity currently offers three types of Lighting: Directional, Point and Spotlight. You can find them under GameObject -> Create Other (See Figure 1.). File:Lightingfigure1.jpg

Note: To find out more about Lighting, go to:

  • Simply create a light or series of lights and drag them around in the scene to do your lighting. Don't forget that there are several properties of the lights which can be edited in the Inspector. To find out more about these properties, go here:

Light Types

If you are unfamiliar with lighting, the types are as follows:

Directional Light - This is a light that spans the entire scene and shines in one direction, as the name implies.

Point Light - The light radiates from one point in a sphere. You can modify the size of this Sphere (and hence the range of the light) by changing the range of the Light in the Inspector.

Spotlight - As the name implies, this light projects in a cone. Great for Flashlights.

Light Cookies

This can be found in the Inspector. These are basically textures for the light. For example, if you want to make a Spotlight's light look more like a Flashlight's light, you would use a Flashlight Light Cookie (See Figure 2). Unity comes with Standard Assets that you may import which includes Flashlight cookies. File:Lightingfigure2.jpg

If you didn't import Standard Assets or simply want to use Unity's Light Cookies, go to your Project Panel, Right-click and go to Import Package -> Light Cookies (See Figure 3). File:Lightingfigure3.jpg


Real-time Lighting can get fairly expensive on the processor, especially when you have a lot of lights. Unity supports the creation on Lightmapping, which is basically a texture generated on top of your Meshes to simulate Lighting without actually taking any processing power.

The use of Lightmapping is not necessary but it can potentially be useful, so use your judgment.

The Free Version of Unity only comes with a rudimentary version of Beast. The Full Version has a more powerful version.

Unity uses Beast from Illuminate Labs to do Light Mapping and it comes with Unity.

Go here to quick-start:

More in-depth information can be found here:

Custom Beast Settings:

Lightmapping UV:

Real-time Shadows (Pro Version Only)

Turning on Shadows in Unity is as easy as selecting a light and turning it on in the Inspector.

Find additional information here:

You will find that by default, only Directional Light can generate Shadows. This is because Unity is set to Forward Rendering by default. In order to generate shadows using other types of lights in Forward Rendering requires custom Shaders be written.

Find more on Directional Shadows here:

Turning on Deferred Lighting (Pro Version Only)

If you want to use Shadows with point lights and spotlights in real-time without writing custom Shaders, you will need to turn on Deferred Lighting in Unity. Be aware that Deferred Lighting is more expensive (in terms of memory) on your computer than Forward Rendering.

  1. Go to: Edit -> Project Settings -> Player. It will open up in the Inspector.
  2. Under "Other Settings," go to the dropdown menu at Rendering Path and set it to Deferred Lighting (See Figure 4). File:Lightingfigure4.jpg

For Shadow Troubleshooting:

Rendering Paths

Go here for more information about Rendering Paths:

Note: Unity is set to Forward Rendering by default.