MART Term 1, Lecture 7
Layouts, Layers, Lights and Linking

Layouts

We've already learnt how we can change each of our viewports to show what we want them to. There are times when we regularly want to swap viewports from one layout to another, and Maya lets us save these layouts and swap them quickly.

Let's try this out. From the viewport menus, choose Panels → Layouts → Three Panes Split Left. This gives us a split between two viewports on the left-hand side and one on the right. Put the views you want into each of the viewports. Now let's save this: choose Panels → Panel Editor..., and a window will pop up. Click New Layout and name it however you want. This will now appear on the Saved Layouts menu, so we can pull it back up at any time. Try it now.

There are more layouts that we can choose from than those in the Panels → Layouts menu. Go back into Panels → Panel Editor..., and click on the Edit Layouts tab. If you drop down the Configuration menu, you'll see we have several more to choose from than we had before. You can build the layout here (by going onto the Contents tab) as well as from the interface.

Layers

By this stage you may well have noticed that if you have too many polygons (or NURBS surfaces) in a scene, it will become very slow to manipulate in the viewport (for example to tumble around it). Open the scene

~hbush/MART/T1L07/forlighting.ma

(Yes, you do want to continue with these values)

[screenshot: MART_T1L07_html_m77dcd5b9]Try moving the camera, and see how jerky it is. Try putting the Display → Heads Up Display → Frame Rate on, and it'll show you exactly how slow it's being: my machine could only manage around about 6 fps. Click on one of the boxes in the corner: you will notice that they have an obscenely high polygon count. If we had a way of not drawing those boxes every time, it would update much more quickly. Select all four boxes, and press ctrl-h. This "hides" the boxes: try moving around, and you'll see it's much quicker. Go into the outliner and you'll see the boxes are still there. Select them in the outliner, and press H (shift-h) to re-display them. This method works, but imagine if rather than four really high polygon objects we had 4,000 medium polygon objects that we wanted to show and hide regularly. We wouldn't want to do it this way, because it would take forever. That is why we use layers.

Underneath the channel box, we have the layer editor. On the layer editor menu, choose Layers → Create Layer. Rename the layer (double-click on it), select all of the boxes, click the RMB on the layer (in the layer editor) and select Add Selected Objects. You can change the wireframe colour of the objects too, by double-clicking the layer in the editor.

Now that the boxes have their own layer, there are several things we can do with it. If you click on the box with a V in it, the boxes will vanish: this toggles their visibility. The box next to that allows you to template (T) or reference (R) them (makes the objects unselectable in the viewport). You can also template individual objects in the scene from the marking menu under Actions. For now, let's just make the layer invisible.

Lights

[screenshot: MART_T1L07_html_4ef4f94]Finally today, I'll introduce you to some of the lights that you can use in a playblast. Get a new scene, and make a big cube with a small sphere on top. Now press 7. This sets our viewport to Use All Lights, but we currently have none, so everything is black. Let's create a light: tear off the Create → Lights menu, and click on Point Light. Move the light up and off centre (right), and try varying the parameters (like Color and Intensity).

[screenshot: MART_T1L07_html_m2c78cfb9]The main thing we're missing at the moment is shadows: shadows really help us to perceive depth, so at the moment the ball doesn't look like it's sitting on the table. Thankfully, we can have shadows in our viewports, they are not as precise as rendered shadows, but they are better than nothing. In the viewport menus, turn on Shading → High Quality Rendering and Lighting → Shadows. Nothing happens, because by default all of Maya's lights have shadows turned off. Get the light's attributes up in the attribute editor, and turn on Use Depth Map Shadows (in the Shadows section). You should now see shadows appear.

[screenshot: MART_T1L07_html_m16f2cfd9]A point light emits light from a single point in space, which makes it good for simulating objects like light bulbs. If you move the light around, you'll see that both the shading of the objects and the shadows change. Now let's have a look at a different type of light. In the attributes of the light, change Type to Spot Light. Everything goes dark again: this is because our spotlight is not pointing towards our sphere. Tumble round it and you'll see what I mean. Rotate the spot light so that it's pointing at the sphere; scale it up if you like.

Now play around with the parameters again: in particular, try adjusting the Cone Angle, the Penumbra Angle and the Dropoff.

[screenshot: MART_T1L07_html_2811e706]A spot light works in exactly the same way as a point light, but in a localized cone-shaped area: try switching from point to spot, and you'll see that the area within the cone is lit the same with either. Lets look now at a light that works very differently. Delete the spot light, get a Directional Light (right), and try moving it around. You'll find that it makes absolutely no difference where you place it, it lights the scene exactly the same. The reason is that a directional light illuminates the entire scene with light pointing from one particular direction, as if a point light were shining on it from an infinite distance away. The direction of the light can be altered by rotating the directional light: try it. These are often used as fill lights: very soft lighting to boost the light level of the shadow areas.

[screenshot: MART_T1L07_html_m7e3b9db2]Finally we have ambient lights: these are peculiar hybrids, with a confusing name. They combine a point light with a global lighting effect (known as ambient lighting, hence the confusion). They add brightness to every surface in the scene, as well as in the localized way that we saw with a point light.

Some light types do not work in the viewport the way they do in a render: namely Area Lights (which do not show up at all) and Volume Lights (which show up as point lights). I shall not cover these now, but I'll come back to them when we study lighting for rendering later on. Also, many parameters (e.g. Shadow Color, Emit Diffuse & Emit Specular) only make a difference in rendered images.

[screenshot: MART_T1L07_html_m6366a3d8]Before we have a go at putting all this into practice, grab another primitive (I used a torus) and put it near to your sphere. Delete the ambient light, and add a spot light that illuminates both (turn its Depth Map Shadows on). While we're here, select the spot light and on the viewport menu go to Panels → Look Through Selected (right). This allows us to position the spot light by treating it as a camera, which can be very helpful.

Once you've positioned it, go back to a perspective view. Say we wanted to add some backlight to the torus, but not to the sphere. We could try and get the cone of a spotlight just right so that it misses the sphere but catches the torus, but that's bound to cause problems later on.

Light Linking

Let's try a different method: get a directional light, and rotate it so that it's illuminating the torus from behind a little (don't worry about how it affects the other objects).

[screenshot: MART_T1L07_html_12628665]What we're going to use is the concept of light links. When you first create a light, it is linked with every object in the scene, and thus it illuminates every object (except if it is a spot light and the object is outside the cone, etc). Get the rendering set of menus up (F5), and click on Lighting/Shading → Select Objects Illuminated by Light. All of our objects will become selected: add the light to the selection, and click on Lighting/Shading → Break Light Links. At this stage it is almost as if we just deleted the light: we have broken its link with every object it was illuminating, so it is now illuminating nothing. Select the light and the torus, and click on Lighting/Shading → Make Light Links. This is the situation that we wanted: only the torus is affected by the directional light (right; I have made my directional light red to make it more obvious). Try rotating the light to check.

Now reload the scene we opened before:

~hbush/MART/T1L07/forlighting.ma

Before we start, either hide or delete the high polygon boxes. They'll make life very difficult if we leave them there, and they were only there to make the point about layers.

Now press 7 (Use All Lights mode). The objects will all go black, because we currently have no lights in the scene. Try placing lights in the scene to get a nice look (don't forget to turn viewport high-quality rendering and shadows on). Use different types of lights to simulate various real-life lights sources:

It's also worth thinking about simulating lights that don't exist in real-life. For example, the bright patch where the sun hits the wall will act like a light source and partially illuminate the rest of the room. This sort of light source is often referred to as a bounce light.