CHAPTER 10

Maya Lighting

Light shapes the world by showing us what we see. It creates a sense of depth, it initiates the perception of color, and it allows us to distinguish shape and form. For a scene to be successful in CG, these realities of light need to be reproduced as faithfully as possible. The trick is learning to see light and its astonishing effects on the world around us.

Topics in this chapter include:

  • Basic lighting concepts
  • Maya lights
  • Light linking
  • Adding shadows
  • Raytracing soft shadows
  • mental ray lighting
  • mental ray Physical Sun and Sky
  • Lighting effects
  • Lighting the decorative box
  • Further lighting practice
  • Tips for using and animating lights

Basic Lighting Concepts

It's no surprise that Maya's lighting resembles actual direct-lighting techniques used in photography and filmmaking. Lights of various types are placed around a scene to illuminate the subjects as they would for a still life or a portrait. Your scene and what's in it dictate, to some degree at least, which lights you put where. The type of lights you use depends on the desired effect.

At the basic level, you want your lights to illuminate the scene. Without lights, your cameras have nothing to capture. Although it seems rather easy to throw your lights in, turn them all on, and render a scene, that couldn't be further from the truth.

Although it's easy to insert and configure lights, it's how you light that will make or break your scene. Knowing how to do that really only comes with a good deal of experience and experimentation, as well as a good eye and patience.

This chapter will familiarize you with the basic techniques of lighting a scene in Maya and start you on the road to finding out more.

Learning to See

There are many nuances to the real-world lighting around us that we take for granted; we infer a tremendous amount of visual information without much consideration. With CG lighting, you must re-create these nuances for your scene.

The most valuable thing you can do to improve your lighting technique is to relearn how you see your environment. Question why things look the way they do, and you'll find that the answers almost always come around to lighting. Take note of the distinction between light and dark in the room you're in now. Notice the difference in the brightness of highlights and how they dissipate into diffused light and then into shadow.

When you start understanding how real light affects objects, you'll be much better equipped to generate your own light. After all, the key to good lighting starts with the desire to create an interesting image.

What Your Scene Needs

Ideally, your scene needs areas of highlight and shadow. Overlighting a scene flattens everything and diminishes details. Figure 10.1 shows a still life with too many bright lights that only flatten the image and remove any sense of color and depth.

Similarly, underlighting your scene makes it muddy, lifeless, and flattens the entire frame. Figure 10.2 shows the still life underlit. The bumps and curves of the mesh are hardly noticeable.

Like a photographer, you want your image to have the full range of exposure. You want the richest blacks to the brightest whites in your frame to create a deep sense of detail. As in Figure 10.3, light and shadow complement each other and work to show the features of your surface.

image

Figure 10.1 An overlit still life.

image

Figure 10.2 An underlit still life.

Three-Point Lighting

Because your scene needs to be rendered, and lighting can be a fairly heavy rendering process, your lighting needs to be efficient. That means not using dozens of lights for every part of the scene.

The traditional filmmaking and television approach to lighting is called three-point lighting. Three distinct roles are used to light the subject of a shot. More than one light can be used for each of the three roles, but the scene should seem to have only one primary, or key, light, a softer light to fill the scene, and a back light to pop the subject out from the background.

Three-point lighting ensures that the primary subject's features aren't just illuminated, but featured with highlights and shadow. Using three directions and qualities of light creates the best level of depth. Figure 10.4 shows a schematic of a basic three-point setup.

image

Figure 10.3 Balanced lighting creates a more interesting picture.

Key Light

A key light is placed in front of the subject and off to the side to provide the principal light on the subject. Because it's usually off center, the key light creates one side of brighter light, increasing the depth of the shot. This light also provides the primary shadows and gives the important sense of lighting direction in the shot.

Although it's possible for several lights to fulfill the role of key light in a scene—for example, three ceiling lights overhead—one light should dominate, creating a definitive direction. Figure 10.5 shows the subject being lit by only a key light, although it's physically composed of two lights.

The direction of the two lights remains the same, and one takes intensity precedence over the other and casts shadows. The effect creates a single key light, which produces a moody still life.

image

Figure 10.4 A three-point lighting schematic.

Fill Light

A more diffused light than the key light, the fill light seems directionless and evenly spread across the subject's dark side. This fills the rest of the subject with light and decreases the dark area caused by the key light.

The fill light isn't meant to cast any shadows onto the subject or background itself and is actually used to help soften the shadows created by the key light. Figure 10.6 shows the still life with an added fill light. Notice how it softens the shadows and illuminates the dark areas the key light misses.

Typically, you place the fill light in front of the subject and aim it so that it comes from the opposite side of the key light to target the dark side of the subject. Even though the still life in Figure 10.6 is still a fairly moody composition, much more is visible than with only the key light in Figure 10.5.

image

Figure 10.5 Key light only.

image

Figure 10.6 A fill light is now included.

Typically, you place the fill light in front of the subject and aim it so that it comes from the opposite side of the key light to target the dark side of the subject. Even though the still life in Figure 10.6 is still a fairly moody composition, much more is visible than with only the key light in Figure 10.5.

Back Light

The back light, or rim light, is placed behind the subject to create a bit of a halo, which helps to pop the subject out in the shot. Therefore, the subject has more presence against its background. Figure 10.7 shows how helpful a back light can be.

The back light brings the fruit in this still life out from the background and adds some highlights to the edges, giving the composition more focus on the fruit.

Don't confuse the back light with the background light, which lights the environment behind the subject.

Using Three-Point Lighting

The three-point lighting system is used for the primary subject of the scene. Because it's based on position and angle of the subject to the camera, a new setup is needed when the camera is moved for a different shot in the same scene. Three-point lighting is, therefore, not scene-specific but shot-specific, as long as it does not break overall continuity of the scene.

After the lighting is set up for the subject of a shot, the background must be lit. Use a directed primary light source that matches the direction of the key light for the main light, and use a softer fill light to illuminate the rest of the scene and soften the primary shadows.

image

Figure 10.7 A back light makes the subject pop right out.

Practical Lighting

Practical lighting is a theatrical term describing any lights in a scene that are cast from lighting objects within the scene. For example, a desk lamp on a table in the background of a scene would need practical lighting when it's on. You never want the practical lighting to interfere with the main lighting of the scene, unless the scene's lighting is explicitly coming from such a source.

