CAP 211 - Interactive Design and Game Development

Mastering Unreal Technology, Chapter 7


This lesson discusses lighting in Unreal Editor. Objectives important to this lesson:

  1. Basic lighting
  2. Light properties
  3. Lighting effects
  4. Ambient light
  5. Light types
  6. Animating lights

Chapter 7 begins with some praise for the lighting possibilities in Unreal Editor. Some basic advice is offered about rebuilding the lighting in a level each time a significant change is made to it. We have already seen some of this in the previous chapters.

Tutorial 7.1: Light placement

This tutorial begins on page 360.

  1. The name of the file to open from the DVD is not LampTest. Open DM-CH_07_Lamp_01.ut3.
  2. Try their command to show the Game view. It did not work on my Vista computer, but it may work in the classroom. It is not important to the rest of the exercise.
  3. Create a light in the scene as instructed. Experiment with placing it at different heights above the floor to see the effect of the light.
  4. Move the light to different positions in the room to see the shadows that it casts. Note the sharp edges of the dynamically cast volume shadows.
  5. Put the light in a good spot, observe the shadows, then click the Build All button. Look at the shadows again. Note the reduced quality of the precomputed shadows created in the build process.
  6. Move the light inside the lampshade as instructed. Mourn the loss of light in the scene. Is there already a light in that location? Delete it.
  7. Save the level with your initials in the filename, so you can increment it if needed.

Tutorial 7.2: Setting a light's properties

This tutorial begins on page 363. Open the file you saved at the end of the tutorial above.

  1. Begin with the file saved above. Select the light object. Press F4 to access its properties.
  2. Keep an open mind for minute. Turn off the CastShadows property of the light, and you will see the room lit up again. This choice effectively tells the light not to cast a shadow with the lampshade (or anything else). This means that the light will pass through the lampshade.
  3. Change the color of the light as instructed. The text is correct, that the button with the magnifying glass icon opens the Color Chooser. Note that when you hover over it, the pop up help says that it shows the Generic Browser. It does not.
    The button with the icon of an arrow lets you pick a color from the scene.
  4. Change the Falloff value of the light. You will recall from 3DS Max lights that a falloff defines an area in which a light stops being effective.
  5. Change the scale of the light as instructed.
  6. Click Build All to see what the scene really looks like at this point.
  7. Save incrementally.

Tutorial 7.3: Effects lights

  1. If you closed the scene from the last tutorial, open it.
    This time you are told to select a different browser. Open the View menu, and choose Browsers, Actor Classes Browser.
  2. The image on page 367 might be useful if you had an electron microscope, but you probably don't have one handy. (Why even bother with such a picture?) Find the Light actor in the browser and expand it (click its plus sign). Click the Spotlight actor. Close the browser.
  3. Place a Spotlight actor in the Perspective viewport as instructed. (This should feel familiar at this point.) You will immediately notice that it is not like the point light you made before.
  4. Open the properties of the Spotlight as instructed, the set the three properties specified in the text. (Note: one of the properties is under the Display category.)
    Question 1: What are the three properties, and what effect did changing each of them produce?
  5. Move the Spotlight as directed, using the Top viewport to center it, and the Perspective and Side viewports to check the height. It should look like the projected beam of light is flowing naturally from the bottom of the lampshade.
  6. Set the color and falloff of the spotlight as instructed. Review the chapter material if you are not sure how to do it.
  7. Alt-drag the spotlight as instructed to make a copy of it and to place the copy higher in the lampshade.
  8. Press F4 to access and set the properties of the newest light as instructed.
    Question 2: What is the effect of changing the value of Pitch as you are instructed to do?
    Once you have set the properties of the light, adjust its height to make the rays of light emerge from the lampshade realistically.
  9. Set the properties listed in this step. Rebuild the lighting in the scene.
    Save incrementally.

Tutorial 7.4: Ambient lighting

  1. Continue with the scene you have created for this chapter. Open the browser, which should still be set to Actor Classes. (If not, click that tab.)
    Open the Light class and click Skylight.
    Put a Skylight in the scene as instructed. Note that it does not matter where in the scene you put it.
  2. The text says to double-click the skylight. I do not recommend this. Every time I try it on my computer, the mouse pointer disappears. It is just as effective to select the object first, then press F4.
    Set the brightness and color properties as specified in the text.
  3. Expand the LightingChannels category and uncheck the Static channel. This tells the light not to illuminate static objects. (The lamp is a static mesh.)
  4. Close the properties window, and alt-drag the skylight to make a copy of it. Open its properties window, and find the LightingChannels category. This time turn on the Static channel and turn off the BSP (Binary Space Partition) channel. This will cause it to shine on the static meshes in the scene, but not on the surfaces of the room (walls, floor, ceiling).
  5. The next effect is described as very subtle. It is subtle enough that I cannot see it on my computer, but we will try it in the classroom.
    As you did in another lesson, hold down ctrl-L while you left click on a bright red part of the lamp. This will create a new point light that will be the color of the material you clicked.
  6. Change the properties of the light as instructed.
  7. Move the new light to one corner of the lamp table, as in the image on page 373. Alt-drag the light to make a copy in each corner of the table.
  8. Rebuild lighting again. Save the scene incrementally.

Tutorial 7.5: Cleaning up shadows

This tutorial is quite short, and refers to chapter 4 which is not on our syllabus. Carry out the steps to select all wall, floor, and ceiling surfaces. Note that you press F5 to go to the properties of these surfaces. Note also the instruction to change the Lightmap Resolution value from the default 32 to 4, which is the change in this lesson to get better shadows. The tradeoff is that it takes longer to rebuild the lights. Save the level incrementally when you are done with this.

