Maya102 Surfacing

download Maya102 Surfacing

of 22

Transcript of Maya102 Surfacing

  • 8/10/2019 Maya102 Surfacing

    1/22

    Maya 102: Surfacing, Lighting and Rendering

    1

    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

  • 8/10/2019 Maya102 Surfacing

    2/22

    Maya 102: Surfacing, Lighting and Rendering

    2

    Surfacing

    The Hypershade window (Window > RenderingEditors > Hypershade) is the main interface forcreating and editing shading networks forobjects.

    1. Plastic, Glass, Metal & Wood

    As a quick introduction to the Hypershade editor,we'll create a few simple textures for some of thelab equipment that we made last week. If yousaved your version of tube rack scene, then feelfree to use that. Otherwise, open the"tuberack.mb" file.

    By default, all objects are shaded using the

    default shader, called "lambert1." For our plastictube rack, we'll want to make a slightly shiniersurface with some color.

    In the left side of the Hypershade, under the'Surface' tab, press on 'PhongE.' Double clickon the 'phongE1' icon that appears in the workarea to open the attributes of the shader.Choose whatever color you like, and make thesurface look shinier by decreasing the HighlightSize. You can also increase the Reflectivity alittle. You should be able to see your changes inthe Material Sample sphere.

    To apply your shader to the tube rack, simplymiddle mouse click + drag your shader onto thetube rack. Alternatively, select the tube rack,then right click + hold on your shader until thepopup window appears. Select 'Assign Materialto Selection.' Do a quick render by clicking onthe render icon at the top of the screen. Theicon looks like this:

    Next, we'll make a glass shader for thetubes. Create a Phong shader, and this

    time make the color white and change the valueof the Transparency until it is a very light gray.

    Make the glass look shinier by increasing theCosine Power (to about 90). Increase thereflectivity to 0.7 or so.

    Take a quick render. You can see that the tubeslook transparent, but they aren't reflecting thetube rack or each other, and they also aren'trefracting the light as you would expect. To

    Creating a new PhongE shader in the Hypershade.

    The Render View window.

    The tubes are transparent, but not reflecting or refractingcorrectly.

  • 8/10/2019 Maya102 Surfacing

    3/22

    Maya 102: Surfacing, Lighting and Rendering

    3

    have surfaces properly reflect and refract, we'llneed to turn on raytracing.Raytracing options are turned on in the 'RenderSettings' window. You can open this by going toWindow > Rendering Editors > Render Settingsor clicking on this icon:

    Go to the 'Maya Software' tab and scrolldown to 'Raytracing Quality.' Turn onRaytracing and make sure Reflectionsand 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, scrolldown to 'Raytrace Options' and turn onRefractions. Change the Refractive index to 1.5or so, the Refraction Limit to 8, and the surfacethickness to around 0.05, and the ReflectionLimit to 8.

    Now take another render. You should see thatnow the glass reflects and refracts light morerealistically, and that the plastic is also reflectingthe tubes nicely.

    To make a chrome-like shader, create a Blinn.Change the color to black, increase theEccentricity to at least 0.5, and increase theSpecular Roll Off to 1. Change the SpecularColor to a light color - either white or slightly off-white. For chrome-like surfaces, the main colorthat's visible is actually the specular color, not

    the main color. Apply this shader to some of thetubes and do a render.

    Turning on Raytracing in the Render Settings window.

    Changing the Raytrace Options under glass shader

    Click on the checker icon to use a file for the color.

  • 8/10/2019 Maya102 Surfacing

    4/22

    Maya 102: Surfacing, Lighting and Rendering

    4

    For the surface that the tube rack is sitting on,we'll make a wood table texture. This texturewill be based on an image, and we'll use thisimage both for the color and to give the table alittle bumpiness. The image that we're usingwas downloaded from an online texture library(http://www.mayang.com/textures/).

    Create a new Blinn shader. Double click toopen 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 windowthat opens (the file Attribute editor) selectWood.jpg in the section that asks for the ImageName. You should see that the sphere icon forthe Blinn shader now has the wood color on it.Color the 'floor' surface with the wood shaderand take a render.

    You should see that the wood grains look hugeand blurry in the render. This is because theimage file has been stretched out to cover thesurface of the 'floor' geometry, which is a ratherlarge area. The image should be scaled downand tiled on the geometry. To do this, select thewood shader, and click on the 'input and outputconnections' icon in the top of the Hypershadewindow:

    This allows you to graphically see yourshading network. Double click on the'place2dTexture' node that's feeding into

    the file node.

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

    Now change the 'Repeat UV' value under the 2dTexture Placement Attributes to something like10 for both U and V. Now try a render. Youshould see that the wood is scaled to a morerealistic grain size. You can decrease the look

    of regular tiling by checking off 'Stagger.'

    One problem right now with the texture is that it'sperfectly smooth. To use the image file as abump map, middle-mouse drag the file nodeonto the Blinn node. Select 'bump map' from thepop-up menu. A 'bump2d' node should appear.

    If you do a render, you'll see that the bump is toostrong, causing the wood surface to look

    Select the 'File' option for the color.

    Wood shader input & output connections

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

    Addition of the bump2d node.

    Default settings for Bump2d need to be adjusted for this

  • 8/10/2019 Maya102 Surfacing

    5/22

    Maya 102: Surfacing, Lighting and Rendering

    5

    corrugated (and not at all like wood!) To fix this,double click on the Bump2d node and decreasethe bump depth to about 0.01. Render again.You should see that the bump is visible in thereflection, but is relatively subtle.

    Save your scene! We'll be opening it a little lateron when we start covering lighting.

    2. EM Shaders

    One popular and versatile shader is the EMshader. This attempts to mimic the lightingachieved by scanning EM microscopy, as shownin the E. coli image on the right. The edgeshave high contrast, and are thus the areaswhere you can see the most detail in the bump.

    There are at least a couple of ways to create thistype of look using the Hypershade. First, we'lluse the Ramp Shader to create a simple EMshader, and then we'll use utility nodes to createa more advanced and tunable shader.

    Open 'sigma_monomer.mb.' If you rememberfrom the importing class, we created a sigmamonomer with a ribbon and a surface. Each ofthese are labeled (check the Outliner).

    Create a new Ramp Shader surface in theHypershade (looks like a rainbow-colored

    sphere underneath Phong E). Double click onthe newly created shader and take a look at theattributes. In the 'color' attribute, select white.Create a second color box clicking somewherewithin the long rectangle, and choose black forthe 2nd color. Move the black slider all the wayto the right. Next, for the Color Input(underneath the ramp) select 'Facing Angle.'This instructs Maya to use the angle betweenthe surface normal and the camera to calculatethe color. If this angle is small (that is, thesurface is pointing at the camera) then thesurface appears black, whereas if the angle islarge, the surface appears white. Apply theshader to the protein surface and take a testrender.

    To create a more fuzzy, glowing effect, in theRamp Shader attributes, scroll down to the'Special Effects' tab and change the GlowIntensity to around 0.3. Do another render. Theprotein edges should now appear to be emittinglight, with a fuzzy halo surrounding the protein.

    The finished scene

    E. coli imaged with an scanning EM.

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

  • 8/10/2019 Maya102 Surfacing

    6/22

    Maya 102: Surfacing, Lighting and Rendering

    6

    We can also use the ramp shader to control thetransparency of the shader so that we can seethe ribbon structure underneath the surface.

    Create a new Ramp Shader, and choose asingle color (I chose a light blue). Select 'FacingAngle' for the color input. In the 'Transparency'tab, create a black-to-white gradient as shown tothe right. Apply this new shader to the proteinsurface and render the scene. You should beable to see the ribbon now.

    You can tweak the settings of the tranparencyby changing the colors of the ramp. Change thewhite color to a shade of gray by clicking on thesmall circle above the ramp and then clicking onthe 'Selected Color' box. You should see thatnow the surface is less transparent overall. Ifyou change the black to a shade of gray, theshader becomes more transparent.

    You can also make the ribbon glow in the sameway that we made our previous ramp shaderglow -- scroll down to the 'Special Effects' taband change the Glow Intensity to somethingbetween 0.3-0.5 For my example, I've created ablue Blinn shader for the ribbon.

    Nearly all the attributes of a shader can beanimated. As a quick example, we can animatethe position of the black color on thetransparency 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). Rightclick on the 'Selected Position' input in theTransparency tab of the Ramp Shader, and inthe pop-up window that appears, select 'SetKey.' The box should turn orange as shown onthe right. Next, move the current frame to theend of the timeline (by default, the timelineshould be 24 frames long). Move the black colormanually, or simply type in 1 in the 'Selected

    Position' box, and then right-click and set keyagain. As you scroll through the timeline, youshould see your shader sphere change frommore to less transparent. Render a few testframes, one from the beginning, one from themiddle, and one from the end.

    To create our next EM shader, we'll be usingMaya's utility nodes. These nodes, which canbe seen in the Hypershade panel if you scroll

    Using the Facing Angle to control the transparency allows

    Creating keyframes that change the position of the blackcolor of the transparency ramp. Scrolling through thetimeline allows you to see the animation in the shader

    sphere.

  • 8/10/2019 Maya102 Surfacing

    7/22

    Maya 102: Surfacing, Lighting and Rendering

    7

    down below the common surfacing nodes, arereally useful for creating animated and uniquetextures that may be difficult to create from out-of-the-box shader settings, and can also beused throughout Maya for many other purposesbeyond creating shaders.

    Create a new Phong shader, and choose a colorfor it. Apply this new shader to the sigmaprotein surface. We can create a facing angleshader out of any shader by using a utility nodecalled the "Sampler Info" node. Scroll down inthe left panel of the Hypershade to view theSampler Info node (under the General Utilitiestab). It looks like this:

    This node "Provides you with information abouteach point on a surface as it is being sampled,or calculated, for rendering purposes. SamplerInfo can give you information about a pointsposition in space, its orientation and tangency,and its location relative to the camera." (takenfrom Maya's Help file, which can give you agood idea of how you might use these utilitynodes).

    Look at the shading network of the new phongshader by pressing the 'graph input and ouput

    connections' button on the top of theHypershade menu (shown to the right).

    Next, click on the Sampler Info node buttonunder the General Utilities tab. You should see anew icon appear in the 'Work Area' section ofthe Hypershade. Double click on the SamplerInfo node to view its attributes.

    Notice that on the bottom, there's a 'FacingRatio' box. We want the transparency of ourphong shader to be controlled by the FacingRatio of the surface. To make the connection, inthe Hypershade Work Area, shift + middle-mouse drag the samplerInfo node onto the

    phong icon. This will open the ConnectionEditor. On the left (under Outputs) should bethe 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 'FacingRatio' on the right side, then on the right side,

    The Sampler Info attribute window.

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

    shader.

  • 8/10/2019 Maya102 Surfacing

    8/22

    Maya 102: Surfacing, Lighting and Rendering

    8

    find 'Transparency' and click on the + to expandit. Click on Transparency R G and B.

    You should notice that a few things happened.You phong icon should now look like an EMshader, and you should see that there are threeconnections between the samplerinfo node andthe phong node in the Work Area. If you mouse-over the arrows between nodes, you can seewhat attributes they connect. Try taking a testrender to make sure that the shader is workingcorrectly.

    At this point, we have a facing ratio shader thatis essentially the same as the Ramp shader wecreated earlier. For the next example, we'llcreate a shader whose transparency changesbased on the distance between the camera andthe protein.

    3. Distance from Camera shader

    Delete the connections you just made by clickingon the blue arrows and pressing delete. Thesamplerinfo node should still be there, but nowit's no longer connected to the phong node.

    Click on the 'Distance Between' utility node, alsounderneath the General Utilities tab. It looks likethis:

    Double click to take a look at its attributes. Wewant to use the distance between the cameraand the protein to change the transparency ofthe protein, so that at larger distances, theprotein surface is opaque, but closer it becomesmore transparent.

    So how do we connect the camera translationand protein translation to the Distance Betweennode? You can drag anything you see in theoutliner to the Hypershade by simply middle-mouse-dragging it to the Hypershade Work Areawindow. Do this for the 'persp' camera and theprotein surface -- you should see the icons asshown in the image on the right.

    To make the connections, Shift + middle-mouse-drag the 'persp' icon onto the 'distanceBetween'node. The camera attributes should appear onthe left side of the Connection Editor, and thedistanceBetween on the right. Connect thecamera's 'Translate' to 'Point 1' on the right side.

    The facing ratio shader network

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

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

    Connections are now made to the distanceBetween node.

  • 8/10/2019 Maya102 Surfacing

    9/22

    Maya 102: Surfacing, Lighting and Rendering

    9

    Next, connect the Translate of the proteinsurface to Point 2 of the distanceBetween node.

    Now if you click on the distanceBetween node toview its attributes, you can see that the boxesfor Point 1 and Point 2 have turned yellow, andthat as you move the camera in and out, thecoordinates of Point 1 change as well.

    One problem so far is that, while transparencyonly goes from 0 to 1, our distance value rangeis much larger than that. We need to add anextra node to limit the range of the'distanceBetween' information before we canfeed it into the phong transparency. To reset therange, we'll use the 'Remap Value' utility nodeunder the Color Utilities tab. This looks like this:

    Shift + middle-mouse drag the distanceBetweennode onto the remapValue node, and using theConnection Editor, connect the 'Distance'attribute on the left to the 'Input Value' on theright.

    Double click on the remapValue node to look atits attributes. Expand the 'Input and OutputRanges' section and change the values for InputMin and Max to 10 and 30. This basically saysthat for any input values below 10, the output willbe set to 0, and for any values above 30, theoutput will be set to 1. For inputs between 10and 30, the output will be scaled linearly

    between 0 and 1. We can now connect theremapValue node to the Phong TransparencyRGB.

    Now when you zoom in and out with the camera,the transparency changes (you can see thismost clearly in the sphere icon of the phong inthe Hypershade). However, it's working in theopposite way we want -- the surface becomesmore transparent farther away. To fix this, goback to the remapValue attributes and changethe Output Min to 1 and Output Max to 0. Nowthe shader should be working correctly. Take

    some test renders and admire your handiwork.

    Clever use of the utility nodes can also allow youto combine the facing angle shader with thedistance shader (though we won't be coveringthat here in the interest of time -- but experimentif you have extra time!)

    Remap value attribute window with new input values.

    Connecting the Remap value OutValue to the shaderTransparency R G B.

    The final shader network for the distance shader.

    Rendered images

  • 8/10/2019 Maya102 Surfacing

    10/22

    Maya 102: Surfacing, Lighting and Rendering

    10

    4. Villus Bump Mapping

    Remember the gut lumen villi you modeled lastweek? Now we're going to use bump maps togive the villi ridges, like you see in the image on

    the right.

    Open the "villus_shader_start.mb" file or yourown villi file from last week.

    Create a new Blinn or Lambert shader, anddouble click to open its attributes. Click on thechecker icon next to the Color. In the windowthat appears, click on "Fractal" under the 2DTextures tab. It looks like:

    Place the texture on the villi. You should seethe texture in the view window. If you don't,make sure that 'Hardware Texturing' is checkedoff under the 'Shading' menu in the perspcamera view window.

    You may be wondering why we're using theFractal in the 'color' channel and not the 'bump.'It's hard to view bump maps in open GL, andtends to be more inaccurate than looking atcolor patterns. So the idea is to use make surethat the pattern looks good and is placedcorrectly using the color channel, and then map

    the Fractal pattern onto Bump afterwards.

    You can see that the pattern is slightly stretchedout on the villi, which will work out great for thebumps since the bumps should be horizontalanyways. Play around a little with theplace2dTexture options by clicking on the nodein the Work Area of the Hypershade window.You can increase or decrease the stretching bychaging the 'Repeat UV' settings.

    Once the pattern is how you'd like it, map thefractal 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 (thearrow/line going straight from fractal1 to theblinn). Now the Fractal node should just becontrolling the bump, not color. Take a testrender.

    To adjust the fractal pattern interactively (ratherthan having to re-render after every change),

    Villi EM: Redux!

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

  • 8/10/2019 Maya102 Surfacing

    11/22

    Maya 102: Surfacing, Lighting and Rendering

    11

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

    After it's completed rendering (this typically

    takes a little longer than normal renders), click-drag on the render window to select an area torefresh. You can select the entire window if youlike, but usually a small section will work fineand will be faster to refresh. A red line shouldbe marked around your area of interest. Notethat you can make a new box whenever you like,and the engine will refresh. If you change yourcamera view, however, you will have to redo therender.

    Try changing the Bump2d depth or some othershader network attributes to see IPR at work.

    You may have noticed that, in the Hypershadewindow, underneath all of the shaders and 3Dtextures, there are a number of 3D textures aswell. While 2D textures can be thought of aswrapping around an object (like wrappingpaper), 3D textures actually go through anobject, like veins through marble.

    In the Hypershade, click on "Wood" under the3D textures tab. Delete the connectionsbetween the 2D fractal node and the Blinnshader. Connect the Wood node to the colorand bump of the Blinn shader in the work area

    by middle-mouse dragging Brownian onto theBlinn and selecting 'color,' then repeating for thebump map. Take a quick render.

    The wood rings are visible, but the textureappears too small.

    Notice that a 'place3DTexture' node hasappeared in the Hypershade as well as theOutliner. Select it in the Outliner and move it up.Using IPR, watch how the texture changes whenyou scale and rotate the 3dTexture manipulator.

    In the 'wood1' attributes, you can change anumber of settings for the color, placement andthickness of the rings. Try to adjust the settingsto mimic the EM of the villi ridges. Notice thatyou can increase the noise and ripples under the'Noise Attributes' tab.

    Experiment with other bumps, adding color andtransparency!

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

    Connecting the Wood 3D texture to the Blinn shader.

    Manipulating the 3dTexture in the View Window.

    The villi with wood bump map.

  • 8/10/2019 Maya102 Surfacing

    12/22

    Maya 102: Surfacing, Lighting and Rendering

    12

    5. Displacement v. Bump

    You may have noticed in the previous villi

    example that if you look closely at the edge of avillus, it's still completely smooth. This isbecause bump maps are essentially 'faked' -- noreal geometry is actually getting moved toproduce the bump texture.

    In this example, we'll quickly compare a bumpmap with a displacement map.

    Create a new scene in Maya and create aNURBS sphere with a radius of 2. Create a newBlinn shader, color it white, and assign it to thesphere. Assign a "bulge" texture to the Bump ofthe Blinn. If you have Hardware shading on, youshould see that your sphere now appears tohave its surface displaced.

    Duplicate the sphere and move it to the side.Create a new Blinn shader and assign it to theduplicate sphere. In the Hypershade, select thefirst Blinn shader (with the bulge bumpmap) andshift-select the new Blinn shader, and click onthe 'view input and outputconnections' button (shown to theright).

    Click on the shading group of the new Blinn

    shader (called BlinnSG2) to see its attributes.Now middle-mouse drag the bulge1 texture fromthe Hypershade window to the checkered flagnext to "Displacement mat." in the ShadingGroup attributes window. Now the bulge1texture is being applied to the Blinn1 bump, andthe Blinn2 displacement (you could have alsoclicked on the checkered box to select from anyof the normal 2D or 3D textures). In theHypershade, you should see that a new'DisplacementShader' node has been createdthat connects the bulge1 to the shading group ofthe Blinn2 shader.

    You won't be able to see the effect of thedisplacement map in your camera view window,however -- you'll need to render it to see theeffect of displacement.

    If you take a render, you may notice that thetops and bottoms of the displaced surface(sphere2) appears to be cut off.

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

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

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

  • 8/10/2019 Maya102 Surfacing

    13/22

    Maya 102: Surfacing, Lighting and Rendering

    13

    To fix this, click on the 2nd sphere and open it'sattributes. Scroll down to the 'DisplacementMap' tab and click on the 'Calculate BoundingBox Scale' to readjust the scale of the boundingbox. Depending on how big your displacementis, geometry may be cut off if you bounding boxis too small. You can also decrease the 'ExtraSample Rate' to 0 to decrease rendering time.Adjustments to the 'Initial Sample Rate' and'Extra Sample Rate' may be necessary if theresolution of your displacement map are notadequate.

    Now take another render -- the problem shouldbe fixed!

    Note that to adjust the height of thedisplacement, you will need to play with the'alpha Gain' or 'alpha Offset' in the bulge1attributes!

    Changing the displacement map settings in the attributes ofthe Sphere.

  • 8/10/2019 Maya102 Surfacing

    14/22

    Maya 102: Surfacing, Lighting and Rendering

    14

    Lighting

    1. Basic 3-Point Lighting

    Three point lighting is a commonly taught

    lighting scheme that uses a key, fill and rim lightto light a subject. Correct lighting allows forobjects to pop out from their surroundings andacquire a more realistic dimensionality.

    The basic setup is shown to the right. We'll trythis set up on our labware scene.

    Open the file 'tuberack_lighting_start.mb' or yourown 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 theyare pointing at what you want them to is to lookthrough them as through they were a camera.To do this, make sure the spotlight is selected inthe Outliner, then in the camera view window, goto Panels > Look through selected.

    Tumble and zoom until you have the tuberackcentered in the red circle. You want to light thetube rack at an angle, and shouldn't be directlyabove the camera. To see the perspectivecamera, which is hidden by default, click on'persp' in the Outliner and press 'H' to unhide it.

    Now that you have one light, you can turn off thedefault light. All Maya scenes open with anambient light that sheds light evenly on allsurfaces. This light has allowed us to previouslyrender objects without having to create a newlight.

    To turn off the default light, in the main viewwindow, select Lighting > Use All Lights (or '7').You can see that the unlit surfaces outside ofthe red circle have now turned black. To see theedges of the light more clearly, make sure thatRenderer > High Quality Rendering is turned onin the view panel. Take a render. Doesn't looktoo realistic, does it?

    Open the light attributes by double clicking onthe spotLight in the Outliner. Zoom out so thatyou encompass more of the area around thetube rack, and increase the Penumbra Angle toabout 30. As you can see in the your cameraview window, the penumbra changes the

    Positioning of lights for 3-point lighting, taken fromJeremy Birn's website:

    http://www.3drender.com/light/3point.html

    Lookin throu h the s otli ht and framin the tuberack.

    Zoomin out and chan in the enumbra of the ke li ht.

  • 8/10/2019 Maya102 Surfacing

    15/22

    Maya 102: Surfacing, Lighting and Rendering

    15

    intensity of the light around the edges of the spotlight 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 appearsmuch dimmer, and you will have to increase theintensity to compensate.

    Switch to the persp camera view, and take arender. There's something missing, right? Westill need to turn shadows on. There are twotypes of shadows in Maya: depth map, andraytraced.

    To turn on depth map shadows, open theSpotlight attributes, and scroll down to the'Shadows' tab and enable 'Use Depth MapShadows.' Take a render.

    There are some problems -- the shadow looksjagged, the shadows are too dark, and the tubeshave dark stripes! The jaggedness of theshadow is due to the resolution used, which istoo low for this rather large table surface. Wecould increase the resolution to get a smootherlook. Try increasing the resolution to 2048 andtake another render.

    To blur the shadows a little, change the FilterSize to 5. Take another render. We could havealso left the resolution at 512 and increased the

    Filter Size in order to achieve a bit of a blurriershadow. Finally, change the shadow color to ashade of gray.

    Next we're going to try out raytraced shadows.This method is more accurate, but more time-consuming during rendering.

    Scroll down to the Raytrace Shadow Atrributestab. Click on 'Use Ray Trace Shadows' ('UseDepth Map' will be turned off automatically). Ifyou were to try rendering now, you won't seeany shadows. We need to enable another

    setting, this time in the Render setting window.

    To open the render settings window, click on thisicon on the top menu:

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

    Spotlight attributes after adjustments.

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

    Shadow map attributes and final image.

  • 8/10/2019 Maya102 Surfacing

    16/22

    Maya 102: Surfacing, Lighting and Rendering

    16

    and scroll down to 'Raytracing Quality.' Click onthe 'Raytracing' box to turn it on. Take a render.

    The shadow is crisp, but not jagged, and youcan also see that there are lighter areas wherelight is passing through the glass of the tubes.By turning on Raytracing in the render options,we have also achieved a different look to theglass, as we talked about in the Shadingsection. To have the glass render morerealistically, you have to turn up the 'Reflections'and 'Refractions' numbers under 'RaytracingQuality.'

    We need to create another two lights to finishour 3 point lighting setup. Create a 2ndspotlight, the fill light, and position it on the otherside of the camera, as shown in the 3-pointlighting 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 beless bright than the key light (by around 50%).Change its attributes as we did with the keylight. The final light, the rim light, should bepositioned behind and above, and shouldhighlight the top edges of the tubes. Feel free touse different type of shadows on different lights,or having lights not emit shadows at all.

    For your final render, turn up the quality of therendering by opening the Render Settingswindow and changing the 'Quality' to 'ProductionQuality.' (at the top of the 'Maya Software' tab).

    This changes a number of settings, includingFiltering and Raytracing, to give you a nicerender.

    2. Lighting the Gut Lumen

    For lighting molecular scenes, which will likelytake place in a cell or organ, different lighteffects, such as fogs and glows come into gooduse.

    Open 'intestine_scene.mb.' This scene hasseveral duplicated villi planes that have beenrolled up into a tube using the bend deformerand warped using a lattice deformer (you willencounter these again in the animationssection!).

    Rather than using spotlights, we'll be using pointlights to light the scene. Since they emit light in

    Raytraced shadow.

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

    Use of fog in a molecular scene. Image by GrahamJohnson.

    The unlit intestine.

  • 8/10/2019 Maya102 Surfacing

    17/22

    Maya 102: Surfacing, Lighting and Rendering

    17

    all directions, they can be handy for lightingthings within tubes or other enclosed spaces.

    As we did before, turn off the default light in thecamera view window by pressing 7 or going toLighting > Use All Lights in the camera viewmenu.

    Create a point light by going to: Create > Lights> Point Light. If you double click on the newlycreated light in the Outliner and take a look at itsattributes, you'll notice that there are a lot feweroptions than there are for spotlights, but you canstill control the color, intensity and decay rate.

    Change the decay rate to 'linear' and increasethe intensity of the light a little, and change thecolor to a more yellowish hue. We'll light thescene with three point lights that are placedalong the length of our intestine model.

    You may have noticed that the rendered view isalways somewhat smaller than what we can seein the camera view. You can visualize therender area by selecting View > CameraSettings > Resolution Gate in the camera viewwindow. You should see a green box appear.

    Create a 2nd point light, and move it around,and change its attributes until you're happy. Ifyou move them close to the walls of theintestine, they have a more limited scope, whichmay be desirable for a more dramatic effect.

    The third point light should be located justbeyond the turning point of the intestine, to lightthe exit route. This could be a slightly differentcolor. In my example, I dimmed the first twopoint lights to give more emphasis to the third.

    Something worth thinking about when puttingtogether a composition like this is the rule ofthirds. In my example on the right, the lit exitpath, which is the center of interest, is situatedabout 2/3 up and 2/3 to the right, at one of thefour so-called 'power points.'

    Next, we'll add a fog effect that will give a littlemore depth to the composition. There are manyways to create fog effects in Maya. One of themost intuitive ways is to create a VolumePrimitive.

    Go to: Create > Volume Primitives > Cube. Thiswill create a wireframe object that is called 'box'

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

    2 point lights lighting the intestine.

    Addition of the third point light..

  • 8/10/2019 Maya102 Surfacing

    18/22

    Maya 102: Surfacing, Lighting and Rendering

    18

    in the Outliner. Scale it up so that itencompasses the entire intestine.

    Now go to the Hypershade. You should find thata 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 theother shading nodes that you've looked atbefore. The most noticeable difference is thecolor ramp. By default, this ramp isn't doinganything because the 'Color Ramp Input' is setto 'ignore.' Change it to 'Y Gradient' and do arender. You should see that you now have arainbow colored fog that changes color in the Ydirection.

    We actually aren't going to be using the ColorRamp, so set it back to 'Ignore.' Instead ofhaving a completely uniform fog, we'll give thefog a little texture by applying a pattern to it's

    transparency. Click on the checkered flag nextto the transparency attribute, and select 'Fractal'(or anything else you'd like to try). Return toyour previous view -- looking into the intestine --and do an IPR render. Play around with thesettings of the fractal node until you getsomething that you like. Remember that thefractal is feeding into transparency, and whiter =more transparent; darker = more opaque. Youmight want to change the fractal's 'threshold'value to change the overall lightness of thefractal pattern. Also try changing the color of thefog in the Cube fog attributes.

    Finally, we'll add some small glowing spheres tothe composition. These could represent anynumber of things in molecular animations -- ions,ATP, etc -- but here, perhaps they couldrepresent... bits of food?

    Create a NURBS sphere, scale it down, andplace it someplace in the intestine. Make a newshader in the Hypershade -- it doesn't matterwhat 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 checkthe 'Hide Source' box. Do a render. You cansee that the glow of the sphere is visible, but thesphere itself is hidden. if you increase theincandescence of the shader, this will have adramatic effect on the amount of glow you willhave. Play around with color and glow untilyou're satisfied with the results.

    Scaling and moving the Volume Primitive.

    Cube fog attributes

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

    Cube fog in the Hypershade with a fractal pattern

    feeding into its transparency.

  • 8/10/2019 Maya102 Surfacing

    19/22

    Maya 102: Surfacing, Lighting and Rendering

    19

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

    The final render, with glowing spheres.

  • 8/10/2019 Maya102 Surfacing

    20/22

    Maya 102: Surfacing, Lighting and Rendering

    20

    Rendering

    1. Batch Rendering

    Up until this point, we've only been rending asingle frame at a time and viewing them in theRender View window. Using Batch Rendering,we can tell Maya to render a series of framesand save them to the harddrive. This will occuras a background process, although we will beable to keep track of the rendering progressthrough the status line or the Script Editor.

    To get started, let's add some basic animation tothe lit gut scene.

    Make sure you're on frame 1 in the timeline, andselect one of the glowing Spheres. Press 'W'(make sure that's capitalized) to keyframe thetransformations of this sphere at frame 1. Youshould see that the translate X, Y and Z in thechannel box has now turned orange, indicatingthat those attributes are now keyframed.

    Move to frame 10 in the timeline, and move thesphere 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 theproject folders are all set up the way you expect.This is because the rendered images willautomatically be placed in the current directory's"images" folder, and you'll want to be sure youknow where that will be.

    Go to File > Projects > New and give the projecta name. At the bottom of the window, click on'Use Defaults.' This will create all the defaultdirectories, including the 'Images' directory.

    Now open the Render Setting windowby 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 theFile name prefix to 'gutScene,' and theframe/animation extension to 'name.#.ext.' Notethat you will not have the option to rendermultiple frames unless the extension is changedto have a #. Change the start and end frames (ifnecessary) to 1 and 10. This will result in, of

    The Render Settings window, set to render a 10-frameanimation

    Setting keyframes on the transforms for one of theglowing spheres.

  • 8/10/2019 Maya102 Surfacing

    21/22

    Maya 102: Surfacing, Lighting and Rendering

    21

    course, a 10-frame animation. You can alsochange the size of the image -- the smaller theimage, the faster the render time.

    Switch over to the 'Maya Software' tab. In theinterest of time, we'll use the lowest qualitysetting (Preview quality) to do a batch render.

    Change to the 'Rendering' menu (under the dropdown tab, or select F6) and select Render >Batch Render. Nothing obvious is going tohappen, but you'll see a little progress report inthe status line (gray bar) in the lower right cornerof the screen. You can also open the ScriptEditor to view the progress of the batch render.

    After the batch rendering is completed, take alook at your render using FCheck, an applicationthat comes packaged with Maya. In the MayaRender menu, go to Render > Show Batch

    Render. This will open an Fcheck window withthe last frame loaded in it.

    To open the animation, go to File > OpenAnimationin the FCheck window. Select thefirst frame (gutScene.1.iff). The images will beloaded into Fcheck, and it will start looping theanimation. If you want to slow the animationdown, you can click the minus key on thenumeric keypad.

    2. Toon Shading and Rendering

    For some scenes, particularly molecular scenes,it can be useful to go for a less photoreal, morecartoon or cel-shaded look. This can be easilyaccomplished using Maya's 'Toon' module.

    Open 'filament_scene_final.ma.' This scenecontains the actin-like filament that we made lastweek with a bend deformer.

    To get a better idea of what the various toonshaders look like, click on the 'Toon' shelf. Thefirst several icons show various shaders that youcan create. With the entire actin filamentselected, click on the third icon from the left(white/gray sphere). Alternatively, go to: Toon >Assign Fill Shader > Shaded Brightness TwoTonein the Rendering pull-down menu. Thiswill create a new ShadedBrightnessShaderwhich will be applied to all of the monomers inthe filament.

    Setting to 'Preview quality.'

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

    The FCheck window.

    The Toon Rendering shelf

  • 8/10/2019 Maya102 Surfacing

    22/22

    Maya 102: Surfacing, Lighting and Rendering

    22

    If you like, change the colors of the shader tosomething other than white and gray.

    If the filament appears to have a white, striped,semi-transparent shader on it, that means thatyou have to switch from the 'Default QualityRendering' to 'High Quality Rendering' (to dothis, in the camera view window, go to Renderer> High Quality Rendering).

    Next, create an outline around each monomerby selecting the filament, and selecting Toon >Assign Outline > Add New Toon Outlineor byclicking on the icon with an outlined sphere withthe plus sign in the Toon shelf. You will see thatthere is now a black outline that has beencreated around the monomers. Increase thethickness of the outline by changing the "LineWidth" to 0.3 (under the 'Common ToonAttributes' in the pfxToonShape1 node).

    To better see the outline in the rendered image,we can change the color of the background to alighter gray color. To do this, select the 'persp'camera in the Outliner, and view its attributes.Scroll down to the 'Environment' tab and changethe color to a light gray. Now if you take arender, you'll be able to see the outlines.

    Take a render.

    You may notice that the outlines are thin ornonexistent between two monomers that are

    adjacent to each other vertically. To fix this,check off 'intersection lines' in the pfxToon1attributes.

    Final toon-rendered filament

    Applying a shaded Brightness toon shader to theactin filament

    Changing the background color of the cameraenvironment will allow us to better view the toon

    outlines.

    The filament with outlines set to 0.3 thickness.

    Including intersection lines in the toon outline willcreate better separation between monomers