CHAPTER 7

image

Lighting and Rendering

 

 

How to cover issues of texture, lighting, and rendering is always a tough pedagogical nut to crack. All three are intricately tied together. A red apple, when lit with green light, will render gray/brown. Small green highlights in a texture will absolutely glow if the scene is lit with that same green light. But none of these relationships will be well understood until the setup is rendered. Texturing, lighting, and rendering must work hand in hand with a very fluid two-way work flow in order to be effective.

In the last chapter, we worked on the basics of texturing. We created Lambert shaders that we were able to use images to define the color, transparency, and bump on. In this chapter, we will continue to explore shader creation a bit as we look at different material types that will exhibit different characteristics.

But the real focus will be on Maya’s lighting scheme. We are going to talk through the basic ideas of Maya’s lighting instruments and the core editable characteristics of those instruments. After this, we’ll look at how lighting works with Maya Software and Mental Ray rendering engines. Once we understand the differences here, we can start lighting our room and render with a couple of different lighting schemes and rendering solutions. Finally, we’ll look at lighting a character to best show off the character’s form.

Tips and Tricks

A quick note about nomenclature. “Light” can mean a lot of different things. It can be what is given off by a light source. It can mean the light source itself. It can be a verb. For this reason, we’ll be using an old theater device in which the actual light source is always referred to as the “lighting instrument” — or just “instrument.” When the word “light” is used, we’ll be referring to the emissions of that instrument.

Maya’s Lighting Instruments

The lighting instruments in Maya, in many ways, mimic the way lighting sources work in the real world, but usually not exactly. The best way to illustrate this is through a mini-tutorial in which we will place lighting instruments and then start tweaking settings to see how the things work.

But first a few general notes. When a light is created in Maya, a little gizmo will show up in the scene to represent the lighting instrument (Fig. 7.1). This gizmo gives a visual hint as to which type of lighting instrument has been placed. In all cases, the gizmo itself can be moved and rotated using Maya’s standard Move and Rotate Tools. In some cases (like the Directional Light and the Spot Light (among others)), the gizmo can also be scaled. Although remember that scaling these gizmos doesn’t always actually change the light that the instrument is emitting, it’s largely a cosmetic tool to make the gizmos easier to see.

image

FIG 7.1 A point light gizmo immediately after creation.

The next thing to note is that often light gizmos will make use of additional manipulator handles that can greatly assist in aiming instruments. We haven’t used the Show Manipulator Tool much so far, but it is always available in the Tool Box, and this tool is the ninth icon down (just beneath the Soft Modification Tool). With some lighting instruments (like the Spot Light shown in Fig. 7.2), when the Show Manipulator Tool is activated, two sets of manipulator handles will appear. One allows for the movement of the lighting instrument itself, and the second moves the target that the instrument is pointed at. Moving this second manipulator target can be a great way to quickly get the instrument pointing in the direction it should be.

image

FIG 7.2 Second set of manipulator handles made visible for the Spotlight when the Show Manipulator Handles Tool is activated.

Lastly, note that in Fig. 7.2, there is a little blue icon beneath the light gizmo. This is actually a switch that when clicked will provide additional handles on the light gizmo that allows for certain attributes to be tweaked. Each time it’s clicked, a different set of attributes for the instrument will be shown. Most of these attributes can be adjusted within the Attribute Editor (which is how we’ll do it); however, some artists find that they prefer to work with the visual representations this allows for.

Tutorial 7.1 Lighting Instrument Exploration

In this tutorial, we won’t have any finished product to show; but it will be important to see how the different lighting instruments function in Maya. If you’d like to run through it with me, then there are benefits to working with the lights. However, you could also just read along and look at the images for a good understanding of how the different instruments work.

Step 1: Set up a quick scene to illustrate the lighting (Fig. 7.3). Basically, it’s a plane, the size of the default grid, and some cylinders placed in a circle. The cylinders are all sitting on the plane.

image

FIG 7.3 Lighting setup.

Step 2: Establish render settings to use Maya Software. Choose Window > Rendering Editors > Render Settings. There, make sure Render using: Maya Software. Click on the Maya Software tab and change Quality: Production. Click the Close button.

Why?

For our purposes here, Maya Software is going to be the fastest output — which will be great for our exploration purposes here. Setting the Quality to Production will changea whole lot of settings automatically — which will simplify things for now, but give us good-looking output to make a good comparison.

Point Light

Point Lights are like suspended light bulbs. The light that comes from these instruments come from a single point in space and shoots out in all directions. They can be a great way to get started with a lighting scheme as they throw a lot of light all at once.

Step 3: Create and position a Point Light. To do this, choose Create > Lights > Point Light. This will create the instrument at 0,0,0 in world space. Use the Move Tool to move it up in Y to match Fig. 7.4 (approximately).

image

FIG 7.4 Positioned Point Light.

Step 4: Render the scene. Figure 7.5 shows the mouse over the Render the Current Frame button and the results of the render.

image

FIG 7.5 First rendering using default settings for a Point Light.

Why?

There are several things to note here about this render. First, of course, is that there is indeed light in the scene. However, notice that you can’t see where the light is coming from; on render, the instrument itself is not visible. This is an important point to remember: you need to model geometry to indicate where the light source is.

Next, notice that the pillars all appear to be floating. This is because there are no shadows being cast. Shadows are an important visual clue about where objects are in relationship to the ground. Without them, objects always appear in the air.

Finally, notice that the edge of the floor plane is still lit. It’s not as bright as the middle of the plane, but it is still lit. The light from this Point Light essentially just ends up throwing forever.

All of these are things that we can and should adjust.

Depth Map Shadows

Depth Map Shadows are the simplest and quickest rendering of shadows. By default, Maya doesn’t render any shadows — as it’s always looking, by default, to provide the quickest rendering solution. Depth Map Shadows, essentially, are maps that paint where the light is blocked.

