Maya 102: Surfacing, Lighting and Rendering

3 downloads 4381 Views 17MB Size Report
1) Rendering gut interior (Maya software rendering and Batch rendering). 2) Toon shading & ... Creating a new PhongE shader in the Hypershade. The Render ...
Maya 102: Surfacing, Lighting and Rendering Surfacing & Shading 1) Simple shaders: plastic, glass, metal and wood 2) EM (Facing Angle) shader 3) Distance from camera transparency shader 4) Villus bump map 5) Displacement maps vs. bump maps Lighting 1) 3 point lighting & shadows for the lab scene 2) Gut lumen lighting: fogs and glows

Rendering 1) Rendering gut interior (Maya software rendering and Batch rendering) 2) Toon shading & rendering

Maya 102: Surfacing, Lighting and Rendering 1

Surfacing The Hypershade window (Window > Rendering Editors > Hypershade) is the main interface for creating and editing shading networks for objects.

1. Plastic, Glass, Metal & Wood As a quick introduction to the Hypershade editor, we'll create a few simple textures for some of the lab equipment that we made last week. If you saved your version of tube rack scene, then feel free to use that. Otherwise, open the "tuberack.mb" file.

Creating a new PhongE shader in the Hypershade.

By default, all objects are shaded using the default shader, called "lambert1." For our plastic tube rack, we'll want to make a slightly shinier surface with some color. In the left side of the Hypershade, under the 'Surface' tab, press on 'PhongE.' Double click on the 'phongE1' icon that appears in the work area to open the attributes of the shader. Choose whatever color you like, and make the surface look shinier by decreasing the Highlight Size. You can also increase the Reflectivity a little. You should be able to see your changes in the Material Sample sphere. To apply your shader to the tube rack, simply middle mouse click + drag your shader onto the tube rack. Alternatively, select the tube rack, then right click + hold on your shader until the popup window appears. Select 'Assign Material to Selection.' Do a quick render by clicking on the render icon at the top of the screen. The icon looks like this:

The Render View window.

Next, we'll make a glass shader for the tubes. Create a Phong shader, and this time make the color white and change the value of the Transparency until it is a very light gray. Make the glass look shinier by increasing the Cosine Power (to about 90). Increase the reflectivity to 0.7 or so. Take a quick render. You can see that the tubes look transparent, but they aren't reflecting the tube rack or each other, and they also aren't refracting the light as you would expect. To

Maya 102: Surfacing, Lighting and Rendering 2

The tubes are transparent, but not reflecting or refracting correctly.

have surfaces properly reflect and refract, we'll need to turn on raytracing. Raytracing options are turned on in the 'Render Settings' window. You can open this by going to Window > Rendering Editors > Render Settings or clicking on this icon: Go to the 'Maya Software' tab and scroll down to 'Raytracing Quality.' Turn on Raytracing and make sure Reflections and Refractions are set to at least 8. Turn up the Anti-aliasing Quality (at the top) to 'Production Quality.' Next, under the glass shader Attributes, scroll down to 'Raytrace Options' and turn on Refractions. Change the Refractive index to 1.5 or so, the Refraction Limit to 8, and the surface thickness to around 0.05, and the Reflection Limit to 8.

Turning on Raytracing in the Render Settings window.

Now take another render. You should see that now the glass reflects and refracts light more realistically, and that the plastic is also reflecting the tubes nicely. To make a chrome-like shader, create a Blinn. Change the color to black, increase the Eccentricity to at least 0.5, and increase the Specular Roll Off to 1. Change the Specular Color to a light color - either white or slightly offwhite. For chrome-like surfaces, the main color that's visible is actually the specular color, not the main color. Apply this shader to some of the tubes and do a render.

Changing the Raytrace Options under glass shader Attributes.

Glass and chrome tubes, rendered using Raytracing. Click on the checker icon to use a file for the color.

Maya 102: Surfacing, Lighting and Rendering 3

For the surface that the tube rack is sitting on, we'll make a wood table texture. This texture will be based on an image, and we'll use this image both for the color and to give the table a little bumpiness. The image that we're using was downloaded from an online texture library (http://www.mayang.com/textures/). Create a new Blinn shader. Double click to open the shader Attributes. Click on the black & white checkered icon next to the Color slider. This opens the 'Create Render Node' window. Click on the 'File' button, and in the new window that opens (the file Attribute editor) select Wood.jpg in the section that asks for the Image Name. You should see that the sphere icon for the Blinn shader now has the wood color on it. Color the 'floor' surface with the wood shader and take a render.