Each light-emitting object in your CG scene doesn't necessarily need its own Maya light. Rendering tricks such as glow (for glow effects, see “Lighting Effects” later in this chapter) can simulate the effect that a light is turned on without actually having to use a Maya light. Of course, if you need the practical light to illuminate something in the scene, you need to create a light for it.

Maya Lights

Six types of light are available in Maya: Ambient, Directional, Point, Spot, Area, and Volume. These lights are also used when rendering in mental ray. How you use each dictates whether they become key, fill, or rim lights. Each light can fill any of those roles, although some are better for certain jobs than others. The most commonly used light types for most scenes are Spot, Directional, and Ambient. All of these Maya lights render in Maya software as well as mental ray.

To create each light, choose Create image Lights, and click the light type.

Common Light Attributes

Lights in Maya are treated like any other object node. They can be transformed, rotated, scaled, duplicated, deleted, and so forth and are visible as nodes in the Hypergraph and Outliner alongside other objects in the scene. Like any other node, lights have attributes that govern how they function. Figure 10.8 shows the Attribute Editor for a typical light.

When you select any light type and then open the Attribute Editor, you'll see the following attributes and options:

Type This drop-down menu sets the type of light. You can change from one light type to another (for instance, from Spot to Point) at any time.

Color This attribute controls the color cast by the light. The darker the color, the dimmer the light will be. You can use Color in conjunction with Intensity to govern brightness, although it's best to leave that to Intensity only.

Intensity This attribute specifies how much light is cast. The higher the intensity, the brighter the illumination will be.

Illuminates by Default This check box deals with light linking, or the ability to illuminate specific objects with specific lights. Clearing this check box causes the light not to illuminate all objects by default, requiring you to link the light to objects you do want it to light. Keep this check box checked unless you're linking lights to specific objects. This chapter will briefly touch on light linking later.

image

Figure 10.8 A typical light's Attribute Editor

Emit Diffuse and Emit Specular These two check boxes aren't available with the Ambient light type. For all other light types, they toggle on or off the ability to cast diffuse lighting or specular highlights on an object (see Figure 10.9). This is useful for creating specific lighting effects. For example, if lighting an object makes it too shiny, you can disable the specular emission from one or more of the lights on that object to reduce the glare.

image

Figure 10.9 Lights can render diffuse or specular components if needed.

Light Types

Beyond the common light attributes, each light type carries its own attributes that govern its particular settings.

Ambient Lights

Ambient lights cast an even light across the entire scene. These lights are great for creating a quick, even illumination in a scene; but, as you can see in Figure 10.10, they run the risk of flattening the composition. They're perhaps best used sparingly and at low intensities as fill lights or background lights.

The Ambient Shade slider in the Attribute Editor governs how flat the lighting is. The lower the value, the flatter the lighting. Figure 10.11 shows the effect of two contrasting Ambient Shade settings.

image

Figure 10.10 Ambient light.

image

Figure 10.11 A low Ambient Shade setting flattens the image.

Directional Lights

Directional lights cast a light in a general direction evenly across the scene (see Figure 10.12). These lights are perhaps second to Spot lights as the most commonly used light type. They're perfect for sunlight or general indoor lighting, for key lights, and for fill and back lights. They give an accurate sense of direction without having to emanate from a specific source.

Point Lights

A Point light casts light from a single specific point in space, similar to a bare light bulb. Its light is spread evenly from the emission point (see Figure 10.13).

Using the Decay Rate drop-down menu in the Attribute Editor, you can set how a Point light's intensity diminishes over distance. With No Decay, the Point light illuminates an object far away as evenly as it does up close. This is the most common setting for most applications.

Setting the Decay Rate to Linear, Quadratic, or Cubic requires you to increase the intensity level exponentially to compensate for the decay. You can use Decay Rate settings to illuminate nearby objects and to leave distant ones unaffected. In reality, lights have decay rates. But in CG, they don't really need to decay unless the falloff effect is needed, as shown in Figure 10.14. Clever lighting can easily avoid this cumbersome calculation.

image

Figure 10.12 Directional light.

image

Figure 10.13 A Point light placed in the front right of frame.

Spot Lights

Spot lights are arguably the most-used lights in Maya because they can be used for keys, fills, or rims; and they're highly efficient, casting light in specific areas, just like real spotlights.

Similar to Directional lights, Spot lights emphasize direction. But these lights emit from a specific point and radiate out in a cone shape, whereas a Directional light emits from an infinite source from a certain direction. As such, Spot lights can create a circular focus of light on the geometry much like a flashlight on a wall; Directionals spread the light evenly. Figure 10.15 shows a Spot light on the still life.

Point lights are good for effects such as candlelight or setting a mood.

image

Figure 10.14 A Point light with a Decay Rate set.

image

Figure 10.15 Using a Spot light.

The following attributes govern the behavior of Spot lights:

Decay Rate Specifies the rate at which the light's intensity falls off with distance, as with the Point light. Again, the intensity needs to increase exponentially to account for any decay.

Cone Angle Sets the width of the cone of light emitted by the Spot light. The wider a cone, the more calculation intensive it becomes.

Penumbra Angle Specifies how much the intensity at the edges of the cone and hence the circular focus dissipates. (See Figure 10.16.) A negative value softens the light into the width of the cone, decreasing the size of the focus; a positive value softens away from the cone.

Dropoff Specifies how much light is decayed along the distance of the cone. The higher the dropoff, the dimmer the light gets farther along the length of the cone. This effect is much better to use than a decay rate, and it gives similar results.

Figure 10.16 The Penumbra Angle attribute controls the softness of the edge of a Spot light.

image

Most practical lights are created with Spot lights. For example, a desk lamp's light is best simulated with a Spot light. Spot lights are also the lights of choice to cast shadows. You'll find more on shadows later in the chapter.

Area Lights

Area lights emit light from a flat rectangular shape only (see Figure 10.17). They behave similarly to Point lights, except they emit from an area and not from a single point. You can still set a decay rate, just as you can with Point lights. Area lights are the only lights whose scale affects their intensity. The larger an Area light, the brighter the light.