Within Maya Software’s renderings, light from a source will shoot out as a linear ray from the instrument and die when it hits a surface. Areas behind the struck surface receive none of the light from this source. Depth Map Shadows are simply black textures that lay across surfaces. The benefit to these are that they render very fast (in comparison to other types of shadows like Raytraced); the drawback is that they aren’t very realistic right out of the box. They are usually unnecessarily stark and can be blocky if the resolution of the shadow map is too low. Often, with a little tweaking though, some of these drawbacks can be overcome.

Step 5: Activate Depth Map Shadows. To do this, select the Point Light and look to the Attribute Editor (remember Cntrl + A will toggle the Attribute Editor if it is not open). Look for the Shadows section and expand it. Click the Use Depth Map Shadows checkbox. Render (Fig. 7.6).

Why?

Immediate improvement, eh? Not that these shadows are perfect — they reek of fake computer shadows — but at least we have shadows and suddenly the pillars are indeed on the floor.

To get better shadows, we’ll need to make a few more adjustments.

 

image

FIG 7.6 Same light with shadows activated. Note this is rendered at a higher resolution for print purposes.

Step 6: Soften the shadow maps. Do this still within the Attribute Editor. Still within the Shadows section of the Point Light, change the Filter Size to 6. Render (Fig. 7.7).

image

FIG 7.7 Using a Filter Size of 6 makes for much softer shadows.

Why?

In this situation, think of “Filter” just like the Gaussian Blur in Photoshop. It takes the shadow map and runs a blur filter over it which softens the resulting shadows.

Decay Rate

Decay Rate refers to how the light falls off as it gets farther from the source. Step into your back yard and shine a flashlight at the moon, and it won’t get brighter, the light simply spreads and diffuses before it ever reaches the moon.

In Maya, we can tell light to behave in much the same way. There are several Decay Rate settings for Maya — some more realistic than others. They are Linear, Quadratic, and Cubic. Linear is the fastest rendering and Cubic is the slowest. Cubic is the most like how real light works, but it is often difficult to see the difference in a rendering — so I almost always use Linear.

Step 7: Activate a Linear Decay Rate for the instrument. This is still done in the Attribute Editor up near the top in the Point Light Attribute area. Render (Fig. 7.8).

image

FIG 7.8 Rendering with Decay Rate of Linear.

Why?

Pretty dark, huh? Now that the light isn’t throwing forever, it gets pretty dark in the scene. When activating the Decay Rate, it becomes important to adjust the instrument’s Intensity.

Step 8: Change the Point Light’s Intensity to 5. This is still within the Attribute Editor, in the Point Light Attribute area. Render (Fig. 7.9).

image

FIG 7.9 Render with Point Light using an Intensity of 5 with a Decay Rate of Linear.

Why?

As you can guess by looking at the Attribute Editor, there are still a plethora of other options that can be tweaked. But keeping with this very broad look at light types, let’s move on to see some other options.

Spot Light

Spot Lights are instruments that also emit from a single source, but instead of throwing light in every direction, these instruments throw light in a cone along the direction it is pointing. This means that the light rays from this light type splay outward from a central point.

Step 9: Change the light’s Type to Spot Light. Do this within the Attribute Editor (Fig. 7.10).

image

FIG 7.10 A Spot Light.

Why?

So this Spot Light is pointing straight back — we haven’t rotated it yet. But we will fix that in just a second.

 

Tips and Tricks

Note that in this case, we simply changed the type of light — this means we keep some of the other settings we’ve already set (Shadows, etc. — although notice that Decay Rate will be reset to None). However, remember that a Spot Light can also be created from scratch via Create > Lights > Spot Light.

Step 10: Change the persp View Panel to display in Viewport 2.0. Do this via the Renderer pull-down menu.

Step 11: Change to Use All Lights. Do this by either selecting Lighting > Use All Lights within the View Panel or by letting the mouse hover over the persp View Panel and hitting 7 on the keyboard.

Why?

Both of these last two steps are aimed at providing a real-time preview of what the lighting might look like on render. Don’t trust it — it’s notoriously inaccurate, but it can still provide a good idea of things like where an instrument is actually illuminating.

One note about this Viewport 2.0 though: it’s heavily reliant on the particulars of your video card. It is almost always useful when working with lights, but your screen may differ a little from my screenshots.

Step 12: Use the Rotate Tool and Move Tool to move the Spot Light up in space and aim it down toward the set (Fig. 7.11). Render (Fig. 7.12).

image

FIG 7.11 Using the Move and Rotate Tools to position and aim the instrument.

image

FIG 7.12 Render of the Spot Light as positioned in Fig. 7.11.

Step 13: Reactivate Linear Decay Rate and increase the Intensity to taste. Do frequent renders to get a more natural look.

Why?

Unfortunately, you will probably find that no matter what the settings are for the Intensity and Decay Rate, the results will still appear overly harsh. This is because the instrument is just too focused. Let’s look at some other things to adjust for Maya’s Spot Lights.

 

Tips and Tricks

On my machine, with my video card, the View Panel can be a little goofy when using Viewport 2.0. For some reasons, it can just stop working or drawing accurately. If this happens to you (you make a change to the lighting, and things just don’t look right in the View Panel), it can essentially be reset by changing Renderer > High Quality Rendering and then back to Renderer > Viewport 2.0. Heck, you might find that the High Quality Rendering gives you a good enough preview.

Cone Angle and Penumbra Angle

Within the Attribute Editor — specific to Spot Lights are some new settings: Cone Angle and Penumbra Angle. These are meant to mimic how real-lighting instruments work. The Cone Angle is pretty intuitive; there is a visual cone on the instruments gizmo that indicates how wide the angle of the light is that emerges from the source. The Penumbra Angle might be a little more new to you.

The basics of this are that a real-theater lighting instrument actually has a series of lenses. These lenses focus the light coming from the bulb. By moving the lenses closer and farther away from one another, the light that strikes a surface will change in how crisp the edge is. Highly focused light gives razor sharp edges to where the light falls off, whereas unfocused provides a gentle falloff to the edge of the light. Of course, there are times for both looks, but knowing how to dial the edge’s softness up or down is important.