Select the 'File' option for the color.

You should see that the wood grains look huge and blurry in the render. This is because the image file has been stretched out to cover the surface of the 'floor' geometry, which is a rather large area. The image should be scaled down and tiled on the geometry. To do this, select the wood shader, and click on the 'input and output connections' icon in the top of the Hypershade window: This allows you to graphically see your shading network. Double click on the 'place2dTexture' node that's feeding into the file node.

Wood shader input & output connections

In order to see your texture better in the Camera view, make sure Hardware Texturing is on (under the Shading menu in the Camera view window) and select 'High Quality Rendering' is checked under the 'Renderer' menu, also in the Camera view window.

Dragging the file onto the Blinn allows you to connect it to other shader attributes, including bump.

Now change the 'Repeat UV' value under the 2d Texture Placement Attributes to something like 10 for both U and V. Now try a render. You should see that the wood is scaled to a more realistic grain size. You can decrease the look of regular tiling by checking off 'Stagger.'

Addition of the bump2d node.

One problem right now with the texture is that it's perfectly smooth. To use the image file as a bump map, middle-mouse drag the file node onto the Blinn node. Select 'bump map' from the pop-up menu. A 'bump2d' node should appear. If you do a render, you'll see that the bump is too strong, causing the wood surface to look Maya 102: Surfacing, Lighting and Rendering 4

Default settings for Bump2d need to be adjusted for this surface.

corrugated (and not at all like wood!) To fix this, double click on the Bump2d node and decrease the bump depth to about 0.01. Render again. You should see that the bump is visible in the reflection, but is relatively subtle. Save your scene! We'll be opening it a little later on when we start covering lighting.

2. EM Shaders One popular and versatile shader is the EM shader. This attempts to mimic the lighting achieved by scanning EM microscopy, as shown in the E. coli image on the right. The edges have high contrast, and are thus the areas where you can see the most detail in the bump.

The finished scene

There are at least a couple of ways to create this type of look using the Hypershade. First, we'll use the Ramp Shader to create a simple EM shader, and then we'll use utility nodes to create a more advanced and tunable shader. Open 'sigma_monomer.mb.' If you remember from the importing class, we created a sigma monomer with a ribbon and a surface. Each of these are labeled (check the Outliner). Create a new Ramp Shader surface in the Hypershade (looks like a rainbow-colored sphere underneath Phong E). Double click on the newly created shader and take a look at the attributes. In the 'color' attribute, select white. Create a second color box clicking somewhere within the long rectangle, and choose black for the 2nd color. Move the black slider all the way to the right. Next, for the Color Input (underneath the ramp) select 'Facing Angle.' This instructs Maya to use the angle between the surface normal and the camera to calculate the color. If this angle is small (that is, the surface is pointing at the camera) then the surface appears black, whereas if the angle is large, the surface appears white. Apply the shader to the protein surface and take a test render.

E. coli imaged with an scanning EM.

To create a more fuzzy, glowing effect, in the Ramp Shader attributes, scroll down to the 'Special Effects' tab and change the Glow Intensity to around 0.3. Do another render. The protein edges should now appear to be emitting light, with a fuzzy halo surrounding the protein.

Ramp shader color and glow settings were changed as shown to achieve a black/white shader.

Maya 102: Surfacing, Lighting and Rendering 5

We can also use the ramp shader to control the transparency of the shader so that we can see the ribbon structure underneath the surface. Create a new Ramp Shader, and choose a single color (I chose a light blue). Select 'Facing Angle' for the color input. In the 'Transparency' tab, create a black-to-white gradient as shown to the right. Apply this new shader to the protein surface and render the scene. You should be able to see the ribbon now. You can tweak the settings of the tranparency by changing the colors of the ramp. Change the white color to a shade of gray by clicking on the small circle above the ramp and then clicking on the 'Selected Color' box. You should see that now the surface is less transparent overall. If you change the black to a shade of gray, the shader becomes more transparent. You can also make the ribbon glow in the same way that we made our previous ramp shader glow -- scroll down to the 'Special Effects' tab and change the Glow Intensity to something between 0.3-0.5 For my example, I've created a blue Blinn shader for the ribbon.

Using the Facing Angle to control the transparency allows us to see the ribbon underneath.