Because you can control the size of the area of light being emitted, these lights are good for creating effects such as a sliver of light falling onto an object from a crack in a door, as in Figure 10.18, overhead skylights, or the simulation of large diffused lighting fixtures such as overhead office lights. Use Area lights when you need to light a specific area of an object.

Volume Lights

Volume lights emit light from a specific 3D volumetric area as opposed to an Area light's flat rectangle (see Figure 10.19). Proximity is important for a Volume light, as is its scale.

Figure 10.17 An Area light and its placement.

image

Figure 10.18 An Area light as a sliver, and its placement.

image

Figure 10.19 A Volume light and placement.

image

A Volume light can have the following attributes:

Light Shape A Volume light can be in the shape of a sphere, a box, a cylinder, or a cone. You select a shape from the Light Shape drop-down menu.

Color Range This section of attributes sets the color of the light using a built-in ramp. The ramp (from right to left) specifies the color from inside to outside. For instance, a white-to-black ramp from right to left creates a white light at the center of the Volume light that grades down to black toward the outer edge.

Volume Light Dir This attribute sets the direction for the light's color range. Outward lights from inside out, Inward lights from the volume's edge into the center, and Down Axis lights as a gradient in an axis of the light.

Arc and Cone End Radius This attribute defines the shape for the volume.

Penumbra For cylinder and cone shapes, this attribute adjusts how much the light dims along the edge of its length.

Use Volume lights when you need to control the specific area in which light is cast or when you need an object to move into and out of a particular area of light. Volume lights are also great for creating volumetric lighting effects such as areas of lit fog. For volumetric effects, see the section “Volumetric Lighting” later in this chapter.

Lighting a Scene

It's best to start with just a couple types of light, such as Directional and Spot, before turning to the more sophisticated types, such as Area and Volume.

Getting the essence of lighting is far more important in the beginning than understanding the nuances of all the attributes of a light. At first, limit yourself to Spots and Directionals, and try to avoid any Ambient light use.

Light Linking

You can control which lights illuminate which objects by using Maya's light linking. Inevitably, a time will come when you want to create a special light for a part of your scene but not for all of it.

However by default, lights created in your scene illuminate all objects in the scene. The easiest way to create an exclusive lighting relationship is first to create a light and turn off Illuminates by Default in the light's Attribute Editor. This ensures that this light won't cast light on any object unless specifically made to do so through light linking.

To assign your new light to the object(s) you want to illuminate exclusively, choose Window image Relationship Editors image Light Linking image Light-Centric. This opens the Relationship Editor and sets it for light linking. Light-Centric means the lights are featured in the left side of the panel as shown in Figure 10.20, and the objects in your scene that will be lit are on the right.

As you can see in Figure 10.21, the still life is lit evenly, and adding a new light with Illuminates by Default disabled won't increase the light level in the scene.

Now, select the light you want to link—in this case, the directionalLight2 you just created—and the objects in the scene you'd like to link to—in this case, the apple and the pepper, as shown in Figure 10.22. Notice that no other objects on the right side of the Relationship Editor are selected; this means they will receive no illumination from this light source. When you render your scene, the objects you linked are lit by the new light. In this case, the apple and the pepper are brighter than the other fruit in the still life. (See Figure 10.23.)

image

Figure 10.20 The Light Linking window.

image

Figure 10.21 All of the scene's lights illuminate the scene.

image

Figure 10.22 Select the scene objects to link to the Directional light.

image

Figure 10.23 A linked light creates extra light for only the apple and the pepper behind it. The other objects aren't illuminated by that light.

When you're in Lighted mode (press 7 in the Shaded panel), however, keep in mind that linked lights aren't taken into account in the view panel displays. The linking comes through in the render. Light linking works with Maya Software and mental ray rendering.

Adding Shadows

Don't be too quick to create an abundance of light in your scene—eager to show off your models and textures. Shrouding objects in darkness and shadow is just as important as revealing them in light. You can say a lot visually by not showing parts of a whole, leaving some interpretation to the audience.

A careful balance of light and dark is important for a composition. As Figure 10.24 shows, the realism of a scene is greatly increased with the simple addition of well-placed shadows. Don't be afraid of the dark. Use it liberally, but in balance.

image

Figure 10.24 Darkness and shadow help add a sense of realism, depth, and mood to an otherwise simple still life.

Creating Shadows in Maya

Maya lights don't cast shadows by default; you need to enable this feature in the light's Attribute Editor. When you do that, however, lights can cast shadows in one of two ways, depending on how the scene is rendered.

