Several different lights are available in Maya 5, each with its own properties and uses: Ambient, Directional, Point, Spot, Area, and Volume lights. Each one has its own icon to represent it in your scene (see Figure 10.1). Tutorial: Spot Light and Attributes To learn to use lights, you need to work with them interactively. By using a simple scene with an organic polygonal object and several primitives, you can create lights and render them to see the results of changes in attributes and other settings. The first light you'll work with is the Spot light, probably the most commonly used light, with a multitude of options to adjust. The Spot light's area of illumination is defined by a cone, and within the cone's specified range, light is cast evenly. Starting from an infinitely small point in space, a Spot light spreads as it moves farther from the origin. Spot lights are useful when you're trying to create beams of light from, for example, a prison watch tower, a lighthouse, and so forth. On the DVD Chapter_10\movies\ch10tut01.wmv |
On the DVD Chapter_10\ch10tut01begin.mb |
Start Maya, and open the scene file from the Maya 5 Fundamentals DVD-ROM (noted next to the DVD icon). You'll see a sphere with tentacles alongside three primitive objects, walls, and some ground for the objects to sit on. Switch to Four View mode. Open the Hotbox and click Create | Lights | Spot Light | option box to open the Create Spot Light Options dialog box, which contains basic creation options for the Spot light. You can also access these attributes in the Attribute Editor. Reset the values to their defaults (Edit | Reset Settings), and click the Create button. A Spot light named spotLight1 is created at the scene's origin point. The area that a Spot light illuminates is based on its position and center of interest (where it's aimed), so having the light positioned at the scene's origin isn't usually the best placement. The best way to work with a light in a scene is to switch to the Light Manipulator tool, which you can use to easily modify the light's location and center of interest. Activate the Light Manipulator tool (hotkey: t). The Light Manipulator tool has a set of two manipulators: the pivot manipulator, located at the light's pivot (origin), and the aim manipulator, located at the light's target its center of interest. In the Top view, just as you would move an object, move the Spot light to the floor's center by using its pivot manipulator. The light's aim is still off. Using the aim manipulator (shown in Figure 10.2), move the center of interest to the upper portion of the cube where the missing corner would be. The idea is to position spotLight1 so that it aims at about a 45-degree angle from the floor toward the objects, as seen from above. Figure 10.2. Using the Light Manipulator tool to position your Spot light. tip There are other manipulator options beside pivot and aim. When you're in manipulator mode, a light-blue manipulator called the Cycling Index controller (shaped like an upside-down "Q") is visible. This is a switch to toggle through the manipulator modes. You can get visual feedback and control over tilt, falloff, cone angle, and other parameters with these manipulator modes. Switch to the Side view and use the pivot manipulator to move it about 18 units in the Y direction. You should now have the Spot light positioned to illuminate the objects at about a 45-degree angle from the ground's horizontal line, as shown in Figure 10.2. Using the IPR Render for Tweaking The more you work with lights, the more you'll come to appreciate IPR. Being able to immediately update the lighting as you make adjustments is an invaluable tool in the 3D artist's hands. Lighting also affects the materials in the scene. For example, if a particular light worked well in a scene with a Lambert material and you decided to change the material to Blinn, you would instantly see how the lighting behaves differently because of the Blinn's specular property. By using the IPR render, you can easily adjust the lights for different materials. Follow these steps to try out the IPR render. Open the Render View window from the Hotbox or menu bar (Window | Rendering Editors | Render View). First, you should determine the test resolution you'll use. It's currently set to 640x480. Depending on the speed of your machine, this value might be too high and can cause the IPR render to work more slowly than you'd like. For this tutorial, reduce the test resolution by right-clicking in the Render View window, choosing Options | Test Resolution, and then releasing the mouse button over the 320x240 value. The Render Globals settings have already been configured to render from the Camera1 view. Click the IPR Render button in the Render View window. When the IPR render is finished, click-drag to select the entire rendered image in the Render View window. The IPR render should update the pixels. You can then change various attributes for the Spot light and see how it affects the scene (see Figure 10.3). Figure 10.3. The Spot light illuminates objects only within the cone's specified area. note If you notice a warning in the Command Line about IPR not supporting non-IFF format images, it relates to the save-to file type set in the Render Global Settings window. It will not cause a problem with IPR. If spotLight1 is not selected, open the Outliner (hotkey: Alt+o) and click on spotLight1 to select it. Open the Attribute Editor, and click the spotLightShape1 tab. You now have access to the Spot light settings that can be edited in Maya.
Figure 10.1. Different icons identify the lights in your scene. Attributes for Spot Lights Each light type works differently, and each one has attributes that are unique to its type. Getting familiar with what these attributes are can save you considerable time during the lighting design stage. You should aim for being able to change a specific value and having a good idea of what the result should be. Look at Figure 10.4 to see the attributes for a Spot light. Working with Spot Light Attributes The first attribute you're going to modify is the Cone Angle, which specifies the cone's actual width and is defined in degrees from 0.006 to 179.994. By default, the Cone Angle is set to 40. If you decrease the angle of the cone, the circular area that's lit up will decrease (see Figure 10.5). You can continue from the previous tutorial, or load the scene file noted next to the DVD icon. Figure 10.5. The area lit by two Spot lights rendered from the Top view. You'll notice a Cone Angle of 40 was used in the circle on the left; on the right, a Cone Angle of 80 was used. On the DVD Chapter_10\movies\ch10tut02.wmv |
On the DVD Chapter_10\ch10tut01end.mb |
Notice the edge of the area being lit by each light. Select spotlightShape2, with Cone Angle set to 80. To diminish the harsh line defining the edge where the light stops, in the Attribute Editor for spotLight1, change Penumbra Angle to 5. After the IPR updates, you can see that the edge has softened. The lighting results from the Spot light are starting to look much better. By changing a few simple settings, you now have completely different lighting. The Penumbra Angle can add or subtract from the Cone Angle. It softens the outer edge of the Spot light's cone. When specifying a Penumbra Angle, you're setting the angle at which the light falls off from the edge of the cone. If your Spot light has a Cone Angle of 40 and you set the Penumbra Angle to 10, the light's total spread angle will be 50 degrees (40 + 10). After the light has spread the first 40 degrees, it diminishes to darkness over the remaining 10 degrees. Simply put, the Penumbra Angle allows you to have an intensely lit area, but the boundary edge of the lit area will be much softer (see Figure 10.6). The Penumbra Angle can be set from -179.994 to 179.994 and has a default value of 0. Figure 10.6. By raising the Penumbra Angle, the circular lit area on the right has a softer edge than the default Spot light. The Dropoff attribute of a Spot light is similar to the Penumbra Angle, but acts from the center of the light. Therefore, you can change the softness across the entire cone (see Figure 10.7). The light starts off very bright at the center and then fades linearly to the cone's original edges. With values ranging from 0 to infinity, you can change the Dropoff attribute when the edge of the light is too solid and creates unwanted contrast. With a softer edge, you can use a Spot light without giving away its location. This gives you an opportunity to use the Spot light for general lighting as well as lighting aimed at a specific area. Figure 10.7. By setting the Dropoff attribute to 10 in the lit circle on the right, you have a softer transition from the center lit area to the circle's edge.
In the Attribute Editor for spotLight1, change the Dropoff attribute to 5. The center of interest is no longer illuminated as intensely and the area illumination seems more evenly distributed. As you have experimented with the Spot light, you've probably noticed that you have a lot of control over aiming the light, thus allowing you to focus on a specific part of the scene. Figure 10.8 is a final render after all the attribute changes to the Spot light. Figure 10.8. The results of changing attributes for spotLight1. Next, for the purposes of comparison, you'll create a layer for each light type and view them independently. Create a layer and name it Spotlight_L. Take this opportunity to save the scene to your hard disk. Name the file LightExamples.
Figure 10.4. Using the Attribute Editor is the easiest way to view attributes for a light. Other Light Types The following tutorials walk you through the other available light types in Maya and demonstrate how to use their attributes to adjust the lighting in your scene. Tutorial: Directional Light The Directional light is the default light used when you create a new scene. This light is good for emulating rays of light coming from the sun and does a fine job of lighting the entire scene instead of just targeted areas. If you decided to skip over the first tutorial, or got lost, you can load the scene file noted next to the DVD icon. On the DVD Chapter_10\movies\ch10tut03.wmv |
On the DVD Chapter_10\ch10tut02end.mb |
Currently, there's a layer (Spotlight_L) with spotLight1 in it. If you hide the layer, Maya will still render the light by default, so to see the effect of the Directional light by itself, you need to somehow turn the Spot light off. To do that, in the Outliner, select spotLight1. Transformation values and attributes for the Spot light should now be loaded into the Channel Box. In the Channel Box under Shapes, spotLightShape1, change the Intensity setting to 0, which switches it to "off" so that it doesn't illuminate the scene. Create a Directional light (Hotbox | Create | Lights | Directional Light). A default Directional light named directionalLight1 is placed at the scene's origin. Open the Render View window (Window | Rendering Editors | Render View), and IPR render the scene with the Directional light. When lighting with a Directional light, keep in mind that its rotation is what controls where the light source emanates from, not its location in the scene. For now, position the Directional light icon in a convenient place, scale it to a size that makes it easy to select, and rotate it to set the direction of the incoming light. For example, if it's high noon, you want the Directional light to point directly down, perpendicular to the ground. Position the Render View window in a location where you can see it but still be able to modify the light. It's not easy to see the light icon because of the scene's floor plane. Confirm that the Directional light is still selected, and in the Channel Box, change Translate X to 12, Translate Y to 17, Translate Z to 12. Rotating the light changes the angle that the light shines from, so it illuminates the scene differently. Switch to the Rotate tool (hotkey: e) and rotate the Directional light until the corner of the room is lit (values in the Channel Box should be Rotate X, -25, and Rotate Y, 45). tip Some people prefer to use the Light Manipulator tool to adjust the angle of rotation for a Directional light. Just press t and move the aim manipulator to change the rotation angle. Probably the most noticeable results of the Directional light have to do with the shadows it casts. Shadows cast by a light, such as a Point light, expand in a conical angle away from the light. That's fine if you have a light source that's nearby, such as a lamp, but it won't work if you need to simulate shadows from a distant light source, such as the sun, which is so far away that its rays are practically parallel. This is where the Directional light comes in; because the emitted light rays are parallel to one another, the shadows are also cast in parallel (see Figure 10.9). Figure 10.9. The image lit with a Point light (on the left) has shadows radiating from a common point. The image lit by a Directional light (on the right) has shadows that are parallel to each other.
Make sure the Directional light is selected. In the Channel Box under directionalLightShape1, change the Use Depth Map Shadows setting to on (see Figure 10.10). A quick way to do this is to type the number 1 and press Enter, instead of typing the word on. You'll need to manually refresh IPR to collect the new data on the shadows. You should now see that the shadows are parallel. Figure 10.10. Enabling the Use Depth Map Shadows option in the Channel Box.
Create a new layer and name it Directionallight_L. Add the Directional light to the layer, and change its Visibility setting to 0 (off) in the Channel Box. Save your scene again.
Tutorial: Point Light Unlike the Directional light, which has light rays that are parallel to each other, a Point light casts rays of light evenly in every direction from a point. Point lights are sometimes used for simulating omnidirectional light sources, such as light bulbs. You can continue from the previous tutorial, or load the scene file from this book's DVD-ROM (see the DVD icon). On the DVD Chapter_10\movies\ch10tut04.wmv |
On the DVD Chapter_10\ch10tut03end.mb |
Create a Point light (Hotbox | Create | Lights | Point Light), which has the default name pointLight1. Position pointLight1 by changing Translate X to 2, Translate Y to 4, and Translate Z to 4. In the Channel Box, under the pointLightShape parameters, enable the Use Depth Map Shadows option. Now, you'll add a light effect. Light sources can have an opticalFX attribute added that causes a particular effect to appear where the light is located. Typically, these effects are the sort that happen in cameras pointed at bright sources: lens flares, glows, and rings. When a light source is supposed to appear in the scene as a very intense object, an opticalFX flare can create the effect convincingly. Open the Attribute Editor for the Point light (hotkey: Ctrl+a). To add a light effect, in the PointLightShape1 tab under Light Effects, click the checkered button to the right of Light Glow. The Attribute Editor then displays a new tab called opticalFX1. Leave all the settings at their defaults for now, and keep the Attribute Editor open. Render the scene from Camera1, and you can see that the light's origin glows. Using IPR render, you can easily use the Attribute Editor to change values for the Light Glow. Experiment with the OpticalFX settings in the Attribute Editor to see their effect in the IPR render. For Figure 10.11, Glow and Halo types are set to Rim Halo, and the Lens Flare option is selected. All other values are set to default. Figure 10.11. A Point light with a Light Glow opticalFX has been positioned in the scene. Notice how the Point light emits light in every direction.
Create a layer named Pointlight_L, and assign pointLight1 to it. Set the light's Visibility to 0 in the Channel Box, and hide the layer with the Point light. Save your scene.
Tutorial: Area Light With Area lights, you can have a source of light that doesn't just come from an infinitely small point in space. The Area light emits rays from a rectangular area in space and can be scaled larger or smaller. This makes an Area light a great choice when you're looking for realistic lighting, but be forewarned that it takes longer to render. By using an Area light, you'll get shadows that soften as they're cast farther from the shadow-casting object. Maya uses only two-dimensional flat Area lights that are rectangular. You can continue from the previous tutorial, or load the scene file noted next to the DVD icon. On the DVD Chapter_10\movies\ch10tut05.wmv |
On the DVD Chapter_10\ch10tut04end.mb |
After you open the file, create an Area light (Create | Lights | Area Light) with the default name areaLight1. Set Translate X to 11, Translate Y to 10, and Translate Z to 11. Then, set Rotate to 25, 45, 0. Enable the Use Depth Map Shadows setting in the Channel Box by using 1 instead of typing on. Switch to the Light Manipulator tool (hotkey: t), and in the Top view, position the center of interest to the middle of the red sphere with tentacles (see Figure 10.12). Figure 10.12. Positioning areaLight1 with the center of interest in the middle of the object.
Make sure the Render View window is open. With the Area light in position, make an IPR render (in the Hotbox, click Render | IPR Render Current Frame). The Camera1 view should now be IPR rendered in the Render View window. This image will appear very dark. tip If you think the wrong view was rendered, you can check by right-clicking in the Render View window, and then choosing IPR | IPR Render | Camera1. When the IPR render is finished, you'll be prompted to draw a window in the IPR image for IPR rendering to update. Select the entire image for IPR updating by marquee-selecting it. After IPR rendering the scene, take a look at the lighting. You can see that the light starts off very strong and then decays as it gets farther from the light. Area lights naturally give the effect of light decay, even when the Decay Rate attribute is set to the default of No Decay. The Area light spreads with distance, so the intensity drops off because a larger area is illuminated by the same amount of light. The way you aim the Area light also varies how your scene is lit, similarly to a Spot light. Now, try uniformly scaling (hotkey: r) the light larger, to a value of about .5 (watch the Scale values in the Channel Box as you scale). The Area light icon in the viewport represents the light's scale. The IPR rendering will become much darker. Next, for comparison, scale the light larger, to around 2.5, and the IPR render will update, with the larger Area light generating far more light. Create a layer for areaLight1 with the name Arealight_L. Add your Area light to it, and then save your scene. Area lights can be useful for simulating the diffuse reflection of light from surfaces. This is most useful for brightly lit broad surfaces (like a ceiling) or vibrantly colored surfaces that reflect and tint light (a red ball near a white wall, for example). When lighting a scene, keep in mind that Area lights are time intensive to render. So if you're short on rendering horsepower, use them sparingly.
Tutorial: Volume Light Volume lights have a visible range of influence that allows you to see exactly where the light dies out. By default, the light intensity falls off linearly from the light's center point to the visible outer boundary. This type of light is ideal for interior lighting, because you usually want lights to fade with distance if they're primary sources of light. On the DVD Chapter_10\movies\ch10tut06.wmv |
On the DVD Chapter_10\ch10tut05end.mb |
Create a Volume light with the default name volumeLight1. Set Translate X to 5, Translate Y to 10, and Translate Z to 6 in the Channel Box. These settings should bring the Volume light to the left side of the camera. However, if you render now, the image will be black. The Volume light falls off to darkness before it can strike anything. Switch to Scale mode (hotkey: r), and scale the light so that the circle icon representing it encompasses the entire scene. A Scale value of about 20 should work. Render the camera view with IPR (Hotbox | Render | IPR Render Current Frame). After the rendering is finished, drag a marquee-selection square in the IPR render window so that it covers the entire image. Adjust the scaling of the Volume light in the Top view, and you can quickly see the effect in the IPR render window. Note the decay of the light with distance, as shown in Figure 10.13. Figure 10.13. Scaling the Volume light to set its falloff range.
Open the Attribute Editor while the Volume light is still selected. Here, you can see a number of unique variables for this light type. Under the Volume Light Attributes section, set the Light Shape to Cylinder, and note that the Volume light icon in the scene is now cylindrical. Under the Color Range section, you'll see a gradient. The circled color dots at the top of gradient are the positioners; the x boxes under the gradient allow you to delete the positioners. When a positioner is selected, you can edit the color swatch at the left of the gradient to change that point in the gradient. Clicking inside the gradient creates a new positioner. Try clicking in the center of the gradient to create a new positioner. Then drag the positioner left to move this mid-gray point closer to the black end of the spectrum, as shown in Figure 10.14. You'll see the result immediately in the IPR rendering. Figure 10.14. Changing the color range values for a Volume light.
Close the IPR window, set the Volume light's Visibility setting to off, and create a layer for the light named VolumeLight_L. Add your Volume light to this layer and save your scene. Volume lights are excellent for simulating most man-made sources of light. You can also get a variety of bizarre and special effects by adjusting the Light Shape setting, the Volume light direction, and the arc. Volume lights are no slower to render than Point or Spot lights; when you want falloff, you should use the Volume light in place of the Point light, with the Volume light shape set to Spherical (to mimic the Point light's omnidirectional illumination).
Ambient Light The Ambient light type creates light on all surfaces. It is in no way comparable to the real-world ambient light that creates the diffuse reflection of surfaces mentioned earlier in the chapter. Instead, it's a kind of auto-self-illumination that brightens all parts of your scene equally. For this reason, this light type should be used sparingly or for special cases only, or it can give your scene a washed-out or flat appearance. Unique to Maya is the ability to use an Ambient light as you would a Point light. Maya's Ambient lights can also cast shadows (see Figure 10.15). In essence, these features allow you to use Ambient lights as though they were Point lights, with a variable "shine everywhere" setting. This setting is called Ambient Shade, and the light behaves more like a Point light as this value approaches 1. Tutorial: Working with Ambient Lights In this tutorial, you'll work with Ambient lights. Start by loading the scene file noted next to the DVD icon. On the DVD Chapter_10\movies\ch10tut07.wmv |
Create an Ambient light and place it by entering the Translate settings .25, 10, 5 in the Channel Box. Open the Attribute Editor while the light is selected. To use shadows, select the Use Raytraced Shadows option. Set Shadow Radius to .75, the number of rays to 6, and Ray Depth to 6. On the DVD Chapter_10\ch10tut06end.mb |
Figure 10.15. Ambient lights in Maya have the option to cast shadows, but these lights shine in a diffuse manner on all surfaces. You can get the same effect by using a Point light with Emit Specular disabled, yielding a flat look if the Ambient light is relatively bright. tip These settings might result in slow render times because of raytracing. In most cases, a Spot light with depth map shadows enabled is recommended to produces shadows similar to the Ambient light but without being as time intensive to render. |