Step 14: For experiments sake, change the settings on the Spot Light to Intensity: 20 (this may need to be tweaked depending on your scene’s size), Decay Rate: Linear, Cone Angle: 45, and Penumbra Angle: 0. Render (Fig. 7.13).

image

FIG 7.13 A 45° Cone Angle with a 0 Penumbra Angle.

Step 15: Now, adjust the Penumbra to a non-zero value (I’m using 10). Notice in the View Panel, the edge will soften, and then when the scene is rendered, likewise the edge of the light will be soft (Fig. 7.14).

image

FIG 7.14 All the same settings but with a Penumbra Angle setting of 10.

Directional Light

Directional Lights are best thought of as sunlight. What a Directional Light does is throw light infinitely far from infinitely far away (there is no Decay setting). The light that comes off of a Directional Light comes in parallel rays (not from a single point in space like the Point Light and Spot Light).

Step 16: Change the instrument type to Directional Light. Do this in the Attribute Editor by changing the Type to Directional Light.

Step 17: Move the instrument to the center of the circle of columns (Fig. 7.15).

image

FIG 7.15 Moving the light to the middle of the cylinders.

Why?

This is really for some illustrative purposes. The location of the actual gizmo doesn’t matter, and this will help show why.

Step 18: Take a render (Fig. 7.16).

image

FIG 7.16 Render of the results of a Directional Light.

Why?

Lots and lots to see here. First, notice that the Directional Light gizmo is in the center of the ring of cylinders, but that the outside of the cylinders behind the instrument are lit. Regardless of where the actual instrument is placed, the light still comes from infinitely far away.

Second, notice that the shadows are different than the past lights. See how the shadows are all running parallel to each other? This is because the light coming from a Directional Light is coming in parallel rays.

Third, upon a closer look, the shadows are looking a little dirty. Take a look at Fig. 7.17 and look at the highlighted areas. Now this render has the Filter setting reduced back to 1 (from the 6 your scene is probably using). But it helps show how the shadow map really does have a resolution — and a small one (512) by default. With the Spot Light, or even Point Light, this 512 resolution is spread out over a much smaller area and is harder to see the actual pixels of the map. But with a Directional Light, suddenly, the shadow map is spread out over every object in the scene and the low resolution begins to pop a bit more. So for Directional Lights — when using Depth Shadow Maps, some adjustments need to be made.

image

FIG 7.17 Using the default Depth Map Shadow resolution of 512, the low resolution begins to be very visible when using the Directional Light.

Step 19: Increase the Depth Map Shadow resolution to make a cleaner shadow. Do this in the Attribute Editor. First, change the Filter setting back to 1, then try turning up the Resolution setting (in the Depth Map Shadow Attribute section) to 1024 and render. Try 2048 and render. Finally, give 4096 a shot and render (Fig. 7.18).

image

FIG 7.18 Same Directional Light rendered using a 4096 Depth Map Shadow.

Why?

So, sure enough, the shadow has gotten crisper and cleaner — much more like what the sun would actually do. But, notice that the rendering time also increased along the way. Bigger Depth Map Shadow resolutions mean bigger chunks of data that need to be calculated, and thus the rendering time goes up. It’s a balancing act (as is much of rendering) to track down what setting looks the best but doesn’t kill the clock with excessive rendering times.

Area Lights

If you have experience with real-lighting instruments, Area Lights are most like light boxes. In 3D, think of Area Lights as light emitting planes — they produce a very diffuse and soft light. Area Lights definitely have a hot spot middle, and the light emerges from the center of the instrument in a conical shape. But they are much more diffuse than any of the other light types.

Step 20: Change our demo light to Type: Area Light. Reactivate Decay: Linear and change its intensity to 80. Move it to approximate Fig. 7.19 and render.

image

FIG 7.19 Effects of an area light.

Why?

So notice that first of all we entered a value for Intensity that was higher than the slider initially indicated we could. This is true for lots of places in Maya (you can turn the amp to “11”!), and it’s needed sometimes for things like the diffuse Area Light. Notice how the light is very soft, has a falloff, and the shadows radiate out (not parallel).

Volume Lights

Volume Lights are interesting instruments. They are perhaps the easiest to control but most unrealistic instruments in the tool chest. The basic idea is this: a volume (sphere, box, cylinder, or cone) is drawn around the center of the instrument. Light from this point source emanates outward to the edges of the volume shape. No light escapes the volume.

This means that the effects of a light can be definitively seen in the View Panel, as the volume shape can be scaled up or down. The light decreases in intensity from the center point to the edge of the volume. Check out Fig. 7.20 and see how the sphere is slightly larger than the ring of columns and how the light from this instrument stops right there.

Step 21: Change the demo light to Type: Volume Light. Change its intensity to 5. Move and Scale the instrument to the middle of the ring of cylinders and render (Fig. 7.20). Try experimenting with the size and type of volume and taking multiple renders.

image

FIG 7.20 Volume Light. Illumination only takes place within the gizmo’s volume shape.

Ambient Light

Ambient Light is the last light type, and we aren’t going to mess with this one much. Ambient Light can be an unhealthy crutch (although it sure has its place in some Mental Ray setups (which we’ll talk about)). What it does is produce light from everywhere and nowhere. Students too often look at a scene and say, “Shoot. It’s too dark — my lighting setup hasn’t produced enough light. I know! I’ll throw an Ambient Light in there.” This is almost always a bad idea. In real life, light comes from some place; it always has a source. Now this light bounces off of surfaces and we sometimes refer to this bounced light as “ambient,” but it came from an instrument of some type (a light bulb, or the sun, or a computer screen, etc.). Because of this, it’s important that if a scene is too dim, take some time to make intelligent and thoughtful choices to either mimic this bounced light or set up a rendering engine solution (Mental Ray and Final Gather for instance), which will calculate the bounced light and produce the extra ambient lighting.