The chapter turns to several pages of theory before the next tutorial. Page 375 defines a light map as a texture that is applied to an object that represents a one time calculation of the light that hits the object. It is a static application of light at a point in time. A shadow map is defined as a texture that is also calculated one time for the shadows that would apply to an object. A separate shadow map needs to be calculated for each light source. Both textures are used where they can be applied to surfaces that do not need dynamic lighting or shadowing.

The text explains further that an object's normal map and specularity map may be calculated dynamically even if its light map and shadow map are not.

The text defines static lights as lights that do not move. Dynamic lights may move. (We learn that lights that may move have their bMovable property turned on.) You might gather from this that static lights create static lighting, but if they shine on an object that moves, the lighting should be dynamic. Why do we care about any of this? As discussed earlier, we want to put a low burden on the game system. Static lighting requires less processing than dynamic lighting.

The text also discusses per-vertex lighting (page 377) which complements the discussion Mr. Ahearn gave us in chapter 11 of his 3D Game Environments text. The authors of this text tell us that Unreal Editor used to use per-vertex lighting for static meshes (in earlier versions of the software). As of version 3.0, polygons are subdivided and light is calculated for each subdivision. Consider the illustration on page 378. If you think of each vertex as a point in the texture at which light is measured, you will understand that more subdivisions means more vertices, which means more detailed lighting.

The chapter lists the types of lights that can be created in Unreal Editor:

  • PointLights - omnidirectional lights, they shine in all directions from a single point
    • regular
    • toggleable - can be turned on and off by Kismet scripting
    • moveable - can be animated in the scene with Matinee
  • SpotLights - as the name suggests, they make a cone of light that has a hotspot (called InnerConeAngle) and a falloff (called OuterConeAngle)
    • regular
    • toggleable - can be turned on and off by Kismet scripting
    • moveable - can be animated in the scene with Matinee
  • DirectionalLights - simulates a light from a plane (a flat surface) that is infinitely large, and infinitely far away; best used for outdoor scenes; shadows from this light will all point the same direction. rays of light will flow parallel into the scene
    • regular
    • toggleable - can be turned on and off by Kismet scripting
    • moveable - not available; moving a DirectionalLight in or out would have no effect
  • SkyLights - as noted in the tutorial above, a skylight can serve as an ambient light source giving a general light to the entire scene that does not come from a particular source; note the diagram on page 383 that shows the effect of producing light from many sources arrayed in two hemispheres; the two hemispheres provide two sets of properties for the light
    • regular
    • toggleable - can be turned on and off by Kismet scripting; the text is unclear because it states that skylights don't come in a toggleable form, then it states that they do. Open the Actor Classes browser and you will see that this form is available.
    • moveable - not available; moving a skylight in or out would have no effect
  • Pickup lights - lights that are added to a scene to provide special lighting for specific types of actors
    • Armor
    • Health
    • WeaponLocker
    • Weapon

Tutorial 7.6: Dungeon light placement

  1. Once again, the text tells you to open a file that is not on the disc. Open the DM-CH_07_Dungeon_01 file from the files included with the text. This scene has a three lights in it already. Note where they are located, then delete them to start the tutorial as the text intends. Click the Unlit button on the Perspective viewport.
    Before you do anything else, click File, Save As, and name the file DM-CH_07_Light_Demo.
  2. Create a PointLightMoveable actor as instructed in the text.
    The Perspective viewport should already be in Unlit mode. Click its Lit button.
  3. Move the new light into the position described in the text. Use all the viewports to make sure it is in the right place.
  4. Switch back to the Actor Classes browser, and select SpotLight. Create a new spotlight as instructed and place it on the grate in the scene's ceiling.
  5. Create a new PointLight by holding down the letter L and clicking the floor of the scene. Before you move it into position in the cell, move it back and forth in the main chamber of the scene. Note the way the shadows of the bars change as the point light source moves. Move the light into position as instructed in the text.
  6. Rebuild lighting in the scene. Save your file incrementally.

The text explains several properties of lights we have seen before and some new ones as well.

  • bEnabled - turns the light on and off; can be changed dynamically on toggleable lights
  • Brightness - as the name says, the brightness of the light; can be animated
  • LightColor - sets the initial color of the light; can be animated
  • Radius - sets the distance the light can illuminate; does not apply to Directional or skylights
  • FalloffExponent - this controls the attenuation rate of the falloff to 0. The default value is 2, which means that brightness varies by the square of the inverse of the distance from the light source.
  • InnerConeAngle and OuterConeAngle - only used by spot lights; as discussed already, they control the size of the hotspot and falloff of the spot light
  • TraceDistance - only used by directional lights; the number is a distance value, if two objects are farther apart than this distance, the directional light will not cast shadows from either object to the other
  • LowerBrightness and LowerColor - properties of the lower hemisphere of a skylight

Tutorial 7.7: Light properties

This tutorial begins on page 391. Begin by opening Unreal Editor, and opening the file you saved at the end of the last tutorial. The text refers to the three lights you created by the names it gave them in the last exercise: the Wall light, the Torch light, and the Overhead light. Adjust the properties of each one of these lights as instructed to light the scene more effectively. Save the scene incrementally when you are done.

We will skip over a few pages to begin the next tutorial. Refer to the pages in between as needed for terminology.

Tutorial 7.8: Shadow properties

  1. Continue with the scene saved from the last tutorial. Select the Wall Light, open its Properties, and turn on CastDynamicShadows.
    Question 3: Why are dynamic shadows desired from this light?
  2. Change the LightShadowMode property as instructed. Again, note the reason that this is a good idea.
  3. Select the Overhead Light. Turn off its CastShadows property. This is a game design choice. The light is dim, and the shadows it might cast would not be noticed. It is a waste to turn the feature on.
  4. Rebuild the lighting and test the level. Note the dynamic shadows. Save incrementally.