Basic Lighting Exercise

We will be using the Pawn file and the Rendering menu set for this exercise.

Switch to the camera "render_cam" and do a quick render. You will see that the scene renders as though there was already a light source. This is a result of Maya's default light source. If you render a scene without a light, Maya creates a directional light during the render so that your objects can be seen. Without it, your objects would not be illuminated; that is, your render would be black.

This default light is parented to the rendered camera. This means that the entire scene will be illuminated no matter where the camera is facing. As soon as you add a light to your scene, the default light source is automatically disabled so that your scene will only be lit by the lights you've added. You can also disable the default light in the Render Settings, which is recommended for production lighting and rendering.

You can add lights to the scene through the Create → Lights menu, but you will probably find the buttons on the Rendering shelf more convenient. Adding a light will add a light object to the scene at the origin, which you can then move, rotate, and scale like any other object. There are six basic types of lights. The Ambient Light radiates diffuse light in all directions based on its position. In general, this light is not used very often since it tends to wash out the objects it illuminates. Also, it doesn't interact with bump maps.

The Directional Light simulates light that comes from very far away, such as the sun. This light has a direction, but its position doesn't matter so much. Every object in the scene will be illuminated by this light since the light is theoretically made up of a bunch of parallel rays. Because of this, Directional Lights are used for broad stroke lighting in outdoor scenes. Also because of this, Directional Lights tend to be very bad at casting shadows, since they try to expand their shadow maps to cover everything they illuminate. As noted, the default light is a Directional Light.

A Point Light represents a light source that comes from a single point, similar to the Ambient Light. This type of light is good for small, open light sources such as light bulbs, candles, or torches. Unlike Ambient Lights, Point Lights can emit specular light, which creates the bright, shiny highlights you can see on the pawn below. The image below was created with a single point light with a Quadratic Decay Rate. The Decay Rate is an attribute of most lights that determines the intensity of a light as it gets farther away from the light. By default, light intensity does not decay as it travels through space. Decay Rate is useful in localizing the effect of a light and making the scene look more realistic, since real light decays in a quadratic manner.

The Area Light is a light that emits light from one side of a plane. Its position and rotation are used to orient the light, but this light is a bit strange since its scale also matters. The larger the surface area of the plane, the brighter the light will be. Because of this, Area Lights can be a little tricky to work with, but they can be useful for broad light sources such as monitors or florescent lights. Below is the light produced by a very wide, but narrow Area Light.

Volume Lights only illuminate objects that are within the bounding volume of the light. As such, the scale and position of the light is very important. In their normal mode of operation, they act similar to Point Lights, but you can change their bounds to be a sphere, cube, cylinder, or cone. You can also change whether they emit light inward or outward. The image below was created by a spherical Volume Light casting light inward. Volume Lights tend to be a little fussy, but if you want to restrict light to a very specific area, they are a good choice.

Last, but not least, is the Spotlight. The Spotlight casts a cone of light from a single point. This makes it good for localizing the direction and placement of light, as well as being ideal for casting shadows. These properties make Spotlights the most useful type of light when lighting a scene. The light cone that the Spotlight casts can be very sharp such as in the left image or soft, such as the right image. This can be adjusted by changing the Penumbra Angle attribute of the Spotlight.

One common artifact associated with Spotlights is Mach Banding, which is caused by the discontinuity introduced by the transition from the center of the light to the penumbra. Notice how there seems to be a bright ring in the center of the light on the left. That area is not significantly brighter than the surrounding pixels, your brain just interprets the sudden change in the intensity gradient as important and highlights it. You can avoid this problem by increasing the Dropoff attribute of the Spotlight, the effect of which can be seen on the right.

One of the most crucial parts of lighting is actually the absence of light. In the real world, when an object obstructs a light source, you expect a shadow to be cast behind it. However, it is more correct to say that the light casts light everywhere except the shadow. Shadows prevent light from reaching certain areas. In Maya, shadows are not enabled by default. To enable them for a specific light, go to the Shadows area of the Attribute Editor with the light selected. You will find the Depth Map and Raytrace Shadow Attributes here.

The differences between these two types of shadows are relatively unimportant since we will be using Depth Map Shadows for most, if not all, of our lighting. Check the Use Depth Map Shadows box to enable shadows on the selected light. The two important attributes for Depth Map Shadows are Resolution and Filter Size.

Resolution determines the detail of the shadow map. Typically this value is a power of 2 (512, 1024, 2048) and is set to be as large as is needed. Setting this value too low will result in shadow aliasing, which can be seen on the left below. This artifact is extremely obvious if the object is animating, resulting in a problem called "shadow chattering" where the edges of the shadow seem to flicker. By default, the edges of shadows will be sharp, which may not be very realistic, depending on your light source. You can blur the edges of your shadows by increasing the Filter Size of the shadow. This can be seen in the image below on the right.

Another artifact you may come across when using shadows is called shadow banding. Shadow banding appears as a series of dark bands, typically in areas that are supposed to be shadowed. The artifact arises from a precision error and can be difficult to eliminate. You can reduce how visible it is by increasing the shadow Resolution and Filter Size. Adjusting the Bias may also help, but tweaking this value too much will either remove your shadows completely or place them where they shouldn't be. The image below shows you what shadow banding looks like.

There are a few ways to position your lights. The most basic way is to use the manipulation tools to move and rotate the light into position. This is a little clumbsy, but is useful when direction doesn't matter, such as with Point Lights. If you want a light to point towards a specific place, you can hit the t key with the light selected. This will allow you to manipulate the position and target of the light seperately. Finally, if you want to "look through" a light, go to Panels → Look Through Selected. This will allow you to manipulate the light as if it were a camera. This is especially useful with Spotlights, since you can see the Cone and Penumbra Angles in the view. One drawback of this method is that you are not able to undo your movements.

One of the benefits of working in an artificial environment is that you can ignore certain laws of physics. One of the most useful laws to ignore is "A light illuminates everything it touches". In Maya you can choose what is and is not illuminated by any given light, a process called Light Linking. By default, a light illuminates every object in the scene, as indicated by the Illuminates by Default box in the light's attributes. Unchecking this box will make it so that it illuminates nothing.

Obviously we need a middle ground between all and nothing. You can find the Light Linking Editor under Lighting/Shading → Light Linking Editor. This editor has two modes: Light-Centric and Object-Centric. The difference depends on whether you want to link lights to objects or objects to lights. For Light-Centric, select the light you are interested in, then select or deselect the objects you want linked or unlinked.

This editor can be a tedious to use if you want to make small light linking changes. To quickly link lights, select a set of lights and objects and go to Lighting/Shading → Make Light Links. Break Light Links works in a similar manner. The image on the left shows a Spotlight linked to only the floor, where it is linked to only the pawn on the right.

You now know the basics of lighting. Continue on to the other exercises to learn more about the basics of Maya.

Back to Exercises