Tutorial 7.2

So now let’s let the rubber hit the road. Now that we’ve explored the lighting instruments themselves, let’s take a look at them in a real-world situation.

In this tutorial, we will be lighting the room from Escaping the Madness that we have been working on. It provides some interesting challenges and opportunities. Namely, it provides a scene with a window, a wooden floor, furniture, and dirty walls. This will make for a really interestingly lit scene.

For this tutorial, we will be lighting the scene as though it is day time (day time is actually more difficult to light than night time), and this will provide us many opportunities to use quite a few lighting instrument solutions.

Step 1: Open the last available version of the room. If you’d like, you can download mine at http://www.GettingStartedin3D.com/ and download the starting file from the Tutorial & Support Files section.

Step 2: Start by creating the sun. We will assume that the windows are facing the west as the sun as in the late afternoon. Create a sunlight by creating a Directional Light (Create > Lights > Directional Light).

Step 3: Move the Directional Light, so that it is outside of the window and aim it down so that it will shine through the windows (Fig. 7.21). Depending on the size of your scene, you may also need to scale the Directional Light (really just scaling the gizmo that represents the instrument). A render will yield a pretty unimpressive figure (Fig. 7.22).

image

FIG 7.21 Positioning, scaling, and rotating the Directional Light that will act as the sun.

Why?

Yes, much of this is cosmetic. The only alteration here that really matters is the direction the light is pointing in. The positioning and scaling of the gizmo just makes things a little more intuitive when viewing the lighting scheme in the View Panels.

 

image

FIG 7.22 Rendering of the current lighting setup.

Why?

We have a sun alright, but the sun is behaving in weird ways. Remember that the default settings for any new instrument in Maya will not have any shadows activated. We need to make some tweaks to this instrument to get it looking right.

Step 4: Activate Depth Map Shadows and change the resolution to 4096. Render.

Why?

Well, let’s start with the render — or lack of render actually. If you render the scene now with a camera inside the room, the room will be black. The reason is that because shadows are being cast from this light, all the light rays are being stopped by the walls and windows. We need to get the light to pass through those window panes.

Step 5: Make the window panes not cast shadows. Do this by first selecting the window pane object. Then, in the Attribute Editor, look for the shape node (this will be NameOfObjectShape (in the case of the version on the supporting website it will be named Winders_ETM_Hallway_Window_GlassShape)). There expand the Render Stats section and turn off the Cast Shadows option (Fig. 7.23). Do this for all the window panes. Render (Fig. 7.24).

image

FIG 7.23 Turning off the window’s ability to cast shadows — which means the light will pass right through the pane.

Why?

With an object not casting shadows, light rays will be able to pass right through the object. The render will show that the transoms and mullions (wood between the panes) are still casting shadows, but the glass itself is allowing the light through.

 

image

FIG 7.24 Rendering with window panes not casting shadows.

Step 6: Provide illumination from windows. Do this by creating an Area Light, scaling it and positioning it to be just inside a window (do just one for now (Fig. 7.25)).

image

FIG 7.25 Positioning Area Light for emission from windows.

Why?

We’re doing a bit of trickery here. Later, we will actually have Maya do some light bouncing calculations for us, but for now we are manually adding some light to help indicate other sources of illumination besides the straight sunlight. In reality, the sun has very directional light, but there is still quite a bit of light that comes in from every window of a room — not just those facing the sun. This area light helps to mimic this light and will provide some extra illumination around the emissive windows.

Step 7: Adjust the Area Light settings to include Depth Map Shadows (Resolution = 512, Filter = 6). Also, adjust the intensity to 0. 6 (Fig. 7.26). Render.

image

FIG 7.26 Results of adjusted settings for Area Light.

Why?

We want this light coming in from the windows to cast shadows (thus we turn them on), but we want it to be very diffuse (thus the filter set to 6). The intensity is turned to 0.6 as an initial guess. As time goes on this setting may need to be tweaked to provide better results. The goal for now though is to have a bit of spread diffuse light that we can see on the floor and ceiling near the window.

Step 8: Duplicate this Area Light and place appropriate for each of the other windows. Render (Fig. 7.27).

image

FIG 7.27 Duplicated Window Area Lights.

Mental Ray

The default rendering engine in Maya is Maya Software. This is a reasonably fast rendering engine that works with fairly simple physics models of light behavior. Some of this behavior becomes clear in renderings like Fig. 7.27 in which you can see all sorts of light streaming in, but yet, big chunks of the scene is still really dark. This is because the light hits a surface and dies, when in the real world, light bounces off of most non-black surfaces and provides further illumination to surfaces around it. And here’s where Maya Software immediately begins to show some of its restrictions.

Maya does include other rendering engines, however, and one of them handles issues like bounced light quite well. Mental Ray is another rendering engine that Maya allows access to that includes a powerful tool called Final Gather. Final Gather creates what are called stochastic samples along surfaces that sample (or look) around themselves to see what other surfaces are close. If it sees a surface close to it, it gathers the color information off that surface and tints the texture around the stochastic sample to represent the bounced light that that second surface would have provided. The net result is the look of bounced light.

So for us, this is perfect. We have only one light source — the sun — in this scene (although we are cheating a bit with the Area Lights in the windows), that we want to have bounce all over the room to provide further secondary illumination.

Now, because Mental Ray is a different rendering engine there are some things that we’ll need to adjust to make the renderings look right. The light instruments we’ve currently placed will likely prove too intense once the bounced light is calculated. The settings for transparency will need to be adjusted for our windows. And most importantly, our rendering times will be much longer (there’s just more calculations going on). But the results are generally worth the extra work and rendering times.

Before we start looking at adjustments that need to be made, make sure Maya is set up to utilize Mental Ray. To do this, chose Windows > Settings/ Preferences > Plug-in Manager. Look for the Mayatomr.mll and make sure it is checked in both the Loaded and Auto load columns.