Nearly all the attributes of a shader can be animated. As a quick example, we can animate the position of the black color on the transparency ramp shader from left to right. What this will do is to make the protein appear more and more non-transparent over time. First, make sure that you're on the first keyframe (check the timeline on the bottom of the screen there should be a black rectangle on 1). Right click on the 'Selected Position' input in the Transparency tab of the Ramp Shader, and in the pop-up window that appears, select 'Set Key.' The box should turn orange as shown on the right. Next, move the current frame to the end of the timeline (by default, the timeline should be 24 frames long). Move the black color manually, or simply type in 1 in the 'Selected Position' box, and then right-click and set key again. As you scroll through the timeline, you should see your shader sphere change from more to less transparent. Render a few test frames, one from the beginning, one from the middle, and one from the end. To create our next EM shader, we'll be using Maya's utility nodes. These nodes, which can be seen in the Hypershade panel if you scroll Maya 102: Surfacing, Lighting and Rendering 6

Creating keyframes that change the position of the black color of the transparency ramp. Scrolling through the timeline allows you to see the animation in the shader sphere.

down below the common surfacing nodes, are really useful for creating animated and unique textures that may be difficult to create from outof-the-box shader settings, and can also be used throughout Maya for many other purposes beyond creating shaders. Create a new Phong shader, and choose a color for it. Apply this new shader to the sigma protein surface. We can create a facing angle shader out of any shader by using a utility node called the "Sampler Info" node. Scroll down in the left panel of the Hypershade to view the Sampler Info node (under the General Utilities tab). It looks like this:

The Sampler Info attribute window.