The more common method of the two is to create shadows by using Depth Map shadows. When you enable shadow maps(by clicking the Use Depth Map Shadows check box in the Shadows area of a light's Attribute Editor), Maya generates shadow maps that locate where shadows fall by following the path of the light backward from the lighted object to the light itself. Shadow maps create fast, fairly accurate shadows through Maya's renderer. See the next section on how to create shadow map shadows.

The second method for casting shadows is achieved by raytracing with Maya's software renderer. Raytracing involves tracing a ray of light from every light source in all directions and tracing the reflection to the camera lens. Therefore, you can create more accurate shadows with raytracing. However, this render can take longer to calculate, particularly when using soft shadows. Later in this chapter, you'll learn how to create raytraced as well as soft shadows.

You need to turn on raytraced shadows for each light when you want more accurate shadows: either soft and diffused or sharp and crisp-edged, as well as enabling raytracing in the Render Settings window. See Figure 10.25 and Figure 10.26.

Shadow Map Shadows

For every light type except Ambient, you can turn on shadow maps through the light type's Attribute Editor, as shown in Figure 10.27.

image

Figure 10.25 A Directional light with Depth Map shadows renders faster and is usually detailed enough.

image

Figure 10.26 A Directional light with raytraced shadows produces more detailed shadows but sometimes renders more slowly.

The depth-map Resolution defaults at 512. The higher this resolution, the better defined the shadows. Figure 10.25 was rendered with a depth map Resolution of 4096, a very high value. Figure 10.28 is the same render with a depth map Resolution of 768. Most shadows are detailed enough with a depth map Resolution of 1024.

Figure 10.27 Turning on shadow maps in the Attribute Editor for a Directional light.

image

Directional lights aren't the best lights to use for detailed shadow-map shadows because they require a high resolution for the maps; however, their raytraced shadows are extremely well done, as shown in Figure 10.26.

Spot lights create shadow maps with greater accuracy at lower depth-map Resolution settings and faster render times. As such, Spots are preferred to Directionals for shadow-casting lights. Figure 10.29 shows the same render with a Spot light and a depth map Resolution setting of only 1024, one-fourth the size of the Directional light's depth-map Resolution.

Trying to squeeze a detailed shadow map from a Directional light with an absurdly high depth-map Resolution setting can even crash your system. In these cases, it's wiser to use raytraced shadows.

Raytraced Shadows

To enable raytraced shadows, turn on the light's Use Ray Trace Shadows setting in the Attribute Editor (see Figure 10.27), and enable the Raytracing check box under the Raytracing Quality heading in the Render Settings window. Choose Window image Rendering Editors image Render Settings, or click the Render Settings icon (image) in the Status line.

image

Figure 10.28 The depth map Resolution setting affects shadow quality for shadow maps.

Figure 10.30 shows the Spot light from Figure 10.29, this time rendered with a raytraced shadow. Notice that there isn't much difference in the renders at this point with simple shadows like these. However, as you'll see with soft shadows later in this chapter, raytracing shadows can make a big difference in the look of your renders.

For an object that has a transparency map applied to its shader, however, only raytraced shadows can cast proper shadows. On the left in Figure 10.31 is a plane with a mapped checkerboard transparency casting a raytraced shadow over the still life. On the right is the same light using shadow maps instead of raytraced shadows.

image

Figure 10.29 Spot lights cast faster and more detailed shadow-map shadows.

image

Figure 10.30 The Spot light shown in Figure 10.29, now has raytraced shadows.

image

Figure 10.31 Only raytraced shadows work with transparencies.

Controlling Shadows per Object

To better control your lighting, you can specify whether an object can cast and receive shadows in Maya. For example, if you have geometry casting light in front of a shadow, but you don't want it to cast a shadow, you can manually turn off that feature for that object only.

To turn off shadow casting for an object, select the object and open its Attribute Editor. In the Render Stats section is a group of check boxes that control the render properties of the object, as shown in Figure 10.32. Clear the Casts Shadows check box. If you don't want the object to receive shadows, clear the Receive Shadows check box.

Raytracing Soft Shadows

One interesting feature of shadows is that they can diffuse or soften as the shadow falls from its casting object. This small detail can greatly enhance the reality of any render. In Figure 10.33, you can see the still life rendered with sharp raytraced shadows.

However, softening shadows even in a small scene like this can help the look of the render. In Figure 10.34, you see the same render but this time with softening shadows. Notice how the shadow softens more toward the edge of the shadow; the shadow is still sharp at the point of contact.

image

Figure 10.32 You easily can set whether an object casts or receives shadows.

image

Figure 10.33 Regular raytraced shadows.

image

Figure 10.34 Softening the shadows creates a nice effect.

This gives a much nicer feeling of depth to the scene. There is an increase in render time—it's important to evaluate how much softening you need so you don't overdo the look or increase the render time too much.

Using soft shadows is easy. Simply select the light, and open its Attribute Editor. Under the Shadows heading, in the Raytrace Shadow Attributes heading, enable Use Ray Trace Shadows, and then set a Light Radius as shown in Figure 10.35. The higher the radius value, the softer the shadow will become. For Directional lights, however, the attribute is called Light Angle.

image

Figure 10.35 Create a soft shadow with Light Radius.

Whenever you increase the Light Radius, you must also increase the number of Shadow Rays to compensate for quality issues. Figure 10.36 shows the soft shadows with a Shadow Rays value of only 1 (default value). To achieve the smoothness of the render shown in Figure 10.34, Light Radius was increased to 0.30 and Shadow Rays was increased to 12.

Figure 10.36 Increase the Shadow Rays value to better the quality; this render had only 1 Shadow Ray with a Light Radius of 0.3.

image

Make sure you enable Raytracing in the Render Settings, of course. These soft raytraced shadows work both in Maya Software rendering as well as mental ray rendering.

mental ray Lighting

mental ray lighting and rendering opens up a large range of possibilities within Maya. As with all rendering, lighting plays the primary role. We'll cover mental ray rendering more in the next chapter; but because rendering and lighting go hand in hand, it's tough to ignore it in this chapter. This section is a primer on mental ray light functionality.

Open the Render Settings window by choosing Window image Rendering Editors image Render Settings. If you don't see the mental ray for Maya (or any other, such as the Vector) option in the Render Using drop-down menu, you need to load the plug-in. Choose Window image Settings/Preferences image Plug-in Manager to open the Plug-in Manager. Make sure Mayatomr.mll is checked for Loaded as well as for Auto Load to ensure that it loads by default.

Two important functions that mental ray brings to the Maya table are caustics and global illumination (GI). Caustics is the scattering of light reflections off and through semitransparent objects, such as the light that shines on the ceiling of an indoor pool or the sunshine at the bottom of an outdoor pool. Global illumination is the effect of light reflected from one object to another. For example, if you place colored spheres inside a gray box and shine a light into the box, the walls and floor of that box pick up the color of the spheres. The light from the spheres reflects onto the walls and tints them with the spheres' color. Furthermore, the light from the floor of the box bounces and helps illuminate the underside of the balls.

For example, Figure 10.37 shows a scene file that has a dozen or so glass spheres inside an enclosed box. The box has four holes in the top, and two spotlights with shadows turned on are positioned outside the box, shining in through the holes. Figure 10.37 shows a typical software render. The spheres under the holes are visible, and the rest of the box is in shadow.

However, when rendering through mental ray for Maya (see Figure 10.38), the light that enters the box bounces around the scene and illuminates the other spheres. The color of the spheres also colors the area immediately around them due to GI. Additionally, the light shines through the semitransparent spheres and casts caustic highlights on the floor. (You can see the full effect in the color section of this book.)

image

Figure 10.37 The Maya Software render of the box of spheres scene.

image

Figure 10.38 The mental ray for Maya render of the scene in Figure 10.37.

Global Illumination: A downloadable PDF Exercise

Global illumination and caustics are both advanced lighting effects and won't be covered in this book. However, a short GI exercise from a previous version of this book is available for download from the book's Web page, www.sybex.com/go/intromaya2012. The scene files for this exercise are also available here. Once you download the exercise, you can use Adobe Acrobat and the scene files to run through this living-room exercise, where you use simple GI techniques to explore this powerful rendering option in mental ray.

Image-Based Lighting

mental ray also brings image-based lighting (IBL) to Maya. This method of lighting uses an image, typically a High Dynamic Range Image (HDRI), to illuminate the scene using Final Gather or GI. Final Gather is a form of global illumination that relies on direct as well as indirect illumination. Direct illumination calculates the amount of light coming directly from lights in the scene and renders the result. However, it misses an important aspect of real-life lighting: diffuse reflections of light. Indirect illumination happens when light bounces off objects in a scene in order to reach and therefore light the rest of the scene—that is, diffuse reflections. Final Gather is typically a faster way than GI to get indirect illumination in a scene.

We'll briefly touch on Final Gather here as we explore Physical Sun and Sky lighting in the next section. However, we'll cover both IBL and Final Gather in depth in Chapter 11 when you light the decorative box model and apply displacement maps for its details.

mental ray Physical Sun and Sky

In Physical Sun and Sky lighting, mental ray for Maya creates nodes in your scene to simulate an open-air sunlight effect for your scene lighting. It's a quick way to create a nice-looking render. You'll place the textured red wagon into an open scene and apply a Physical Sun and Sky (PSAS) in the following exercise.

You can use your own scene with the textured red wagon from Chapter 6, or set your project to the RedWagon project and then download RedWagonSunlight_v01.ma from the Lighting project on the Web page to follow along. Keep in mind that if you use your own scene, your camera angles and look won't be an exact match to the figures in the book. Follow these steps:

  1. The camera for this scene is already set up in the persp panel. Switch to mental ray rendering in the Render Using pull-down menu at the top of the Render Settings window, as shown in Figure 10.39.
  2. Open the Render Settings, and click the Indirect Lighting tab. In the Environment heading, click the Create button next to Physical Sun and Sky. The Attribute Editor opens for the mia_physicalsky1 node you just created, as shown in Figure 10.40.

    image

    Figure 10.39 Enable mental ray rendering in Render Settings.

  3. Render a frame in the Perspective window, and compare to Figure 10.41. It's a bit bright, but there's something very nice about this render. Notice that the metal handlebar takes on a good look right off the bat.
  4. The render is too bright, and the wood slats for the railings shouldn't be reflective. Your render should also show that the fire-engine red of the wagon is a bit washed out.

    Let's first address the wood railings. Open the Hypershade, and double-click the first Wood shader. Set Reflectivity down to 0.1 from 0.5. Repeat for the second Wood shader.

  5. In the Render View window, click and drag a box region around the wood railings, as shown in Figure 10.42. Click the Render Region button (image) to render that part of the frame only.

    Figure 10.40 The physicalsky1 node.

    image

  6. The wood looks much better now, so let's move on to the brightness of the scene. Open the Render Settings window, and go into the Indirect Lighting tab. Click the Input arrow next to the Physical Sun and Sky attribute's button (Figure 10.43). Doing so opens the Attribute Editor for the Physical Sun and Sky.
  7. Set Multiplier to 0.5 from 1.0, and re-render the frame. The brightness comes down nicely, and the wagon is less blown out than your previous renders. See Figure 10.44.
  8. Let's play with the direction of the Sun. Look in your persp panel, and you see a Directional light sitting smack in the middle of the scene. Maya uses this light to set the direction of the sunlight, and it doesn't contribute to the lighting of the scene in any other way. Only its rotation is important to PSAS. Its intensity, color, and other attributes are irrelevant. In this scene, the Directional light is called sunDirection and is in the wagon behind the third texture placement node, as you can see in Figure 10.45. The light is currently pointing sunlight almost straight down, as if the Sun is high in the sky. It seems as if it's about noon. RotateX for the sunDirection light is −75.

    Figure 10.41 The first PSAS render doesn't look too shabby.

    image

  9. That third texture placement node is getting in the way. To turn off its display easily, in the persp panel, click Show image Textures to uncheck it. The green box disappears in this view until you turn it back on through the Show menu. Now that you can see the Directional light better, you see that the Sun is pointed slightly toward the back of the wagon. Rotate the light so that it's angled away from the camera even more, as shown in Figure 10.46. The sunDirection's RotateX should be about −25.
  10. Render the frame, and you'll see quite a difference in the scene. Maya automatically adjusts PSAS settings to make the render appear as if the Sun is about to set. This is because of the new angle. The scene (shown in Figure 10.47) not only shows a new lighting direction (the shadows fall toward the back and are longer) but also is a darker and warmer light, as if it were mid-to-late afternoon.

    Figure 10.42 Render this region to check the reflection in the wood railings.

    image

    Figure 10.43 Click to open the attributes for the daylight system.

    image

    Figure 10.44 Bringing down the brightness of the Sun.

    image

    Figure 10.45 The sunDirection light adjusts only the direction of the sunlight in the scene.

    image

  11. Angle the sunDirection light even more (so RotateX is at about −2.5), almost parallel with the ground plane, and render a frame. Now the Sun has all but set, and it's dark dusk, just before night falls on the scene. See Figure 10.48.

    Figure 10.46 Angle the Sun further away from the camera.

    image

  12. Rotate the sunDirection even more so that it's at a RotateX of about 15. It's now dark, and you can barely make out the wagon. See Figure 10.49. Time to go home before your mom gets mad. Remember, you can adjust the overall brightness of the scene by adjusting the mia_physicalsky1 node attributes, as you did in steps 6 and 7.

You can add lights to the scene as well; you aren't limited to the system's results. For example, Figure 10.50 shows a render of the wagon with the Sun beginning to rise behind it, making the foreground a bit dark. Figure 10.51 shows the same render, but with an added Directional light (with an Intensity of just 0.25) pointing toward the front of the wagon. This helps define the front of the wagon, hinting that there is another light source, perhaps a porch light behind the camera.

The PSAS system can get you some fairly nice results quickly. Keep experimenting with different sunDirection angles as well as the attributes for the system to see what results you can get for your scene. Add lights to create areas of detail in your model.

image

Figure 10.47 Now it's late afternoon.

image

Figure 10.48 It's getting late; you should get home before nightfall.

image

Figure 10.49 Ooh, it's dark—Mom's gonna be mad.

image

Figure 10.50 The sun also rises!

Unbeknownst to you, when you invoked the PSAS system, Maya turned on Final Gather in the mental ray settings. This enabled indirect lighting to work in the scene. We'll explore Final Gather in the next chapter.

We'll also explore conventionally lighting the wagon scene and bringing out its details for rendering starting at the end of this chapter and continuing into the next chapter. There, we'll introduce HDRI and image-based lighting for a fairly photoreal rendering of the decorative box.

This is the perfect time for a break, so save your work (as if I have to tell you that at this point!) and go grab some iced tea and rest your eyes for a bit. In the next section, we'll go over various special lighting effects before returning to the wagon.

Lighting Effects

In CG, you must fake certain traits of light in the real world. Using certain methods, you can create smoky light beams, glowing lights, and lens flares. Although some of these effects fall under the domain of rendering and shader tricks, they're best explored in the context of lighting, because they're created by light in the real world.

Volumetric Lighting

How do you create an effect such as a flashlight beam shining through fog? This lighting effect is called volumetric lighting, and you can use it to create some stunning results that can sometimes be time consuming to render.

image

Figure 10.51 Adding a light to illuminate the front of the wagon in this sunrise scene from Figure 10.50

You can't apply volumetric effects to Ambient and Directional light types. To add a volumetric effect to any of the other types of lights, select the light and, in the Attribute Editor under the Light Effects section, click the checkered Map button to the right of the Light Fog attribute. This creates a new render node that appears in the Hypershade window. After you click the Map button, the Attribute Editor takes you to the lightFog node.

Maya handles volumetric lights by attaching a lightFog node to the light. The Color and Density attributes under this node control the brightness, thickness, and color of the fog attached to that light. Furthermore, in the light's Attribute Editor, you can control the fog with the Fog Spread and Fog Intensity settings. Fog Intensity increases the brightness of the fog, and Fog Spread controls how well the fog is defined within its confines. For example, a Spot light with a fog shows the fog in its cone. Figure 10.52 shows how Fog Spread affects the conical fog shape.

image

Figure 10.52 Fog Spread affects how the fog dissipates to the edges of the cone.

To remove a fog effect, right-click the Light Fog label in the light's Attribute Editor, and choose Break Connection from the shortcut menu.

If you want the light fog-cast shadows to make rays of light within the fog, check Use Depth Map Shadows for the light. You'll have to increase the depth-map Resolution for a higher-quality image.

Lens Flare

Lens flare and light glow, as illustrated in Figure 10.53, mimic the real-world effect created when light strikes a lens or when the light source is visible in the frame. The flare is created when the light hits the lens at a particular angle and causes a reflection of itself in the optics of the lens.

Figure 10.53 Light glow and lens flare turned on for the back light.

image

To enable a light glow, under the Light Effects section in the light's Attribute Editor, click the checkered Map button next to the Light Glow attribute to create an OpticalFX node that appears in the Hypershade. The Attribute Editor shifts focus to that new node, which controls the behavior of the light glow and lens flare. The OpticalFX node contains the following attributes and settings:

Glow Type Setting this attribute specifies the kind of glow: Linear, Exponential, Ball, Lens Flare, and Rim Halo. These define the size and shape of the glow from the light.

Halo Type Specifying a halo creates a foggy halo around the light in addition to the glow. You can find controls for the halo under the Halo section in the Attribute Editor.

Star Points Setting this attribute specifies the number of star points the glow generates.

Rotation Setting this attribute rotates the orientation of the star points.

Radial Frequency Used in conjunction with the Glow Radial Noise attribute (see the next item) in the Glow Attributes section, this attribute defines the smoothness of any added glow noise.

Glow Radial Noise Setting this attribute adds noise to the glow effect, creating light and dark patches within the glow for a more random look, as shown in Figure 10.54.

Figure 10.54 Glow Radial Noise attribute.

image

Glow Color Setting this attribute specifies the color of the glow.

Glow Intensity and Spread Setting these attributes specifies the brightness and thickness of the glow and how well it fades away.

To turn on a lens flare along with the light glow, click the Lens Flare check box at upper right in the Attribute Editor for OpticalFX. The attributes under the Lens Flare section control the look of the flare.

Light glows and flares can be highly effective in scenes, adding credibility to the lighting; but they're often misused or, worse, overused in CG. Used sparingly and with subtlety, lens flares can go a long way toward adding a nice touch to your scene.

Shader Glow Effects

To create a glowing effect, it's sometimes better to place a glow on a geometry's shader instead of the light itself. Because a light must be seen in the shot and pointed at the camera to see any light glow and flare, a shader glow is sometimes more desirable. This process will composite a glow on the object assigned the Glow shader to simulate a volumetric light, such as a street lamp on a foggy night. Shader glows have far less render cost than true volumetric lights.

Try This To light a still-life scene, follow these steps:

  1. Open the still_life_v03.mb file in the Lighting project on the Web page. Create a Spot light, place it over the still life, and aim it directly down onto the fruit, as shown in Figure 10.55. Turn on Use Depth Map Shadows for the light, and set Resolution to 1024. Set Penumbra Angle to 10 and Intensity to 1.5. Press 7 for Lighted mode in the Camera1 view panel to see how the light is being cast.
  2. The Spot light provides the practical light in the scene. You'll place a bare bulb on a wire directly above the fruit. Create a NURBS sphere, and position it right over the fruit but in the frame for camera1 to see. In the Render Stats section of the Attribute Editor for the sphere, turn off Casts Shadows.
  3. Create a long, thin cylinder for the light bulb's wire, and position it as if the bulb were hanging from it, as shown in Figure 10.56. Turn off Casts Shadows for the cylinder as well.
  4. Create a black Phong E shader to assign to the cylinder.
  5. Create a Phong shader for the bulb, and assign it to the NURBS sphere. Set its Color to a pale, light yellow, and make it about 50 percent transparent.
  6. Select the Spot light, and set its Color to the same yellow. You can do this easily through the Color Chooser. With the shader for the bulb selected, open the Color Chooser by clicking the pale yellow color you just made. Click the right arrow to place the yellow color in the swatches to the right of the main color swatch, or right-click any of the swatches.
  7. Pick the Spot light, and click its Color attribute to set the Color Chooser to that color. Click the yellow swatch you created to get the same color on the light. For detail's sake, make the light's color less saturated. Click Accept to close the Color Chooser window.
  8. To make the shader glow for the bulb, open the Hypershade and select the bulb's Phong material. In the Attribute Editor's Special Effects section, drag the Glow Intensity slider from 0 to 1.0. If you render the frame, you see that the glow isn't quite enough to make a convincing light bulb. In the Hypershade, select the shaderGlow1 node; this node controls all the glows in the scene.
  9. Set Quality to 0.1. In the Glow Attributes section, set Glow Intensity to 6.0, set Glow Spread to 0.5, and set Glow Radial Noise to 0.2.

image

Figure 10.55 Aim a Spot light down toward the fruit.

image

Figure 10.56 Place a bulb on a wire over the fruit pedestal.

The scene file still_life_v04.mb from the Web page contains the full scene for your reference. See Figure 10.57 for the final result.

Figure 10.57 The bare light bulb over the still life is created with a shader glow.

image

Lighting the Decorative Box

In this section, you'll set up the Decorative Box scene with lights so that you can render them in the next chapter using displacement maps, HDRI, mental ray, and Final Gather to match the lighting in a photo of the real box. Because most of your “lighting” look results from using an HDR image, the lighting you'll start with will be basic for now.

The lighting conditions you'll use as a starting point are shown in Figure 10.58 as well as in the Color Section of this book. You can see that there is a primary key light coming from the right side of the image, slightly from the front, with a good fill from the left side and from top back, which also gives a bit of a rim light. These lights will be easy to set up to get the general feel first. The finesse of this exercise will come from rendering through mental ray in the next chapter, using an HDR IBL, adding reflections to the box, adding displacement maps for the intricate carvings, and adjusting the shaders to taste. In the following exercise, you'll create a basic lighting setup for the decorative box and get a direct lighting solution first.

image

Figure 10.58 Lighting the decorative box using this practical lighting as reference.

Set your current project to the Decorative_Box project, which you should have already downloaded from the book's Web page. To begin lighting, open the boxLighting01.mb scene file from the Scenes folder of the project. Then, follow these steps:

  1. Create a new camera that you can use to render the scene. You'll keep using the persp camera to navigate through the scene. In one of the other view panels, click Panels image Perspective image New. Persp1 is created. Then, choose View image Camera Attribute Editor. Maya shows you the persp1Shape tab.

    In the Output Settings heading, make sure the Renderable box is checked. Click the persp1 tab in the Attribute Editor, and rename the camera from persp1 to renderCam (persp1Shape is automatically renamed to renderCamShape).

    Select the original persp camera, and, in the Attribute Editor, make sure the Renderable box is unchecked. This ensures that only the correct camera (renderCam) will render.

    image

    Figure 10.59 Lock the camera in place.

  2. Select the renderCam again, and set its Focal Length attribute to 50. This places a 50mm lens on the renderCam to better match the camera taking the photo in Figure 10.58. Setup the renderCam to approximate the same angle of view in that photo.
  3. Press Ctrl+A to toggle off the Attribute Editor and show the Channel Box. In the Channel Box, select the renderCam's Translate and Rotate attributes, right-click, and select Lock Selected from the context menu shown in Figure 10.59. Doing so locks the camera in place, disallowing you from moving it. This way, you won't accidentally mess up the view. To be able to move that camera again, highlight those attributes, right-click them, and select Unlock Selected from the context menu.
  4. In the renderCam panel, press 6 for textured display and then 7 for lighted and textured display. This way, you can more easily see how you orient the lights.
  5. Using the persp view, create a Directional light for the key light, and place it on the right side of the box, slightly in front, and angled down at about 45 degrees as shown in Figure 10.60. Set the Intensity to 1.5, and turn on Use Ray Trace Shadows under the Shadows image Raytrace Shadow Attributes heading.
  6. Create another Directional light, and place it as the fill light from the opposite angle from the left side and a bit higher and angled down more than the key light, as shown in Figure 10.61. Set Intensity to 0.35, and turn on Use Ray Trace Shadows. Isn't this exciting?
  7. Create a third Directional light. Place it behind the box on its left side, almost diametrically across from the camera, and a bit higher than the box, as shown in Figure 10.62, so you get a nice light grazing across the top of the box. Set Intensity to 0.5.
  8. Create a poly plane, and scale it up to 50 in X and Z. Place it under the box to make a floor. Its default gray Lambert shader is fine for now. (See Figure 10.63.)
  9. Open the Render Settings window, and select mental ray as the renderer. This also automatically turns on raytracing, which you need for the shadows from the key and fill lights. Render a frame in the renderCam view.

    Figure 10.64 shows the first render with these three lights. Notice that the gray floor is reflecting in the box because you have a Phong shader assigned to it. You can use texture maps to adjust the reflective areas of the box and dial in the proper reflections in the next chapter as you render.

    Figure 10.60 Create the key light, and place it as shown.

    image

    Figure 10.61 Create the fill light.

    image

  10. Select the key light (directionalLight1), and open the Attribute Editor. In the Raytrace Shadow Attributes heading, set a Light Angle of 3.5 and Shadow Rays of 64. Render. The primary shadowing on the floor looks much nicer.

    Select the fill light (directionalLight2), and set its Light Angle to 7 with Shadow Rays of 72 (see Figure 10.65). Play with the radii and number of rays to get the shadows to your liking. Notice how much longer the render takes with soft shadows enabled. You can temporarily use fewer Shadow Rays on your lights until you're ready for final renders, to save yourself some time. Just don't forget to turn those attributes back up to their full-quality looks!

    Figure 10.62 Create the back light.

    image

    Figure 10.63 Create a floor plane.

    image

  11. You may be bothered by the low-quality settings on the render and the slight fuzziness of the wood texture on the box. Open the Hypershade, and click the Textures tab in the top part of the window to show the texture nodes in the scene. Select the box's color texture node (file1), and open the Attribute Editor. At the top, change Filter Type from the default Quadratic to Off. This prevents the renderer from slightly blurring the texture image to smooth it. (See Figure 10.66.)
  12. Open the Render Settings window (image), and click the Quality tab. Set Max Sample Level from 0 to 1. (See Figure 10.67.)

    Figure 10.64 The render doesn't look too bad with just the three-point lighting.

    image

    Figure 10.65 Much nicer shadows on the floor

    image

  13. Save your previous render in the buffer by clicking the Keep Image icon (image) in the Render View window. A scroll bar appears at the bottom of the Render View window. Render a frame of the persp panel now that you've turned off filtering for the texture file and increased a quality setting. Use the scroll bar in the Render View to scrub back and forth between the older fuzzy render and the new unfiltered render. The box's decorative carvings and lines appear much stronger and crisper, as shown in Figure 10.68. It may be tough to compare the quality levels of the two renders in the book's black-and-white images, but you should notice them clearly in your Render View.

Figure 10.66 Turn off filtering for the color texture image.

image

You'll pick this exercise up from this point in Chapter 11, where you'll add more texture maps to control reflections as well as add carving detail and enable Final Gather to use an HDR image to light the scene. Woo!

The scene file boxLighting_v02.mb in the Scenes folder of the Decorative_Box project gives you this lighting setup.

Further Lighting Practice

Lighting professionals in the CG field are called on to find the most efficient way to light a scene and bring it to the peak of its beauty. Again, this only comes from experience. The best way to become a crackerjack lighting artist is to spend months and years honing your eye and practicing the latest procedures, such as HDR lighting.

image

Figure 10.67 Select a slightly better render quality in the Render Settings window.

image

Figure 10.68 The render is much crisper and a bit cleaner.

The file still_life_v01.mb in the Lighting project on the Web page contains the scene of the still life with no lights so you can play with lighting and shadow methods as well as light linking to create some extra focus on some parts of the frame. The file still_life_v02.mb contains the same scene, but with three-point lighting already set up.

Notice in the still_life_v02.mb file that two lights make up the key light (spotLight1 and spotLight2). One light makes up the fill light (directionalLight1), and two lights (spotLight3 and spotLight4) make up the back light.

For practice, download some models from the Internet, and arrange them into your own still-life scenes to gain more lighting experience. Set up scenes, time the rendering process, and try to achieve the same lighting look using faster lighting setups that may not be as taxing on the renderer. Also, try taking pictures of situations and trying to match the lighting in the photo, as you're doing with the decorative box.

Try setting up simple scenes. Start with an indoor location that is lit by a single light bulb. Then, try the same scene in the following locations to expand your lighting repertoire:

  1. A photography studio
  2. Outside in the morning on a bright summer day
  3. Outside at dusk in the fall
  4. Outside at night under a street lamp
  5. Inside on a window ledge
  6. At the bottom of a closet lit by a nearby hallway light

Tips for Using and Animating Lights

When you're lighting a scene, invoking a lighting mode in your Perspective or Camera view panel will give you great feedback regarding the relative brightness and direction of your lights. Most computer system's graphics cards can handle a maximum of eight lights in Lighted mode; some professional cards can handle more.

You invoke Lighted mode by pressing the number 7 on your keyboard (not through the number pad on the side). You must first be in Shaded mode (press 5) or Texture mode (press 6) for Lighted mode. Remember that Lighted mode displays linked lights as if they're lighting the entire scene. This can cause some confusion, so it's wise to take notes on any light linking in your scene.

Maya's IPR renderer is also useful when lighting a scene. This almost-real-time updating renderer will give you a high-quality render of your scene as you adjust your lights. Chapter 11 will explore the IPR renderer.

Animating a Light

Any attribute of a light can be animated in the same way that you animate any other object attribute. You can't, however, animate a light's type. To edit a light's animation, you need only select the light and open the Graph Editor to access its keyframes. You can set keyframes on Intensity, Penumbra Angle, Color, and so on within the Channel Box or the Attribute Editor. Right-click the name of the attribute, and choose Key Selected from the shortcut menu.

By animating a light's intensity, you can simulate the real-world appearance of a light turning on or off. To turn on a light, create a quickly increasing curve so that its brightness arcs up slowly at first before climbing to full brightness. This animation mimics the way real lights turn on and off better than simply enabling or disabling them in your scene.

Animating the color of a light, as well as the color of a shader, sets keyframes for the color's RGB values as three separate keyframes. The Graph Editor shows a separate curve for the red, green, and blue channels of color when you animate a light's color. You can set all three keys at once by right-clicking the color attribute in the Attribute Editor and choosing Set Key from the context menu, as shown in Figure 10.69.

image

Figure 10.69 Set a key for the light.

In addition, lights can be animated to be moved, scaled, and rotated like any other object. For further study, try animating the lighting for the simple scene(s) you set up to practice lighting from the previous section. Try creating animated lights to simulate a candle illuminating your scene, or a campfire, or the flashing emergency lights you would find in your average space-station airlock.

Using the Show Manipulator Tool for Lights

An easy way to manipulate lights is to use their special manipulator (invoked by pressing T). For example, pressing T, or clicking the Show Manipulator icon (image) in the Tool Box, to select the Show Manipulator tool with a Spot light selected gives you two Translate manipulators in the view panel, as shown in Figure 10.70.

This allows you to move the source or target of the light to aim it better. By clicking the cyan circle that appears below the source's Translate manipulator, you can toggle through a number of manipulators to adjust the Spot light's settings, such as cone angle (two clicks clockwise) and penumbra angle (three clicks clockwise). The manipulator for cone angle is shown in Figure 10.71.

image

Figure 10.70 Using special manipulators to place and orient the Spot light.

A Source and Target Translate manipulator is available for all light types through the Show Manipulator tool as well.

Summary

This chapter explored lighting in Maya, beginning with basic concepts that included the three-point lighting technique. You then learned about the different lights in Maya, how they work, and how you can use light linking to control your scene better. Shadows are an important part of lighting and were covered next in this chapter, followed by a quick exploration of the Physical Sun and Sky system with mental ray and then lighting effects such as lens flare and light glows. You then created a simple lighting for the decorative box for a still rendering. Finally, you learned how to begin animating lights for use in your scenes.

image

Figure 10.71 Adjusting the cone angle interactively with the special manipulator.

Lighting is truly the linchpin of CG; it can make or break a scene. As you'll see in the next chapter, lighting goes hand in hand with rendering and shading, and the more you understand about all three functions, the better your scenes will look. Don't be afraid to experiment with lighting and shading schemes on all your projects.

..................Content has been hidden....................

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