Step 9: Turn on Mental Ray and Final Gather. Do this by choosing Render Settings (Window > Rendering Editors > Render Settings). Change Render Using: Mental Ray. Then, click on the Features tab, and in the Secondary Effects area, tick on the Final Gather option. Click the Close button. Render (Fig. 7.28).

image

FIG 7.28 Initial render with Mental Ray.

Why?

Good start, huh? Suddenly there appears to be much more light in the room. The shadows aren’t completely black any more, and there is generally a more believable feel to the lighting. However, notice that there are some new problems. For instance, the windows aren’t transparent any more, and some of the lights may leave things looking a bit blown out. We’ll need to fix these issues in the following steps.

Step 10: Tweak light intensities. This is largely a personal preference and will take some tweaking and lots of rendering. What I did was turn my Directional Light’s intensity up to 1.5 (it is the sun after all and should be pretty intense) and turned my window lights down to 0.25 (Fig. 7.29).

image

FIG 7.29 Renderings with adjusted lighting intensities.

Step 11: Fix the transparency. Transparency works a little different with Mental Ray — the shaders have to be constructed just a little bit differently. To make the window panes transparent again select the material attached to them (do this either in the Hypershade or by clicking one of the window panes, and in the Attribute Editor, look for the tab that represents the material). Scroll down to the Raytrace Options section and turn the Shadow Attenuation to 0.

Step 12: Add an Ambient Light. Do this with Create > Lights > Ambient Light. Move the Ambient Light into the center of the room and change the Intensity to 0.25. Render (Fig. 7.30).

image

FIG 7.30 Rendering using Mental Ray, Final Gather, and a very low intensity Ambient Light to give everything an initial illumination.

Why?

Yes, usually Ambient Lights are a lazy man’s way of lighting a room. But when using Final Gather, an Ambient Light can be a great way to make sure that all the surfaces in the room initially have some illumination for the stochastic samples to pick up. While an Ambient Light can easily simply wash out an entire scene and ruin any sense of depth, a very low intensity (like our 0.25) Ambient Light can provide added lighting flexibility but keep the visual depth.

Cycs

Getting dangerously close, huh? The lighting on the walls and floor is looking quite good; but those windows — even though they are transparent — just look dead. The reason, of course isthat we are looking out the windows into the depths of the 3D wasteland. They are transparent, but there is nothing to see out there — so Maya/Mental Ray render it as black.

To fix this, we’ll employ an old theater trick. A cyclorama is the backdrop that sits on the back end of a stage that often has a slight curve. It gives the illusion (albeit kind of stylized and corny) of added depth. In 3D, we can do the same thing.

This will take a few steps. First, we will model the cyc, texture it, and then make sure it doesn’t get in the way of the lighting scheme we’ve already set up.

Step 13: Model a cyc. This can be done several ways, but let’s look at a slightly different method here than we’ve used in the past. Start by creating a Bezier curve in the top View Panel to roughly mimic Fig. 7.31. Duplicate this curve and move it above the original, so there are two curves to define the bottom and top of the cyc. Select both and choose Surfaces|Surfaces > Loft (Options). Make sure the options match Fig. 7.32. The results are shown in Fig. 7.33. Name this object Cyc.

image

FIG 7.31 The Bezier curve that will become the cyc. Notice this is done with three anchors.

image

FIG 7.32 Loft Options for the Loft that creates the cyc geometry.

image

FIG 7.33 Lofting results.

Why?

Now this cyc is really a little weird, but works well for this tutorial. In reality, the cyc should really be built so that all the rooms on this side of the sanitorium could look out and see it. But we’re building it so that it can only be seen out of this one room that we are currently working on. That’s OK for now, but be aware that one unbroken cyc is usually preferable for all the windows of one side of a building.

Step 14: Create a new Lambert material to apply to the cyc. Do this by either creating a new material in the Hypershade or by right-clicking on the cyc and choosing Create New Material from the Hotbox. Name this new material Cyc_Mat.

Step 15: Find a panoramic picture to use as the base color map. A quick Google search using “countryside panorama” yields a huge collection of different options. Download the one you want and save it to your sourceimages folder.

Why?

Searching for panorama’s usually provides those long images that work best for cycs. This will provide the best chance of getting a cyc that doesn’t have a skewed image on it.

Step 16: Back in Maya, apply this newly found panoramic image as the color map in the color channel of the Cyc_Mat. The results will look something like Fig. 7.34.

image

FIG 7.34 Applied panoramic image as the color map for the Cyc_Mat. Clearly, it’s upside down and needs some tweaking.

Step 17: Rotate, scale, and position the cyc as needed (Fig. 7.35). Be sure to take a look at what you can see inside the room.

image

FIG 7.35 Positioned cyc.

Tips and Tricks

It’s really important to check inside the room to see how the cyc holds up. It’s likely that it will need to be bigger than you anticipate, so that it holds up when you are in the room looking out the window at various angles.

Step 18: Make the cyc not cast shadows. Remember that to do this, select the object, then in the Attribute Editor, find the shape node, and look for the Render Stats section. Turn off the Casts Shadow check box.

Why?

If this big cyc object was casting shadows, it would block our sunlight. This cyc needs to be really independent of all the lighting in the scene as the photograph appears lit already.

Step 19: Make the cyc self-lit or rather independent of the lights. We’ll do this by adjusting the Cyc_Mat. Open the Hypershade, select Cyc_Mat in the Materials tab and choose Graph > Input and Output Connections which will graph the material in the Work area. We want to use this same color map as the ambient color map. To do this, right-click the arrow at the bottom-right of the file 12 (or whatever number yours is) node and choose outColor > outColor from the Hotbox that appears. Then, right-click on the arrow at the bottom-left of the Cyc_Mat node and choose ambient-Color from that Hotbox. There will appear to be little difference in the Hypershade. But a render will yield an outside well lit (Fig. 7.36).