This node "Provides you with information about each point on a surface as it is being sampled, or calculated, for rendering purposes. Sampler Info can give you information about a point’s position in space, its orientation and tangency, and its location relative to the camera." (taken from Maya's Help file, which can give you a good idea of how you might use these utility nodes). Look at the shading network of the new phong shader by pressing the 'graph input and ouput connections' button on the top of the Hypershade menu (shown to the right). Next, click on the Sampler Info node button under the General Utilities tab. You should see a new icon appear in the 'Work Area' section of the Hypershade. Double click on the Sampler Info node to view its attributes. Notice that on the bottom, there's a 'Facing Ratio' box. We want the transparency of our phong shader to be controlled by the Facing Ratio of the surface. To make the connection, in the Hypershade Work Area, shift + middlemouse drag the samplerInfo node onto the phong icon. This will open the Connection Editor. On the left (under Outputs) should be the samplerInfo attributes, and on the right (under Inputs) should be the phong attributes. Make sure that these are on the correct sides! To create the connection, simply click on 'Facing Ratio' on the right side, then on the right side,

Using the Connection Editor to connect the Facing Ratio of the samplerInfo node to the Transparency of the phong shader.

Maya 102: Surfacing, Lighting and Rendering 7

find 'Transparency' and click on the + to expand it. Click on Transparency R G and B. You should notice that a few things happened. You phong icon should now look like an EM shader, and you should see that there are three connections between the samplerinfo node and the phong node in the Work Area. If you mouseover the arrows between nodes, you can see what attributes they connect. Try taking a test render to make sure that the shader is working correctly.

The facing ratio shader network

At this point, we have a facing ratio shader that is essentially the same as the Ramp shader we created earlier. For the next example, we'll create a shader whose transparency changes based on the distance between the camera and the protein.

3. Distance from Camera shader Delete the connections you just made by clicking on the blue arrows and pressing delete. The samplerinfo node should still be there, but now it's no longer connected to the phong node.

Hypershade Work Area with the camera and surface nodes added, but before connections are made.

Click on the 'Distance Between' utility node, also underneath the General Utilities tab. It looks like this:

Double click to take a look at its attributes. We want to use the distance between the camera and the protein to change the transparency of the protein, so that at larger distances, the protein surface is opaque, but closer it becomes more transparent.

Connecting the camera's translate coordinates to Point1 in the distanceBetween node using the Connection Editor.

So how do we connect the camera translation and protein translation to the Distance Between node? You can drag anything you see in the outliner to the Hypershade by simply middlemouse-dragging it to the Hypershade Work Area window. Do this for the 'persp' camera and the protein surface -- you should see the icons as shown in the image on the right. To make the connections, Shift + middle-mousedrag the 'persp' icon onto the 'distanceBetween' node. The camera attributes should appear on the left side of the Connection Editor, and the distanceBetween on the right. Connect the camera's 'Translate' to 'Point 1' on the right side.

Connections are now made to the distanceBetween node.

Maya 102: Surfacing, Lighting and Rendering 8

Next, connect the Translate of the protein surface to Point 2 of the distanceBetween node. Now if you click on the distanceBetween node to view its attributes, you can see that the boxes for Point 1 and Point 2 have turned yellow, and that as you move the camera in and out, the coordinates of Point 1 change as well. One problem so far is that, while transparency only goes from 0 to 1, our distance value range is much larger than that. We need to add an extra node to limit the range of the 'distanceBetween' information before we can feed it into the phong transparency. To reset the range, we'll use the 'Remap Value' utility node under the Color Utilities tab. This looks like this:

Remap value attribute window with new input values.

Shift + middle-mouse drag the distanceBetween node onto the remapValue node, and using the Connection Editor, connect the 'Distance' attribute on the left to the 'Input Value' on the right. Double click on the remapValue node to look at its attributes. Expand the 'Input and Output Ranges' section and change the values for Input Min and Max to 10 and 30. This basically says that for any input values below 10, the output will be set to 0, and for any values above 30, the output will be set to 1. For inputs between 10 and 30, the output will be scaled linearly between 0 and 1. We can now connect the remapValue node to the Phong Transparency RGB. Now when you zoom in and out with the camera, the transparency changes (you can see this most clearly in the sphere icon of the phong in the Hypershade). However, it's working in the opposite way we want -- the surface becomes more transparent farther away. To fix this, go back to the remapValue attributes and change the Output Min to 1 and Output Max to 0. Now the shader should be working correctly. Take some test renders and admire your handiwork.

Connecting the Remap value OutValue to the shader Transparency R G B.

The final shader network for the distance shader.

Clever use of the utility nodes can also allow you to combine the facing angle shader with the distance shader (though we won't be covering that here in the interest of time -- but experiment if you have extra time!)

Maya 102: Surfacing, Lighting and Rendering 9

Rendered images

4. Villus Bump Mapping Remember the gut lumen villi you modeled last week? Now we're going to use bump maps to give the villi ridges, like you see in the image on the right. Open the "villus_shader_start.mb" file or your own villi file from last week. Create a new Blinn or Lambert shader, and double click to open its attributes. Click on the checker icon next to the Color. In the window that appears, click on "Fractal" under the 2D Textures tab. It looks like:

Villi EM: Redux!

Place the texture on the villi. You should see the texture in the view window. If you don't, make sure that 'Hardware Texturing' is checked off under the 'Shading' menu in the persp camera view window. You may be wondering why we're using the Fractal in the 'color' channel and not the 'bump.' It's hard to view bump maps in open GL, and tends to be more inaccurate than looking at color patterns. So the idea is to use make sure that the pattern looks good and is placed correctly using the color channel, and then map the Fractal pattern onto Bump afterwards. You can see that the pattern is slightly stretched out on the villi, which will work out great for the bumps since the bumps should be horizontal anyways. Play around a little with the place2dTexture options by clicking on the node in the Work Area of the Hypershade window. You can increase or decrease the stretching by chaging the 'Repeat UV' settings.

The fractal mapped to color in the Hypershade and on the villi.

Once the pattern is how you'd like it, map the fractal to the bump map by middle mouse + dragging the fractal node onto the Blinn node, and selecting 'bump map' in the pop up window. Delete the connection for the color (the arrow/line going straight from fractal1 to the blinn). Now the Fractal node should just be controlling the bump, not color. Take a test render. To adjust the fractal pattern interactively (rather than having to re-render after every change), Maya 102: Surfacing, Lighting and Rendering 10

The fractal mapped to bump, and with the color connection deleted; the resulting render.

you can use Maya's IPR engine. To start IPR, click on the IPR icon on the top of the main menu or on the top of the Render View window:

After it's completed rendering (this typically takes a little longer than normal renders), clickdrag on the render window to select an area to refresh. You can select the entire window if you like, but usually a small section will work fine and will be faster to refresh. A red line should be marked around your area of interest. Note that you can make a new box whenever you like, and the engine will refresh. If you change your camera view, however, you will have to redo the render.

Using the IPR engine allows you get instantaneous feedback on changes to textures in the Render Window.

Try changing the Bump2d depth or some other shader network attributes to see IPR at work. Connecting the Wood 3D texture to the Blinn shader.

You may have noticed that, in the Hypershade window, underneath all of the shaders and 3D textures, there are a number of 3D textures as well. While 2D textures can be thought of as wrapping around an object (like wrapping paper), 3D textures actually go through an object, like veins through marble. In the Hypershade, click on "Wood" under the 3D textures tab. Delete the connections between the 2D fractal node and the Blinn shader. Connect the Wood node to the color and bump of the Blinn shader in the work area by middle-mouse dragging Brownian onto the Blinn and selecting 'color,' then repeating for the bump map. Take a quick render.

Manipulating the 3dTexture in the View Window.

The wood rings are visible, but the texture appears too small. Notice that a 'place3DTexture' node has appeared in the Hypershade as well as the Outliner. Select it in the Outliner and move it up. Using IPR, watch how the texture changes when you scale and rotate the 3dTexture manipulator. In the 'wood1' attributes, you can change a number of settings for the color, placement and thickness of the rings. Try to adjust the settings to mimic the EM of the villi ridges. Notice that you can increase the noise and ripples under the 'Noise Attributes' tab. Experiment with other bumps, adding color and transparency!

The villi with wood bump map.

Maya 102: Surfacing, Lighting and Rendering 11

5. Displacement v. Bump You may have noticed in the previous villi example that if you look closely at the edge of a villus, it's still completely smooth. This is because bump maps are essentially 'faked' -- no real geometry is actually getting moved to produce the bump texture. In this example, we'll quickly compare a bump map with a displacement map. Create a new scene in Maya and create a NURBS sphere with a radius of 2. Create a new Blinn shader, color it white, and assign it to the sphere. Assign a "bulge" texture to the Bump of the Blinn. If you have Hardware shading on, you should see that your sphere now appears to have its surface displaced.

The bump-mapped sphere in the perspective view and the shader network in the Hypershade.

Duplicate the sphere and move it to the side. Create a new Blinn shader and assign it to the duplicate sphere. In the Hypershade, select the first Blinn shader (with the bulge bumpmap) and shift-select the new Blinn shader, and click on the 'view input and output connections' button (shown to the right). Click on the shading group of the new Blinn shader (called BlinnSG2) to see its attributes. Now middle-mouse drag the bulge1 texture from the Hypershade window to the checkered flag next to "Displacement mat." in the Shading Group attributes window. Now the bulge1 texture is being applied to the Blinn1 bump, and the Blinn2 displacement (you could have also clicked on the checkered box to select from any of the normal 2D or 3D textures). In the Hypershade, you should see that a new 'DisplacementShader' node has been created that connects the bulge1 to the shading group of the Blinn2 shader.

Opening the attributes of the Shading Group node of allows you to map a displacement material.

You won't be able to see the effect of the displacement map in your camera view window, however -- you'll need to render it to see the effect of displacement. If you take a render, you may notice that the tops and bottoms of the displaced surface (sphere2) appears to be cut off.

The displaced surface on the right seems to have gotten cut off on the top and bottom.

Maya 102: Surfacing, Lighting and Rendering 12

To fix this, click on the 2nd sphere and open it's attributes. Scroll down to the 'Displacement Map' tab and click on the 'Calculate Bounding Box Scale' to readjust the scale of the bounding box. Depending on how big your displacement is, geometry may be cut off if you bounding box is too small. You can also decrease the 'Extra Sample Rate' to 0 to decrease rendering time. Adjustments to the 'Initial Sample Rate' and 'Extra Sample Rate' may be necessary if the resolution of your displacement map are not adequate.

Changing the displacement map settings in the attributes of the Sphere.

Now take another render -- the problem should be fixed! Note that to adjust the height of the displacement, you will need to play with the 'alpha Gain' or 'alpha Offset' in the bulge1 attributes!

A sphere with a bulge texture bumpmap (left) and displacement map (right).

Maya 102: Surfacing, Lighting and Rendering 13

Lighting

1. Basic 3-Point Lighting Three point lighting is a commonly taught lighting scheme that uses a key, fill and rim light to light a subject. Correct lighting allows for objects to pop out from their surroundings and acquire a more realistic dimensionality. The basic setup is shown to the right. We'll try this set up on our labware scene. Open the file 'tuberack_lighting_start.mb' or your own scene file. Create a new Spotlight by going to Create > Lights > Spot Light. This will be the key light. A relatively intuitive way to move lights so that they are pointing at what you want them to is to look through them as through they were a camera. To do this, make sure the spotlight is selected in the Outliner, then in the camera view window, go to Panels > Look through selected. Tumble and zoom until you have the tuberack centered in the red circle. You want to light the tube rack at an angle, and shouldn't be directly above the camera. To see the perspective camera, which is hidden by default, click on 'persp' in the Outliner and press 'H' to unhide it.

Positioning of lights for 3-point lighting, taken from Jeremy Birn's website: http://www.3drender.com/light/3point.html

Now that you have one light, you can turn off the default light. All Maya scenes open with an ambient light that sheds light evenly on all surfaces. This light has allowed us to previously render objects without having to create a new light. To turn off the default light, in the main view window, select Lighting > Use All Lights (or '7'). You can see that the unlit surfaces outside of the red circle have now turned black. To see the edges of the light more clearly, make sure that Renderer > High Quality Rendering is turned on in the view panel. Take a render. Doesn't look too realistic, does it?

Looking through the spotlight and framing the tuberack.

Open the light attributes by double clicking on the spotLight in the Outliner. Zoom out so that you encompass more of the area around the tube rack, and increase the Penumbra Angle to about 30. As you can see in the your camera view window, the penumbra changes the Zooming out and changing the penumbra of the key light.

Maya 102: Surfacing, Lighting and Rendering 14

intensity of the light around the edges of the spot light so that it drops off more gradually. By default, the intensity of the light is constant, no matter how close or far you are to the light. To introduce light decay, select 'Linear' in the 'Decay Rate' attribute. The light now appears much dimmer, and you will have to increase the intensity to compensate.

Spotlight attributes after adjustments.

Switch to the persp camera view, and take a render. There's something missing, right? We still need to turn shadows on. There are two types of shadows in Maya: depth map, and raytraced. To turn on depth map shadows, open the Spotlight attributes, and scroll down to the 'Shadows' tab and enable 'Use Depth Map Shadows.' Take a render. There are some problems -- the shadow looks jagged, the shadows are too dark, and the tubes have dark stripes! The jaggedness of the shadow is due to the resolution used, which is too low for this rather large table surface. We could increase the resolution to get a smoother look. Try increasing the resolution to 2048 and take another render.

First run depth map shadowing. Notice the jaggies and strange lines on the tubes.

To blur the shadows a little, change the Filter Size to 5. Take another render. We could have also left the resolution at 512 and increased the Filter Size in order to achieve a bit of a blurrier shadow. Finally, change the shadow color to a shade of gray. Next we're going to try out raytraced shadows. This method is more accurate, but more timeconsuming during rendering. Scroll down to the Raytrace Shadow Atrributes tab. Click on 'Use Ray Trace Shadows' ('Use Depth Map' will be turned off automatically). If you were to try rendering now, you won't see any shadows. We need to enable another setting, this time in the Render setting window. To open the render settings window, click on this icon on the top menu:

Make sure that 'Maya Software' is selected in the 'Render Using:' option at the top of the window, then switch to the 'Maya Software' tab

Shadow map attributes and final image.

Maya 102: Surfacing, Lighting and Rendering 15

and scroll down to 'Raytracing Quality.' Click on the 'Raytracing' box to turn it on. Take a render. The shadow is crisp, but not jagged, and you can also see that there are lighter areas where light is passing through the glass of the tubes. By turning on Raytracing in the render options, we have also achieved a different look to the glass, as we talked about in the Shading section. To have the glass render more realistically, you have to turn up the 'Reflections' and 'Refractions' numbers under 'Raytracing Quality.' We need to create another two lights to finish our 3 point lighting setup. Create a 2nd spotlight, the fill light, and position it on the other side of the camera, as shown in the 3-point lighting diagram at the beginning of this tutorial. Orient it so that's it's more at 'eye-level' with the tube rack, rather than from above. It should be less bright than the key light (by around 50%). Change its attributes as we did with the key light. The final light, the rim light, should be positioned behind and above, and should highlight the top edges of the tubes. Feel free to use different type of shadows on different lights, or having lights not emit shadows at all.

Raytraced shadow.

Three-point lighting of the tube rack, with high quality rendering..

For your final render, turn up the quality of the rendering by opening the Render Settings window and changing the 'Quality' to 'Production Quality.' (at the top of the 'Maya Software' tab). This changes a number of settings, including Filtering and Raytracing, to give you a nice render.

2. Lighting the Gut Lumen For lighting molecular scenes, which will likely take place in a cell or organ, different light effects, such as fogs and glows come into good use.

Use of fog in a molecular scene. Image by Graham Johnson.

Open 'intestine_scene.mb.' This scene has several duplicated villi planes that have been rolled up into a tube using the bend deformer and warped using a lattice deformer (you will encounter these again in the animations section!). Rather than using spotlights, we'll be using point lights to light the scene. Since they emit light in The unlit intestine.

Maya 102: Surfacing, Lighting and Rendering 16

all directions, they can be handy for lighting things within tubes or other enclosed spaces. As we did before, turn off the default light in the camera view window by pressing 7 or going to Lighting > Use All Lights in the camera view menu. Create a point light by going to: Create > Lights > Point Light. If you double click on the newly created light in the Outliner and take a look at its attributes, you'll notice that there are a lot fewer options than there are for spotlights, but you can still control the color, intensity and decay rate. Change the decay rate to 'linear' and increase the intensity of the light a little, and change the color to a more yellowish hue. We'll light the scene with three point lights that are placed along the length of our intestine model.

Creating and moving a point light close to the opening of the intestine model.

You may have noticed that the rendered view is always somewhat smaller than what we can see in the camera view. You can visualize the render area by selecting View > Camera Settings > Resolution Gate in the camera view window. You should see a green box appear. Create a 2nd point light, and move it around, and change its attributes until you're happy. If you move them close to the walls of the intestine, they have a more limited scope, which may be desirable for a more dramatic effect. The third point light should be located just beyond the turning point of the intestine, to light the exit route. This could be a slightly different color. In my example, I dimmed the first two point lights to give more emphasis to the third.

2 point lights lighting the intestine.

Something worth thinking about when putting together a composition like this is the rule of thirds. In my example on the right, the lit exit path, which is the center of interest, is situated about 2/3 up and 2/3 to the right, at one of the four so-called 'power points.' Next, we'll add a fog effect that will give a little more depth to the composition. There are many ways to create fog effects in Maya. One of the most intuitive ways is to create a Volume Primitive. Go to: Create > Volume Primitives > Cube. This will create a wireframe object that is called 'box' Maya 102: Surfacing, Lighting and Rendering 17

Addition of the third point light..

in the Outliner. Scale it up so that it encompasses the entire intestine. Now go to the Hypershade. You should find that a new Shading node has been created called 'cubeFog.' If you open it to view its attributes, you'll notice that it's a little different from the other shading nodes that you've looked at before. The most noticeable difference is the color ramp. By default, this ramp isn't doing anything because the 'Color Ramp Input' is set to 'ignore.' Change it to 'Y Gradient' and do a render. You should see that you now have a rainbow colored fog that changes color in the Y direction. We actually aren't going to be using the Color Ramp, so set it back to 'Ignore.' Instead of having a completely uniform fog, we'll give the fog a little texture by applying a pattern to it's transparency. Click on the checkered flag next to the transparency attribute, and select 'Fractal' (or anything else you'd like to try). Return to your previous view -- looking into the intestine -and do an IPR render. Play around with the settings of the fractal node until you get something that you like. Remember that the fractal is feeding into transparency, and whiter = more transparent; darker = more opaque. You might want to change the fractal's 'threshold' value to change the overall lightness of the fractal pattern. Also try changing the color of the fog in the Cube fog attributes.

Scaling and moving the Volume Primitive.

Cube fog attributes

Finally, we'll add some small glowing spheres to the composition. These could represent any number of things in molecular animations -- ions, ATP, etc -- but here, perhaps they could represent... bits of food? Cube fog in the Hypershade with a fractal pattern feeding into its transparency.

Create a NURBS sphere, scale it down, and place it someplace in the intestine. Make a new shader in the Hypershade -- it doesn't matter what kind -- and apply it to your sphere. Select a light color for the new shader. Scroll down to the 'Special Effects' tab and set the 'Glow Intensity' to something like 0.4, and check the 'Hide Source' box. Do a render. You can see that the glow of the sphere is visible, but the sphere itself is hidden. if you increase the incandescence of the shader, this will have a dramatic effect on the amount of glow you will have. Play around with color and glow until you're satisfied with the results. Maya 102: Surfacing, Lighting and Rendering 18

Cube fog in the Hypershade with a fractal pattern feeding into its transparency.

Create several spheres of various sizes, move them around, and apply the glow shader. Finally, do a high quality render.

The final render, with glowing spheres.

Maya 102: Surfacing, Lighting and Rendering 19

Rendering 1. Batch Rendering Up until this point, we've only been rending a single frame at a time and viewing them in the Render View window. Using Batch Rendering, we can tell Maya to render a series of frames and save them to the harddrive. This will occur as a background process, although we will be able to keep track of the rendering progress through the status line or the Script Editor.

Setting keyframes on the transforms for one of the glowing spheres.

To get started, let's add some basic animation to the lit gut scene. Make sure you're on frame 1 in the timeline, and select one of the glowing Spheres. Press 'W' (make sure that's capitalized) to keyframe the transformations of this sphere at frame 1. You should see that the translate X, Y and Z in the channel box has now turned orange, indicating that those attributes are now keyframed. Move to frame 10 in the timeline, and move the sphere so it's at a different location in the scene. Repeat this for a few of the spheres. Before rendering, you should make sure that the project folders are all set up the way you expect. This is because the rendered images will automatically be placed in the current directory's "images" folder, and you'll want to be sure you know where that will be. Go to File > Projects > New and give the project a name. At the bottom of the window, click on 'Use Defaults.' This will create all the default directories, including the 'Images' directory. Now open the Render Setting window by clicking on the icon shown to the left. Make sure that 'Maya Software' is selected under the 'Render Using' tab. As shown in the image on the right, change the File name prefix to 'gutScene,' and the frame/animation extension to 'name.#.ext.' Note that you will not have the option to render multiple frames unless the extension is changed to have a #. Change the start and end frames (if necessary) to 1 and 10. This will result in, of The Render Settings window, set to render a 10-frame animation

Maya 102: Surfacing, Lighting and Rendering 20

course, a 10-frame animation. You can also change the size of the image -- the smaller the image, the faster the render time. Switch over to the 'Maya Software' tab. In the interest of time, we'll use the lowest quality setting (Preview quality) to do a batch render. Change to the 'Rendering' menu (under the drop down tab, or select F6) and select Render > Batch Render. Nothing obvious is going to happen, but you'll see a little progress report in the status line (gray bar) in the lower right corner of the screen. You can also open the Script Editor to view the progress of the batch render. After the batch rendering is completed, take a look at your render using FCheck, an application that comes packaged with Maya. In the Maya Render menu, go to Render > Show Batch Render. This will open an Fcheck window with the last frame loaded in it. To open the animation, go to File > Open Animation in the FCheck window. Select the first frame (gutScene.1.iff). The images will be loaded into Fcheck, and it will start looping the animation. If you want to slow the animation down, you can click the minus key on the numeric keypad.

Setting to 'Preview quality.'

The status line, showing how many frames of the batch render are finished.

2. Toon Shading and Rendering For some scenes, particularly molecular scenes, it can be useful to go for a less photoreal, more cartoon or cel-shaded look. This can be easily accomplished using Maya's 'Toon' module. Open 'filament_scene_final.ma.' This scene contains the actin-like filament that we made last week with a bend deformer. To get a better idea of what the various toon shaders look like, click on the 'Toon' shelf. The first several icons show various shaders that you can create. With the entire actin filament selected, click on the third icon from the left (white/gray sphere). Alternatively, go to: Toon > Assign Fill Shader > Shaded Brightness Two Tone in the Rendering pull-down menu. This will create a new ShadedBrightnessShader which will be applied to all of the monomers in the filament. Maya 102: Surfacing, Lighting and Rendering 21

The FCheck window.

The Toon Rendering shelf

If you like, change the colors of the shader to something other than white and gray. If the filament appears to have a white, striped, semi-transparent shader on it, that means that you have to switch from the 'Default Quality Rendering' to 'High Quality Rendering' (to do this, in the camera view window, go to Renderer > High Quality Rendering). Next, create an outline around each monomer by selecting the filament, and selecting Toon > Assign Outline > Add New Toon Outline or by clicking on the icon with an outlined sphere with the plus sign in the Toon shelf. You will see that there is now a black outline that has been created around the monomers. Increase the thickness of the outline by changing the "Line Width" to 0.3 (under the 'Common Toon Attributes' in the pfxToonShape1 node). To better see the outline in the rendered image, we can change the color of the background to a lighter gray color. To do this, select the 'persp' camera in the Outliner, and view its attributes. Scroll down to the 'Environment' tab and change the color to a light gray. Now if you take a render, you'll be able to see the outlines.

Applying a shaded Brightness toon shader to the actin filament

The filament with outlines set to 0.3 thickness.

Take a render. You may notice that the outlines are thin or nonexistent between two monomers that are adjacent to each other vertically. To fix this, check off 'intersection lines' in the pfxToon1 attributes.

Changing the background color of the camera environment will allow us to better view the toon outlines.

Final toon-rendered filament

Including intersection lines in the toon outline will create better separation between monomers

Maya 102: Surfacing, Lighting and Rendering 22