image

FIG 7.36 Cyc_Mat with activated ambient color channel.

Why?

The idea of an ambient color channel is the color of an object regardless of the lighting. By using the same image to define both the color (which we can see easily in the View Panel) and the ambient color, we ensure the surface to be independent of the lighting scheme of the scene.

Step 20: Clean up. Delete all history, and delete the curves used to create the cyc. Ensure that all the new elements have been appropriately named.

Step 21: Tweak lighting settings or texture settings as desired. I always find that once I get everything in, I need to make some adjustments — tweak a light here, change the color of a texture there, or even swap out entire textures. A few minutes of adjustments can really change the ambiance of a scene (Fig. 7.37).

image

FIG 7.37 Tweaked scene.

Shader Types

So far, the scene is looking pretty good. So far it’s also true that we’ve been using one type of Shader for all the objects — Lambert. A Lambert Shader is a good one to start with as it renders quickly and has little specialty attribute to worry about. However, there comes a time when different surfaces should have different characteristics beside changes in color.

There are actually quite a few other Shader types within Maya: Anisotropic, Phong, Phong E, and Blinn to name a few. The biggest difference (for us at this level) between these Shader types and Lambert are specular highlights and reflections.

In 3D-land, specular highlights are the little gloss highlights that smooth surfaces have. In the real world, specular highlights are really bits of reflection. The sharpness of this reflection helps define the difference between the plastic on your mouse, the plastic of your keyboard, and the surface of a metal ball bearing.

Changing a Shader type from a Lambert to something like a Blinn (for instance) is fairly simple and will take something like our metal side table and make it look much more like metal. However, as always there are tweaks and changes that must be made to the material after its type is changed. Let’s look at how to do this over the next few steps.

Step 22: Change the shader type of the Walls_Mat and name it again. The easiest way to do this is select the walls, and then in the Attribute Editor go to the tab that is the material. There, the Type can be changed to Phong (or whatever). Notice that when this is done though, it renames the material. Be sure to rename the material to something like Walls_Mat. Take a quick render to view the disastrous results (Fig. 7.38).

image

FIG 7.38 Default Phongshader on the walls.

Why?

Phong, Phone E, and Blinn are three shader types that add specular highlights to a material. However, it also automatically turns on reflections. This suddenly means everything in the scene looks like it was made of tinfoil. The effect isn’t as bad in Fig. 7.38 as it could be because of the normal map that is applied (which breaks up the reflection); however, it’s still clear that something isn’t right.

What we really want to have is a little bit of reflection/specularity on the floor (it’s made of wood), but there really should be none on the walls. If the walls and floor were different objects, each could have a different Shader type (a Lambert on the walls and a Phong on the ground for instance) and that would solve the problem. For us here, in our game level, we are working on fewer objects and fewer materials to keep the draw calls low. Luckily, we can keep one material for the walls and floor — but tell that material where to be reflective and where to be matte. We’ll define what parts are reflective in the same way we define what parts have what color — with a texture map.

Step 23: Create a Specular Map for the walls. Do this in Photoshop by opening a version of the color map (this could be the raw version in your images folder or ETM_RoomWest1 Color). In Photoshop, select all the parts of the image that are not the floor and fill them with black (you could manually paint this, or use Edit > Fill after the non-floor parts are selected). The resulting image should look like Fig. 7.39. Save it as ETM_RoomWest1 Specular.

image

FIG 7.39 Specular map for walls.

Step 24: Use the new ETM_RoomWest1 Specular texture map to define the Specular Color. To do this, open the Wall_Mat in the Attribute Editor (do this by either double-clicking the material in the Hypershade or tracking down the Wall_Mat node in the Attribute Editor after selecting the walls). Expand the Specular Shading section. In the Specular Color channel, import the specular map (click the checker button and create a File render node). Take a render (Fig. 7.40).

image

FIG 7.40 Render using a specular map to have a reflective floor but matte walls.

Why?

So the question here is, why does this work? The trick is not worrying about turning off specularity, but simply telling the color of the specular highlight to be black in certain places. The net result is that the walls again appear matte while the floor which has a non-black color in the Specular map renders with its specular in-tact.

Notice that the specular map just left the color of the floor as is. We could have made the floor area pure white for the most specularity, but we don’t want things to look too clean, so keeping some color information there helps to break things up.

 

Tips and Tricks

For further control, you can use this same map to define the reflectivity as well.

Step 25: Adjust the other objects in the scene to use alternate shaders as desired. Be sure to remember to use Specular maps to define what parts of objects should have reflectivity/specularity and which parts should be more matte. My solution is shown in Fig. 7.41.

image

FIG 7.41 Additional shaders adjusted.

Tips and Tricks

The differences between Phong, Phone E, and Blinn can sometimes be a bit difficult to discern. Often the differences are internal to the code and there are just a few situations in which the results show this difference. Blinn tends to render a little faster, whereas Phong tends to have crisper specular results. But don’t sweat the details on this.

Warnings and Pitfalls

For some reason, while writing this tutorial, when bouncing back and forth between the scene and the Hypershade, I got a lot of crashes (especially when closing the Hypershade). I would suggest, after any changes you make in the Hypershade, save before closing it down.

Preparing for Final Render

Up to now, we’ve been rendering with the default quality settings in Mental Ray. Although my screen shots show a large render (1600 × 1200) so that the images would look better in print, you’ve likely been rendering at the default 640 × 480 resolution. This is good, as it ensures a faster rendering time (Mental Ray can take a long time to render). However, as your lighting scheme begins to take shape, there comes a time when you’re ready for a higher quality, or larger sized render.

To do this, we’ll need to make a few tweaks in the Render Settings. Now, we aren’t going to make an exhaustive analysis of the Render Settings window — there’s the built in documentation for that. But we will look at a few critical parts of it. Note that we will revisit this window later when we are deep into animation as being able to control this area is an important part of the animation process.

One final warning though. Students often rush to get high-quality renders and turn these settings up way too early in the process (while they are still finding the lighting scheme that works). We are about to explode our rendering times — easily doubling the time it will take to output an image. Hold off in turning these settings up until you’re reasonably sure you’re ready for a final render.

Step 26: Open the Render Settings dialog box (Windows > Rendering Editors > Render Settings).

Step 27: Define the resolution. Under the Common tab, scroll down to get to the Image Size section. There you can change the default resolution if needed. There are a number of Presets there to help plug in the appropriate numbers for things like HD television resolutions. However, you can manually enter resolution sizes if you need a render for something like print. For now, just for exploration sake, go ahead and enter Width = 1600 and Height = 1200.

Why?

These are really just arbitrary values, but they will create an image that is big enough to let you see the detail of the texture and lighting. You may wish to render with these settings to see if there are any big errors that jump out at you.

Step 28: Adjust the Quality settings. Do this under the Quality tab. Change the Preset to Production. This preset will unfortunately deactivate Final Gather, so flip it back on by going to the Indirect Lighting tab and checking the Final Gather box. Render (Fig. 7.42).

image

FIG 7.42 Render with new quality and size settings.

Why?

This is an area that gets more and more complicated with each new release of Maya — and gets further complicated with Mental Ray. Here, the presets are of immense value — and likely all you’ll need to mess with at this point.

Step 29: Adjust as needed. If the new rendering ends up showing flaws that you couldn’t see, go ahead and fix them. For instance, in mine, I found that the Directional Light’s shadow resolution was still too low so I increased it. The final render is at Fig. 7.43.

image

FIG 7.43 Final rendered high-resolution shot.

Conclusion

Lighting takes some time. It takes time to set up and takes time to render. Unfortunately, really good lighting takes a lot of small tweaks, then long render times. But don’t sell yourself short. Great-looking models are often completely decimated by poor lighting.

There are of course lots of advanced techniques that can assist in speeding this process up (rendering in passes, light linking, etc.); but before seeking these techniques out, getting a good grip on the core concepts — by practicing on “straight ahead” lighting — can still yield good looking results.

Tutorial 7.3 Character Lighting

It seems like lighting should be lighting. In reality, there are some techniques that are specific to set designs, and others that work better for characters. Often, in a project, the set will be lit one way, the character another, and then the set will use a different rendering engine than the characters that sit within the space. If rendering proves to be your area of primary interest, there are lots of fascinating techniques that await you.

However, we need to start with the basics. In this chapter, we will be looking at how to light a character. We will be lighting the alien we have created so far since we have him handy, and he presents some interesting challenges with his round body.

The techniques we will be using are loosely based on a pioneering lighting designer named Stanley McCandless. His important book, A Method of Lighting the Stage, was an important one in shaping lighting theory in American theater. Although his ideas have fallen out of vogue in many corners of theater today, his methods are still incredibly valuable in the relatively new medium of virtual lighting.

As a crude explanation of the idea, McCandless works with a Key Light that acts as the primary light source (the sun, or the overhead light bulb, etc.). In 3D, this creates very harsh shadows that leave big chunks of the character in complete blackness. McCandless’theory calls for a collection of warm-colored fill lights coming from the general direction of the Key Light. This helps diversify the colors of the character — and in particular can bring out skin tones in people. Then, a collection of cool-colored fill lights are used to light the dark side of the character. These cool-colored lights help provide illumination to the character, so that there are no black shadows, but still keep the side of the character that is away from the obvious Key Light to appear darker.

Let’s put it into practice and see if we can see better how it works.

Scene Setup

Step 1: Set your project and open the alien character from past tutorials.

Step 2: Set up the scene. To get a good idea of how this character is going to be lit, he needs to be placed on a floor. Move the character up so that he’s standing on the grid, then create a plane and place it beneath his feet (Fig. 7.44).

image

FIG 7.44 Set up scene.

Key Light

A Key Light is the primary light source of a lighting scheme. If you’ve done any studio photography, you are familiar with a three-light system, and if you’re not, you have undoubtedly noticed that for outdoor or indoor scenes, there is usually a primary light source that tends to dictate the shadows and brightest parts of a space.

Step 3: Create a Directional Light and position it to light the characters face. The idea is that the instrument needs to be higher than the character and pointed down. The rough position I chose is shown in Fig. 7.45.

image

FIG 7.45 Key Light position.

Why?

In this case, we’re using a Directional Light for a couple of reasons. First, there are less variables to have to mess with (no decay or cone angles needed). Second, it’s fairly easy to see where these lights are pointing. Both of these make for an easier tutorial following experience.

However, ultimately, this might not be the best case for all lighting situations. For instance, if this character were inside a building, these Directional Lights illumination would be blocked by the building as soon as their shadows were activated (although this could be fixed with a bunch of light linking). Still, this technique would be just as valid if the Directional Lights we are going to build were Spot Lights, or Area Lights, or even Point Lights.

Step 4: Adjust the Directional Light’s attribute. Activate Depth Map Shadows and change the Resolution to 2048. Change the Filter to 4. Rename the Directional Light to Key_Light. Take a render (Fig. 7.46).

image

FIG 7.46 Render with one light source.

Why?

These are preemptive things that we know we need to adjust. The light needs to cast shadows, and since it is a Directional Light, we need to have a high Resolution setting. Finally, the Filter takes a little of the edge off the shadows that will be too crisp right out of the box.

Warm Side Fill Lights

Figure 7.46 shows a strange render. There’s light alright, but an entire half of his face and body just disappears in black shadows. There are probably situations in which this would be what was wanted, but not for this lovable guy. We can now start filling in with fill lights. We’ll start with the warm side.

Step 5: Duplicate the Key_Light and rename it Warm_Fill_Light.

Step 6: In the top View Panel, activate the Show Manipulator Tool (activated in Fig. 7.47). There will appear two manipulation handles (one for the instrument itself and one for the target point). Move the target handle, so that it sits in the middle of the alien. Then move the instrument a little bit around the alien.

image

FIG 7.47 Using the Show ManipulatorTool to position a light.

Why?

This Show Manipulator method is a great way to work with Maya’s light instruments. When activated, as the instrument moves, it automatically turns to stay focused on the subject.

Step 7: Adjust the attribute of Warm_Fill_Light. Again, do this in the Attribute Editor. Turn the intensity down to 0.3 and change the color to an amber color that very roughly matches Fig. 7.48.

image

FIG 7.48 Adjusting attribute of the Warm_Fill_Light.

Why?

The fill lights should never be as intense as the Key Light — there will be more of them and we want to make sure they don’t overwhelm the effect of the Key Light.

The exact color there isn’t terribly important. It should be toward the yellow end of the color spectrum (warm colors), but we may end up changing this later anyway.

Step 8: Duplicate and position 4 more copies of Warm_Fill_Light and position them roughly like Fig. 7.49.

image

FIG 7.49 More Warm_Fill_Lights. Notice there is one light there that is not selected — that’s the Key Light.

Tips and Tricks

So notice that there are lights on both sides (radially) of the Key_Light. These warm fill lights should all generally feel like they are coming from the Key Light’s direction.

Cool Side Fill Lights

If you took a render at this point, the image would look something like Fig. 7.50. It’s warmer alright, and there is some nice filling in that is happening. However, the dark side of the alien is still too dark.

image

FIG 7.50 Lit with warm side fill lights.

We don’t want to keep duplicating these warm fill lights though. If we do, the character will end up totally evenly lit, and the forms of the character will be lost. Enter our cool side fill lights. These will provide illumination to the dark side of the alien, but because they are a different color, we’ll still see where the Key Light is coming from — but still be able to see the form of the dark side of the character.

Step 9: Create the cool side fill lights. To do this, duplicate any one of the Warm_Fill_Lights. Rename it Cool_Fill_Light and change the color to a desaturate blue (Fig. 7.51).

image

FIG 7.51 Cool side fill light settings.

Step 10: Fill out the cool side. Do this by moving the new Cool_Fill_Light, and then duplicating it four more times and positioning each of these to match Fig. 7.52.

image

FIG 7.52 Filling out the cool side.

Step 11: Take a render (Fig. 7.53).

image

FIG 7.53 Render with warm and cool side fill lights (one ring anyway).

Why?

Starting to get a little closer, no? there are still some areas (like under the chin) that are way too dark, but you can start to see the other side of the face finally.

Step 12: Fill out the fill light setup. To do this, in the Outliner, select all the Fill_Lights (both warm and cool). Group them (cntrl — G). Duplicate this group and slide it down to near the floor level. For each of the instruments in this new lower ring, select the instrument with the Show Manipualtor Tool and move the target up so that it is again on the alien’s face (Fig. 7.54).

image

FIG 7.54 New ring of fill lights.

Step 13: Make the floor not cast shadows. Do this by selecting the floor plane and then in the Attribute Editor go to the shape node and look for the Render Stats section. Click off the Casts Shadows checkbox. Render (Fig. 7.55).

image

FIG 7.55 Rendered with second set of fill lights. He’s starting to get a bit blown out.

Why?

OK, so this is a little bit of a cheat that becomes necessary with our Directional Light setup. If those Directional Lights are pointed up to any degree, it means that the light is coming from below the floor (remember Directional Light illumination comes from infinitely far away and casts an infinite distance). This means that the floor would simply stop all the light from this new ring of fill lights. Telling the floor to not cast shadows means the light can now make it up to the alien.

The problem now is that he’s beginning to get a bit blown out. There are too many instruments throwing too much light. We need to adjust.

Group Adjustments

There are some funny quirks to adjusting more than one light at a time in Maya. If you have multiple instruments selected and then make a change in the Attribute Editor (say, change the Intensity); you’d think that the intensity of all the selected instruments would be changed — but alas, that won’t happen. Using this method, Maya will simply change the intensity of the last selected instrument.

However, there are ways around this…namely the Channels Box Editor.

Step 14: Batch adjust the intensity of all the fill lights. Start to do this by going to the Outliner and selecting all the fill lights (everything with Fill_ Light in its name — both warm and cool side in both rings). In the Channel Box Editor, look for the Intensity input field within the SHAPES and change the setting from 0.3 to 0. 1. Render (Fig. 7.56).

image

FIG 7.56 Adjusted fill intensities.

Why?

This Channel Box trick may seem a little weird. After all, when all those lights are selected, the Channel Box still only shows the name of the last instrument selected. But you’ll notice that when the Intensity setting is changed, there is an immediate difference in the scene.

Step 15: Tweak as desired. Now that there are the instruments to fill out the illumination, and you know how to batch adjust things like the intensity, you can turn the fill lights up or down as desired. My final tweaked solution (which included turning the cool side’s intensity up just a bit, and adding just a bit of green to the Key Light to bring out the green in the skin) is shown in Fig. 7.57.

image

FIG 7.57 Further group tweaks.

Conclusion

So much more fun can be had here. But hopefully this quick look at McCandless’ ideas shows how the form of the character can be highlighted while still maintaining a clear sense of where the light is coming from.

And with that we’re going to move on from lighting and rendering. We’ll visit it again briefly when we animate, but for now we’ve got the basics covered. Lighting is one of my favorite parts of 3D, and we’ve barely scratched the surface. Exciting tools like Global Illumination and Image Based Lighting didn’t even get touched here, but can make for some really nice outputs.

However, now that you know how Maya’s lights work, if lighting is your interest, you can further explore and develop your own look.

Homework

1. Light the room for night time. Remember, there needs to be a light source modeled, and don’t forget to make that modeled light source not cast shadows, so the actual Maya lighting instrument that gets placed inside the geometry doesn’t have all its light stopped when it starts casting shadows.

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

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