42
mental ray: Introduction to Materials, Shaders and Global Illumination Realistic lighting is an important part of architectural simulation. In Autodesk VIZ 2005, simulating realistic lighting is quite easy to do. Since all of the lights possess real-world properties, you can place them just as you would place a regular light. The radiosity and rendering engines will do the rest, providing a physically accurate model of light effects in your model. Photometric lights use light energy values that enable you to accurately define lights as they are in the real world. You can set their distribution, intensity, color temperature, and other real-world lighting characteristics. You can also import specific photometric files available from lighting manufacturers to design lighting that is based on commercially available lights. Objectives In this tutorial, you will learn how to: • Review a model that was built in Autodesk Architectural Desktop and link the drawing to Autodesk VIZ. • Hide/Unhide objects by layer. • Create mental ray materials and apply them to the scene. • Use the Asset Browser to merge lighting components. • Manage multiple lights in a scene, and control the settings of instanced lights. • Work with Global Illumination and see how it improves your renderings. mental ray: Introduction to Materials, Shaders and Global Illumination

Maya Tutorials - Materials, Shaders and Global Illumination

Embed Size (px)

Citation preview

Page 1: Maya Tutorials - Materials, Shaders and Global Illumination

mental ray: Introduction toMaterials, Shaders and GlobalIlluminationRealistic lighting is an important part ofarchitectural simulation. In Autodesk VIZ2005, simulating realistic lighting is quiteeasy to do. Since all of the lights possessreal-world properties, you can place themjust as you would place a regular light. Theradiosity and rendering engines will do therest, providing a physically accurate modelof light effects in your model.

Photometric lights use light energy valuesthat enable you to accurately define lights asthey are in the real world. You can set theirdistribution, intensity, color temperature,and other real-world lighting characteristics.You can also import specific photometricfiles available from lighting manufacturers todesign lighting that is based on commerciallyavailable lights.

Objectives

In this tutorial, you will learn how to:

• Review a model that was built inAutodesk Architectural Desktop and linkthe drawing to Autodesk VIZ.

• Hide/Unhide objects by layer.

• Create mental ray materials and applythem to the scene.

• Use the Asset Browser to merge lightingcomponents.

• Manage multiple lights in a scene, andcontrol the settings of instanced lights.

• Work with Global Illumination and seehow it improves your renderings.

mental ray: Introduction to Materials,Shaders and Global Illumination

Page 2: Maya Tutorials - Materials, Shaders and Global Illumination

2 Chapter 1: mental ray: Introduction to Materials, Shaders and Global Illumination

• Create stylized renderings using mentalray shaders.

• Optimize system performance when usingGlobal Illumination.

Skill Level: Intermediate

Time to Complete: 2 hours (depending onhardware)

Files for This Tutorial

Before doing the tutorials, unzip the samplefiles to your \program files\autodesk viz2005\tutorials folder.

In This Tutorial

Lesson 1 – Review and Link the Model (page 2 )

Lesson 2 – Add Materials to the Gallery (page 9 )

Lesson 3 – Add Lights to the Gallery (page 22)

Lesson 4 – Stylize the Rendered Output (page 34)

Lesson 1 – Review and Link theModelBefore starting the scene, it’s a good practiceto review the model to get a feel for whatyou’re going to be working with. In mostcases, you will be given a model withoutmuch information about where it camefrom or who drew it. By looking over themodel and it’s structure, you can formulatea better plan for working on the model inAutodesk VIZ 2005.

In this lesson, you’ll look over the modelin Autodesk Architectural Desktop andthen use File Link to link the model toAutodesk VIZ 2005.

Set up the lesson:

1. Start Architectural Desktop, and chooseFile > Open.

2. Find the \program files\autodesk viz2005\tutorials\gallery folder on your harddrive and highlight tut_tulipgallery.dwg,then click Open.

The drawing opens in a quad viewportformat.

Review the model

When you receive a model, it’s always goodto have an idea of the types of object you’regoing to be working with, how the layerstructure has been set up and pinpoint anyobjects that may cause a problem when youlink the model to Autodesk VIZ 2005.

Now that the model is open, you can startlooking it over to determine the best way toproceed.

1. In the Top viewport, at the upper left, usethe Pan and Zoom commands to highlightthe left-most finger of the building.

This is where you’ll be doing most of thework. If you want, you can similarly pan

Page 3: Maya Tutorials - Materials, Shaders and Global Illumination

Lesson 1 – Review and Link the Model 3

and zoom in the Left view, the lower left,and the Front view, the upper right.

2. Left click in the 3D viewport, at the lowerright, and select the cyan object at the topof the staircase.

3. Right-click and choose Properties fromthe flyout menu.

In the Properties palette, notice that thisis a 3D Solid meaning that it will nothave any styles associated with it as if itwere a Slab object created in ArchitecturalDesktop.

4. Right-click in the viewport and chooseDeselect All from the flyout menu.

5. Click the gold windows running along thestairway.

It shows up in the Properties palette asa Curtain Wall. The Curtain Wall is anArchitectural Desktop object that can bealtered parametrically by entering newvalues in the Properties palette or byediting its Style.

6. Right-click in the viewport and chooseDeselect All and also close the Propertiespalette.

7. On the menu bar, choose Format > LayerManagement > Layer Properties Manager.

The Layer Properties Manager gives youa view of the layer structure and naming

Page 4: Maya Tutorials - Materials, Shaders and Global Illumination

4 Chapter 1: mental ray: Introduction to Materials, Shaders and Global Illumination

used in the model. This informationis important if you plan to use the FileLink Manager to link the model toAutodesk VIZ.

The state of a layer is important whenconsidering File Link. Layers that arefrozen will not link to Autodesk VIZunless you specifically choose thoselayers. By freezing layers, such as theannotation layers, you can reduce thesize of the scene when it is linked toAutodesk VIZ.

Layers that are turned off, will link toAutodesk VIZ but will link in the turnedoff state.

8. Click Cancel to dismiss the LayerManager.

9. Exit Architectural Desktop.

Now that you’re a little more familiarwith the model and its structure, youcan proceed to work on the model inAutodesk VIZ.

Set units and check unit scale

When you start Autodesk VIZ, the default,display units setting is a generic unit. Itmakes better sense to set the units to anarchitectural format. You’ll do that now.

1. Start Autodesk VIZ and open theCustomize menu.

2. Choose Units Setup and turn on USStandard in the Display Unit Scale group.

Leave the unit system at Feet w/DecimalInches and leave the Default Units set toFeet.

3. Click the System Unit Setup button andmake sure the System Unit Scale is set toInches.

4. Click OK to close the System Unit Scaledialog and then again to close the UnitsSetup dialog.

Link the model to Autodesk VIZ

In this section, you’ll use the File LinkManager to link the drawing file toAutodesk VIZ. Using File Link offers moreflexibility in case any changes occur to theoriginal drawing in Architectural Desktop.

Page 5: Maya Tutorials - Materials, Shaders and Global Illumination

Lesson 1 – Review and Link the Model 5

When a change occurs, you can quicklyreload the Autodesk VIZ scene and continueworking. If the drawing were imported intoAutodesk VIZ, then you may end up havingto scrap the entire scene if the designermakes extensive changes.

1. From the File menu, choose File LinkManager.

The File Link Manager dialog is displayed.

2. Click the File button and browse to the\tutorials\gallery folder on your harddrive and highlight tut_tulipgallery.dwg,then click Open.

3. Click the Attach This File button and clickOK on the File Link Settings dialog.

The model is linked into Autodesk VIZ.

4. Close the File Link Manager dialog.

5. Click the Min/Max Toggle to changethe viewport to the quad viewport layout.

This layout closely matches the fourviewports you saw when the model wasopen in Architectural Desktop.

6. Click Zoom Extents All to display thegallery in each viewport.

Hide the roof

Notice that the model was built with a roof;all you see is the complete exterior structure.Before adding a camera to the scene, you canhide the roof to show the interior.

1. From the Main Toolbar, click theLayer Manager button.

The Layer Manager dialog is displayed.

Page 6: Maya Tutorials - Materials, Shaders and Global Illumination

6 Chapter 1: mental ray: Introduction to Materials, Shaders and Global Illumination

2. Scroll down the list of layers and find theRoof layer.

Notice the layer name has a plus symbolto the left of it. This means the layercontains at least one object.

3. Click the plus symbol to open the list ofobjects associated with the Roof layer.

You’ll see one object named Layer:roof.

If you did the same to the A-Door orA-Wall layers, you’d see many objects oneach layer.

4. Since the Roof layer only contains oneobject, you can hide the layer by clickingon the gray dash in the Hide column.

The gray dash is replaced by a masksymbol meaning that the layer is hidden.

The Perspective viewport allows you tosee that the roof has been hidden.

While you could used one of severalother methods to select and hide the roofobject, a well organized drawing utilizesthe layer system to help improve yourmodeling efficiency. Proper use of layersmakes displaying and hiding objects inthe scene very fast and very easy.

Add a camera to the scene

Now that you have a better view of theinterior of the gallery, you’ll add a camerato the scene.

1. Right-click in the Top viewport to makeit active.

If necessary, move the Layers and Extrastoolbars out of the way.

2. From the Create panel, click theCamera button.

3. Click Target and place the base point ofthe camera at the center of the gallery,and then drag the camera target to wherestairs meet the second floor in the leftwing. Release the mouse button to finishthe camera placement.

Page 7: Maya Tutorials - Materials, Shaders and Global Illumination

Lesson 1 – Review and Link the Model 7

4. Right-click to end the Target Cameracommand.

5. Right-click in the Perspective viewportand press the C key.

The view will change to what you’reseeing through the camera you just placed.

6. Right-click in the Front viewport to makeit active.

You’ll work in this viewport to raise thecamera and target off the floor.

7. Open the Reference Coordinate Systemlist and change the setting from View toWorld.

This ensures that the Z axis is associatedwith vertical movement in any viewportyou work in.

8. Click the Select And Move buttonand pick the Camera.

9. Right-click the Select And Move buttonto display the Move Transform Type-Indialog.

Note: The Select And Move button mustbe turned on before you can enter datainto the Transform Type-In dialog. Thesame is true for Select And Rotate andSelect And Scale.

10.In the Offset:World group, enter 6’0” inthe Z axis field and press ENTER.

The camera shifts up to a more reasonablevantage point as shown in the Cameraviewport.

Page 8: Maya Tutorials - Materials, Shaders and Global Illumination

8 Chapter 1: mental ray: Introduction to Materials, Shaders and Global Illumination

11.With the Camera selected, right-click inthe viewport and choose Select CameraTarget from the quad menu.

12.In the Move Transform Type-In dialog,enter 10’0” in the Offset:World Z axis fieldand press ENTER.

The camera and its target are nowpositioned and you can create a test renderof the scene.

Unhide the roof

Before test rendering the scene, make surethe roof layer is unhidden.

1. From the main toolbar, click the LayerManager button.

2. Scroll down the list of layers and find theRoof layer.

3. Click the mask symbol in the Hidecolumn.

The gray dash reappears and the layer isunhidden.

Render the scene

With the model linked and a camera placedin the scene, you can now create a test renderto see if the camera’s placement is suitable.

1. On the main menu, choose Rendering >Environment.

The Environment and Effects dialog isdisplayed.

2. Turn off the Active switch in the ExposureControl rollout.

Before producing a test render, you needto turn off the Exposure Control or thescene will appear to be too bright.

3. Close the Environment and Effects dialogand choose Rendering > Render from themain menu.

4. In the Output Size group, click the 320x240rendering preset button.

Tip: You want your test rendering to befast, so use lower resolution settings.Increase the resolution for final renderingsthat you’ll present to your clients.

Page 9: Maya Tutorials - Materials, Shaders and Global Illumination

Lesson 2 – Add Materials to the Gallery 9

5. At the bottom of the Render Scene dialog,change the viewport setting to Camera01and click Render.

This is the result you get using the DefaultScanline Renderer.

6. In the Render Scene dialog, scroll downand open the Assign Renderer rollout.

7. Click the Choose Renderer button andpick mental ray Renderer from the ChooseRenderer dialog and then click OK.

8. Click the Render button again.

Both images are pretty similar, but thatwill change when you apply mental raymaterials to the scene. You’ll use themental ray Renderer for the remainder ofthis tutorial.

9. From the main menu, chooseFile > Save and save the scene asmyTulipGallery1.max.

Lesson 2 – Add Materials to theGalleryNow that the model is linked toAutodesk VIZ and you have a camerapositioned in the scene, it’s time to startcreating and applying materials. For thislesson, you’ll use the Material Editor tocreate a series of mental ray materials thatyou’ll apply to the scene.

mental ray materials can be used in threeforms:

• mental ray “phenomena”, or pre-madecollections of mental ray shaders such asthe DGS and Glass material.

• a mental ray material. This is an emptyshell into which individual shaders canbe placed to identify all aspects of thematerial’s properties such as surface,shadow, displacement, etc.

• standard materials with mental rayshaders. All standard materials can beenhanced by adding shaders via themental ray Connection rollout.

mental ray materials allow you to specify anumber of Material and Advanced Shaders.But what exactly is a shader? A shader isessentially a way of controlling how anobject’s material will behave when rendered.The parameters of different shaders let youspecify a diffuse or specular componentas well as brightness, transparency, and anumber of other settings. These combinewith the light(s) in the scene to produce thefinal rendered appearance.

Page 10: Maya Tutorials - Materials, Shaders and Global Illumination

10 Chapter 1: mental ray: Introduction to Materials, Shaders and Global Illumination

Set up the lesson:

Before you start to make materials for themodel, you need to activate the mental rayextensions.

1. Continue from the previous section orstart Autodesk VIZ and choose File >Open.

2. Browse to the \tutorials\galleryfolder on your hard drive and opentut_tulipgallery_no_materials.max.

3. From the main menu, choose Customize> Preferences and then open the mentalray panel.

4. In the General group, make sure thatEnable mental ray Extensions is turned on.

5. Click OK to close the Preferences dialog.

6. On the main menu choose Rendering >Render to open the Render Scene dialog.

7. Open the Raytracer panel and turn off theShow Progress Dialog and Show Messagesswitches at the bottom of the RaytracerGlobal Parameters rollout.

Doing this turns off a pair of extra dialogboxes that clutter the user interface whileyou’re rendering.

8. Open the Common panel and then openthe Assign Renderer rollout.

9. Click the Choose Renderer button andselect mental ray Renderer from theChoose Renderer dialog and the click OK.

Create materials for the scene

Notice that each object in the sceneuses the layer color set in ArchitecturalDesktop. While you can use some standardAutodesk VIZ materials, you also want totake advantage of the flexibility and controlthat mental ray shaders provide.

Begin by looking at all the different surfacesin the scene, and thinking of what kind ofmaterial each surface should have. So far,the scene has no lighting other than theAutodesk VIZ default lighting. Materialsthat are applied to the scene may requireadjustment once you start adding lights.Now, let’s go through the steps of creatingmaterials for the gallery.

Page 11: Maya Tutorials - Materials, Shaders and Global Illumination

Lesson 2 – Add Materials to the Gallery 11

Create the Wall material:

The first material you’ll create is a simple,white, matte material that will be assignedto the walls of the gallery. You’ll create thisusing a mental ray DGS material.

Tip: For more information regarding the DGSMaterial, refer to the “DGS Material (mentalray)” topic in the Autodesk VIZ 2005 UserReference.

The DGS material allows you to specify theDiffuse, Glossy and Specular components ofa material. Diffuse sets the diffuse color, orthe color the object reflects when it’s beenilluminated. Glossy sets the color of glossyreflections. Specular sets the color of themirrored reflections.

Note: If Specular is set to white, the materialbecomes 100% reflective – like a mirror.If Specular is set to black, reflection iseliminated.

1. From the main toolbar, open theMaterial Editor.

Tip: You can also open the Material Editorby pressing the keyboard shortcut, M.

2. With the first sample slot selected,click the material type button to openthe Material/Map Browser dialog anddouble-click mental ray.

By default, the material type button is setto Architectural.

Note: The mental ray materials are notlisted unless you assign the mental rayRenderer in the Render Scene dialog.

3. In the Basic Shaders group of the MaterialShaders rollout, click the Surface mapbutton.

It currently shows None.

4. When the Material/Map Browseropens again, double-click DGS Material(3dsmax).

Page 12: Maya Tutorials - Materials, Shaders and Global Illumination

12 Chapter 1: mental ray: Introduction to Materials, Shaders and Global Illumination

5. In the DGS Materials (3dsmax) Parametersrollout, click the dark gray color swatchnext to Diffuse.

This opens the Color Selector: diffusedialog.

6. Change the Value setting to 1.0.

This results in a pure white color.

7. With the Color Selector dialog still open,click the dark gray color swatch next toGlossy Highlights in the Material Editor.Change the Value setting in the ColorSelector dialog to 0.0.

Repeat this setting for the Specular valueas well.

8. Since you don’t want the wall to bereflective, set the Shiny value to 0.0.

Tip: To quickly zero out a value that can beset by spinner arrows, place your cursorover the spinner and right-click.

9. Close the Color Selector dialog andclick the Go To Parent button.

10.Change the material name from 01 -Default, to MR_white_matte.

11.Press the H key to open the Select Objectsdialog and choose Layer:Exterior_walland then click the Select button.

12. In the Material Editor, click the AssignMaterial To Selection button.

Make a test render:

1. From the main menu, choose Rendering> Render.

2. Make sure the Output Size is set to 320x240and the Viewport is set to Camera01.

3. Click the Render button.

Make sure the curved wall to the left hasaccepted the white material.

Page 13: Maya Tutorials - Materials, Shaders and Global Illumination

Lesson 2 – Add Materials to the Gallery 13

4. Choose File > Save As and save the sceneas myTulipGallery2.max.

Create the Ceiling material:

The next material you’ll create is going tobe applied to the ceiling of the gallery. Thismaterial will utilize a texture map that showsacoustical tiles.

1. Click the top, middle sample slot in theMaterial Editor.

2. Click the material type button to open theMaterial/Map Browser dialog and turnon Mtl Library in the Browse From group.

3. In the Files group, click Open and choosearchitectural.materials.finishes.mat locatedin the \autodesk viz 2005\matlibs folder.

The architectural finishes library is openedin the Material/Map Browser. Thislibrary contains a number of convenient,architectural materials that increase thespeed in which you can dress up a scene.

Page 14: Maya Tutorials - Materials, Shaders and Global Illumination

14 Chapter 1: mental ray: Introduction to Materials, Shaders and Global Illumination

4. ChooseFinishes.Ceiling.Acoustical.Tile.Exposed.Grid.2x2.Fissured.White (Architectural)and click OK.

Tip: You can resize the Material/MapBrowser so you don’t have to scroll thematerial list.

5. Press the H key to open the Select Objectsdialog again and choose Layer:roof andthen click the Select button.

6. In the Material Editor, click the AssignMaterial To Selection button.

7. Click the Quick Render button tocreate another test render.

Note that you don’t see any actual tilesyet. This usually means the tiling settingfor the texture map is too low, the object

requires mapping coordinates, or perhapsboth.

Add mapping coordinates and set the tiling:

The first thing check when a texture mapis not showing up properly on an objectis the mapping coordinates. If mappingcoordinates are present, then you need tostart checking the material that is applied tothe object.

1. Minimize the Material Editor and openthe Modify panel.

The Layer:roof object is still selected and islisted as Linked Geometry in the ModifierStack. It has no mapping coordinates.

2. Open the Modifier List and apply theUVW Map modifier.

Page 15: Maya Tutorials - Materials, Shaders and Global Illumination

Lesson 2 – Add Materials to the Gallery 15

3. In the Parameters rollout, make surePlanar is active in the Mapping group.

Tip: If you want to see the bitmapsof materials in the viewport, turn on theShow Maps In Viewports button in theMaterial Editor.

4. Click the Quick Render button.

Now you can see part of the texture mapon the ceiling but it is way too big.

5. Restore the Material Editor and clickthe Diffuse Map button in the PhysicalQualities rollout.

6. In the Coordinates rollout, change the Uand V tiling to 16.

7. Minimize the Material Editor andclick the Quick Render button.

Now the acoustical tile texture map isdisplayed properly.

Although you could have created thesame material using a mental ray materialwith appropriate shaders, it was fasterand easier to use a pre-made ArchitecturalMaterial.

Create the Floor material:

To create the flooring material, you’ll useanother pre-made Architectural material.You’ll also improve it by adding bump anddisplacement mapping.

1. Restore the Material Editor and click thetop, right sample slot.

2. Click the material type button to open theMaterial/Map Browser dialog again.

Page 16: Maya Tutorials - Materials, Shaders and Global Illumination

16 Chapter 1: mental ray: Introduction to Materials, Shaders and Global Illumination

3. This time, chooseFinishes.Flooring.Tile.Diamond.Red(Architectural)

4. Press the H key to open the Select Objectsdialog and choose Layer:floorplane andthen click the Select button.

5. Click the Assign Material To Selectionbutton.

6. Click the Quick Render button tocreate another test render.

You get a highly reflective floor but notiles are rendered.

7. Minimize the Material Editor andapply a UVW Map modifier to theLayer:floorplane object.

8. Make sure its mapping is set to Planar.

9. Restore the Material Editor and clickthe Diffuse Map button in the PhysicalQualities rollout.

10.In the Coordinates rollout, change the Uand V tiling to 18.

11. Click the Quick Render button again.

The floor tile texture map is displayed, butstill looks like a smooth sheet of glass.

Improve the Floor material - Bump map:

Now, you’ll give the floor material greaterrealism by adjusting the bump map.

Page 17: Maya Tutorials - Materials, Shaders and Global Illumination

Lesson 2 – Add Materials to the Gallery 17

1. Click the Go To Parent button andopen the Special Effects rollout.

This material already has a bump mapadded but it’s not rendering as expected.

2. Click the Bump map button to access itsbitmap coordinates and set the U and Vtiling to 18 so it matches the tiling of theDiffuse bitmap.

3. Click the Quick Render button.

There’s a slight improvement, but still notwhat you want.

4. Click the map type button to open theMaterial/Map Browser dialog. Thecurrent map type shows Bitmap.

5. In the Browse From group, turn on Newand double-click Mix in the map list.

6. When asked if you want to keep or discardthe old map, choose Keep Old Map AsSub-Map and click OK.

The original bump map is automaticallyplaced in the Color #1 slot but you’ll nowchange the texture map to one that hasbeen improved.

7. Click the Map button for the Color #1slot to access the coordinates and bitmapparameters for the map.

Page 18: Maya Tutorials - Materials, Shaders and Global Illumination

18 Chapter 1: mental ray: Introduction to Materials, Shaders and Global Illumination

8. In the Bitmap Parameters rollout, clickthe Bitmap button that shows the currenttexture map.

The Select Bitmap Image File dialog isdisplayed.

9. Browse to the \tutorials\gallery folder and double-clickFinishes.Flooring.Tile.Diamond.Red.bump.Enhanced.jpg.

This texture map has wider grout linesseparating the tile and will produce amore distinct appearance to the tiles.

10. Click the Go To Parent button andthen click the Map button for the Color#2 slot. Double-click Noise from theMaterial/Map Browser.

11.In the Noise Parameters rollout, set theSize to 250.

12. Click Go To Parent again and set theMix Amount to 30.

This produces a blending of the Color #1and Color #2 mapping channels.

13. Click the Go To Parent button againand set the bump amount to 5.

14. Click the Quick Render button.

This rendering shows wider grout lines,per the enhanced bump map, and thenoise results in more distortion in thestairway and statue reflections in the floor.

Page 19: Maya Tutorials - Materials, Shaders and Global Illumination

Lesson 2 – Add Materials to the Gallery 19

Improve the Floor material - Displacement map:

With the bump map adjusted, you willnow add further detail by incorporating adisplacement map.

1. In the Special Effects rollout, click theDisplacement map button.

2. In the Material/Map Browser, double-clickBitmap.

The Select Bitmap Image File dialog isdisplayed.

3. Browse to the \tutorials\gallery folder and double-clickFinishes.Flooring.Tile.Diamond.Red.bump.Enhanced.jpg.

4. In the Coordinates rollout, set the U and Vtiling to 18 so it matches the tiling of theDiffuse and Bump bitmaps.

5. Click the Go To Parent button and setthe Displacement amount to 0.2.

6. Click the Quick Render button.

By adding a displacement map witha low setting, you introduce a littleroughness to the floor, giving it a moreworn appearance.

7. In the Physical Qualities rollout, reducethe Shininess setting to 50 to furtherreduce the reflection in the floor.

8. Render the scene again.

9. Choose File > Save AS and save yourscene as myTulipGallery3.max.

Create the Curtain Wall material - Frame:

The Curtain Wall is going to consist of twodifferent materials. One material for thestructural frame and another for the glasspanels. Both of these will be created usingthe DGS Material. Start with the framingmaterial.

1. Click the lower left sample slot in theMaterial Editor.

Page 20: Maya Tutorials - Materials, Shaders and Global Illumination

20 Chapter 1: mental ray: Introduction to Materials, Shaders and Global Illumination

2. Click the material type button to open theMaterial/Map Browser and double-clickDGS Material (physics_phen).

3. Click the Diffuse color swatch to open theColor Selector: diffuse dialog and thenright-click the spinner arrows to the rightof the Value field.

This automatically sets the Value settingto zero, or black.

4. In the Material Editor, click the Specularcolor swatch.

The Color Selector dialog changes tocontrol the Specular color.

5. Change the Value setting to .15 to producea dark gray color.

This will result in some shiny reflectionsin the rendered image.

Note: Remember that the Specular colorcontrols the mirrored reflections. If theSpecular color is set too high, the railswill appear light-grey because theyreflect more light. If set to zero, or black,reflection is eliminated.

6. Close the Color Selector dialog and setthe Shiny value in the DGS Material(physics_phen) Parameters rollout to 15.

7. Press the H key to open the SelectObjects dialog and select the CurtainWall <Standard> Default Frame object.Hold down the CTRL key and alsoselect the Curtain Wall <Standard>Mullion, Layer:A-Glaz-Curt andLayer:Rope-Platform objects and thenclick the Select button.

8. Click the Assign Material To Selectionbutton.

9. Render the scene.

If you render at a higher resolution,you’ll notice some speckling/noise on thesurface of the platform. This effect is dueto the nature of glossy highlights, whichhandle noise from the specular reflection.

10.To reduce the speckling/noise, click theGlossy Highlights color swatch and set itsValue to black.

Page 21: Maya Tutorials - Materials, Shaders and Global Illumination

Lesson 2 – Add Materials to the Gallery 21

If there is still speckling/noise, youcan increase the Shiny setting until thephenomenon goes away.

11.Rename this material as Shiny Black.

Create the Curtain Wall material - Glass:

With the material for the structural framecomplete, now you’ll make the material forthe glass panels. The type of glass materialyou make depends on the look that you’retrying to produce. For a simple glass, youcould use the Glass (physics_phen) material,but that won’t give you the right amountof reflection. For this scene, you’ll createsomething with a bit of reflectivity so thatyou can see some nice reflections of the stairrails.

1. Click the lower, middle sample slot in theMaterial Editor.

2. Click the material type button to open theMaterial/Map Browser and double-clickmental ray.

3. Click the shader button next to Surfaceand double-click DGS Material (3dsmax).

4. In the DGS Material (3dsmax) Parametersrollout, set both the Diffuse and GlossyHighlights colors to black and the Specularcolor to white.

5. Set Shiny to 0 and Transparency to .75.

6. Click the Go To Parent button andname this material Glass Infill.

7. Click the shader button next to Shadowand double-click Shadow Transparency(base).

This shader allows a light source that’splaced outside the building to castshadows through the glass on to surfacesthat are inside the structure.

8. In the Shadow Transparency (base)Parameters rollout, click and drag the grayColor swatch over the black Transparencycolor swatch and then click Swap in theCopy Or Swap Colors dialog.

9. Press the H key to open the SelectObjects dialog and select the Curtain Wall<Standard> Default Infill object.

10. Click the Assign Material To Selectionbutton in the Material Editor.

11. Render the scene.

Page 22: Maya Tutorials - Materials, Shaders and Global Illumination

22 Chapter 1: mental ray: Introduction to Materials, Shaders and Global Illumination

12.Choose File > Save As and save your sceneas myTulipGallery4.max.

Now you’ve got a good idea of how to createand work with mental ray materials. In thenext lesson, you’ll start adding lights to seehow they effect your scene. Once lights areadded, you may have to adjust some of thematerials that you created in this lesson.

Lesson 3 – Add Lights to theGalleryWith materials applied to the model, youstart to get a better idea of how the modelwill look when it is completed. Lighting isanother factor in making a truly realisticlooking rendering. In this lesson, you’regoing to add a background map and newlights to the scene.

For this scene, you will use two types oflighting. One type is external light to act asthe Sun. The other is internal lighting, orartificial lighting designed for indoor spaces.The lighting you’ve witnessed in the sceneup to this point is the Autodesk VIZ defaultlighting.

Note: Keep in mind that rendering timeswill greatly increase as you add more

shadow casting lights and begin using globalillumination settings for your light sources.

Set up the lesson:

1. Start Autodesk VIZ, and choose File >Open.

2. Find the \program files\autodeskviz 2005\tutorials\gallery folderon your hard drive and highlighttut_tulipgallery_full_materials.max, thenclick Open.

This is a version of the gallery model thathas all of its materials assigned.

Create an External Light Source – theSun

Since mental ray does not supportAutodesk VIZ’s Daylight system. In thislesson you will create a single, very powerfullight source, a Target Direct light, to emulatethe Sun.

1. Right-click in the Top viewport to makeit active.

2. On the Create panel, click the Lightsbutton.

3. Create a Target Direct light, placing thelight outside the building near the tip ofthe second finger and aiming the targetinto the space you’ve been studying.

Page 23: Maya Tutorials - Materials, Shaders and Global Illumination

Lesson 3 – Add Lights to the Gallery 23

4. Click the Select And Move button.

5. Right-click the Select And Move button toopen the Move Transform Type-In dialogand enter following X, Y and Z settings inthe Absolute:World group.

• X: = 1’0”

• Y: = 208’0”

• Z: = 45’0”

Note: Your Dolly setting may be slightlydifferent because that value is set by theplacement of the light’s target. Sincethis light is acting as the Sun, the targetplacement does not need to be that precise.

6. Open the Modify panel and in theGeneral Parameters rollout > Shadowsgroup, open the Shadows drop down listand then choose Ray Traced Shadows.

Note: When you first add the light, thedefault shadow type is Advanced RayTraced. mental ray does not support thisshadow type so it is necessary to changeto Ray Traced Shadows. Ray TracedShadows is the only Shadow generatorthat supports transparency or shadowscast through transparent objects.

7. In the Intensity/Color/Attenuationrollout, make sure the Multiplier is set to1.0.

8. In the Directional Parameters rollout,set the Hotspot/Beam to 25’ and theFalloff/Field to 65’.

9. Right-click the Camera01 viewportto make it active and then click the QuickRender button.

Even though you’ve added a light source,your rendering is virtually black. You cansee some shadows on the left-hand wallbut otherwise, a black rendering. Thereare a number of adjustments you need tomake before the scene renders correctly.

Set the Background Map

To add more realism to the scene, you’llnow add a background map so you have anenvironment outside the building.

Page 24: Maya Tutorials - Materials, Shaders and Global Illumination

24 Chapter 1: mental ray: Introduction to Materials, Shaders and Global Illumination

1. On the main menu, choose Rendering >Environment.

2. In the Exposure Control rollout, turnon the Active switch so LogarithmicExposure is calculated.

Logarithmic Exposure Control usesbrightness, contrast, and whetherthe scene is outdoors in daylight tomap physical values to RGB values.Logarithmic Exposure Control is better forscenes with a very high dynamic range.

Note: The mental ray renderer supportsonly the Logarithmic and Pseudo Colorexposure controls.

3. In the Background group, click the Nonebutton under Environment Map. ChooseBitmap from the Material/Map Browserand then pick c:\program files\autodesk viz2005\tutorials\gallery\sky.jpg.

4. Open the Material Editor, if it’s notalready open.

5. Right-click any of the material spheresand choose 5x3 Sample Windows from theflyout menu.

You’re going to be working between theEnvironment And Effects dialog and theMaterial Editor so having extra availablesample slots is handy.

6. In the Environment And Effects dialog,click and drag the Sky.jpg bitmap into ablank sample slot in the Material Editor.When the Instance (Copy) Map dialogappears, choose Copy and click OK.

7. In the Coordinates rollout of the MaterialEditor, make sure Environ is active andthe Mapping is set to Screen.

8. Do another test render.

The room is still quite dark, but you cansee the world outside.

9. On the Environment And Effects dialog,in the Logarithmic Exposure ControlParameters rollout, set Brightness to 90.

By controlling the brightness from theLogarithmic Exposure Control Parametersrollout, you affect the entire scene insteadof only the area where the light is shining.

10.In the Intensity/Color/Attenuationrollout on the Modify panel, turn downthe light’s Multiplier value to 0.25.

The Multiplier value affects only wherethe light is shining. Since a majority of thebuilding is outside the falloff range of thelight, most of the building would remainin darkness.

11.Click the Quick Render button again.

Page 25: Maya Tutorials - Materials, Shaders and Global Illumination

Lesson 3 – Add Lights to the Gallery 25

12.Save your scene as myTulipGallery5.max.

The exterior lighting is set. Next you’ll learnabout global illumination and add someinterior, artificial lighting.

Understanding Global Illumination

Before adding artificial light sources insidethe gallery, you need to know a little bit aboutGlobal Illumination (GI). Global Illuminationis a method of simulating all the light in ascene – direct and indirect.

In a traditional scene, illumination is usuallyprovided by light objects, spot lights,omni lights, etc. Global Illumination useslight-emitting and light-receiving surfaces tocreate a more realistic feel. In the real world,light that comes in a window is bouncedoff of tables, walls, and other surfaces togive a room a soft, warm feel; GI simulatesthis effect. Photons are emitted by lightsources and are affected by everything in thescene. Some photons are absorbed by theobjects they hit, while others are reflectedand refracted. Those that are reflected orrefracted off of objects continue on to strikeother nearby surfaces.

So far, the renderings you’ve made do notinclude GI. Now, you’ll turn on GI and add

interior lighting so you can see the effect thatphoton emitting lights have in the scene.

Keep in mind that rendering time willincrease because Global Illumination is goingto be calculated.

Turn on global illumination:

1. From the main menu, choose Rendering >Render and open the Indirect Illuminationpanel.

2. Turn on Enable in the Global Illuminationgroup.

When turned on, the mental ray renderercalculates global illumination.

3. At the bottom of the Photons (Caustics &GI) group, turn on All Objects GenerateAnd Receive Caustics & GI.

Create Artificial Lights – InteriorLighting

For accurate interior lighting, you will usephotometric lights from ERCO. Photometriclights use accurate light values, so that youcan approximate how the scene will actuallylook. You can create your own color, wattage,and other characteristics, or you can useactual data from lighting manufacturers, likeERCO.

Add an interior light using the Asset Browser:

The main lighting in this scene is supplied bythe ERCO 75580.023.03 Luminaire. This lightcombines two files: the .max file containingthe mesh geometry and luminaire of the lightfixture, and the IES file containing the actuallighting data.

1. Open the Utilities panel andclick on the Asset Browser. Browse tothe \tutorials\gallery folder and select

Page 26: Maya Tutorials - Materials, Shaders and Global Illumination

26 Chapter 1: mental ray: Introduction to Materials, Shaders and Global Illumination

ERCO_VIZ4_75580023_1xPAR56_300W_37deg_18deg.max.

2. Left-click and drag the model into theTop viewport and then choose Merge File.Click OK on the Merge:Raytrace GlobalTracks dialog without changing the trackssetting.

Note: Since you’re working with themental ray renderer, the tracks setting isirrelevant for this tutorial.

3. Click to place the light in the scene andthen minimize the Asset Browser.

4. Open the Modify panel and note theLuminaire Parameters rollout includes aDimmer, for altering the light level, and

a Filter Color, in case you want a coloredlight.

Position the light:

You’re going to place three lights in theceiling below the second floor to light up thebank of doors. You will also have to stretchout the targets so light is properly spreadthroughout the area.

1. With the light selected, click theSelect And Move button, if it’s not alreadyturned on, and then right-click the SelectAnd Move button to open the MoveTransform Type-In dialog.

2. In the Absolute:World group, make thefollowing settings:

• X: = -25’0.0”

• Y: = 135’10.0”

• Z: = 19’10.0”

Note: Be aware that the X: position is anegative value.

This places the first light on the ceilingbelow the second floor near the left-handwall.

3. Right-click in the Top viewportto make it active and Region Zoom toencompass the entire second floor area.

After zooming in, right-click to end theRegion Zoom operation.

Page 27: Maya Tutorials - Materials, Shaders and Global Illumination

Lesson 3 – Add Lights to the Gallery 27

4. While holding down the SHIFT key, clickon the light and drag it up and to the left,using the orange railing as a guide toplace a second light about midway alongthe top railing.

5. When the Clone Options dialog appears,set the Number Of Copies to 2, make sureInstance is turned on in the Object groupand then click OK.

There are now three lights spaced alongthis portion of the ceiling.

Tip: With Instance turned on, you cancontrol all three lights simultaneously. Ifyou want individual control of each light,you would turn on Copy in the Objectgroup.

6. Press the H key to open the Select Objectsdialog and highlight the Target for eachlight and then click Select.

As you’re selecting the Target objects, holddown the CTRL key to make multipleselections.

7. In the Front or Left viewport, movethe targets down to the floor.

The targets control how far the light isspread, so you have to move the targets toincrease the amount of light in the room.

8. Also, move each target so light will shinetoward the doors instead of just straightdown.

Work between the Camera01 and Topviewports to move the light targets asshown in the following illustration.

Page 28: Maya Tutorials - Materials, Shaders and Global Illumination

28 Chapter 1: mental ray: Introduction to Materials, Shaders and Global Illumination

Render the scene with photometric lights:

Because you’re adding new lights to theinterior that require the calculation ofphoton emissions for global illumination, therendering time is increased. Be patient whilethe calculations are processed.

This scene is going to accumulate many morelights as you progress through the tutorialand the rendering time will keep increasing.

Note: Refer to the “Tips for Improving mentalray Performance (page 41)” topic for ideas onreducing rendering time.

1. From the main menu, choose Rendering >mental ray Message Window. Turn on theInformation, Progress and Open On Errorswitches if they are not currently active.

As you render the scene, the informationin this window gives you an ongoingprogress report. It will also reportwarnings and error messages that you canuse to help diagnose why your scene maybe taking far too long to render.

2. Right-click in the Camera01 viewportto make it active and click the QuickRender button.

Add ceiling lights above the second floor:

Now that you have the entry door lightsplaced and have done a test render, you cansee that more lights are needed to continuebrightening the gallery. The next set of lightswill be placed on the gallery ceiling over thesecond floor.

1. Press the H key and select the three lightsand their targets.

Tip: Select the first light, then hold downthe SHIFT key while selecting the targetof the last light.

Page 29: Maya Tutorials - Materials, Shaders and Global Illumination

Lesson 3 – Add Lights to the Gallery 29

2. Click the Select And Move button andin the Front or Left viewport, SHIFT-dragthe lights upward until they’re near theceiling.

3. Click OK on the Clone Options dialog.

4. Using the illustration as a reference,move the targets for each light so they arepointing down into the gallery.

You’ll have to use several viewports toposition the targets and don’t forget tomove them down to the main floor.

5. Click the Render Scene button andopen the Common panel.

6. In the Options group, turn offDisplacement.

Doing this will save a little time whileyou’re performing test renders.

7. Right-click in the Camera01 viewport andthe click the Render button.

The addition of just six lights has greatlybrightened the scene. Now, more lightsare needed to brighten the foreground.

Add ceiling lights to the main hall:

To brighten the main hall, you need morelights mounted on the ceiling.

1. Restore the Asset Browser and draganother ERCO_VIZ4_75580023_1xPAR56_300W_37deg_18deg light into the Topviewport.

2. Merge the file and click Use Scene Materialon the Duplicate Material Name dialog.

3. On the Merge:Raytrace Global Tracksdialog, click OK.

4. Drag the light and place it at the foot ofthe stairs, as shown.

Page 30: Maya Tutorials - Materials, Shaders and Global Illumination

30 Chapter 1: mental ray: Introduction to Materials, Shaders and Global Illumination

5. In the Move Transform Type-In dialog,make the following settings in theAbsolute:World group.

• X: = 25’0.0”

• Y: = 146’8.0”

• Z: = 30’0.0”

6. Select the target for the light and changethe Z: position setting to 10’0.0”.

7. Select the light again and SHIFT-drag thelight down and to the right, near the endof the stair rail, as shown.

8. In the Clone Options dialog, change theNumber Of Copies to 6 and click OK.

You have seven lights running across themain gallery.

9. Open the Modify panel and selectthe light and then change the Dimmervalue to 60%

Because the lights are instances of oneanother, a change to one light affects allseven lights.

10. Select the target for the light at thefoot of the stairs and move it so it shinesabout a third of the way up the stairs.

Page 31: Maya Tutorials - Materials, Shaders and Global Illumination

Lesson 3 – Add Lights to the Gallery 31

11.Move the target for the next light so it’spointing about two thirds of the way upthe stairs.

Remember to move it in both the Top andFront viewports so the target is above thestairs.

12.Move the target for the third light so it’sover the top of the stairs.

The targets for the first three lights shouldclosely match the illustration.

13.Move the target for the fourth light tobrighten the foreground in front of thestairs.

14.Move the targets for the remaining threelights to wash across the foreground asshown.

15. Right-click in the Camera01 viewportand then click the Quick Render button.

The rendering is getting better but it’s stilltoo dark at the bottom of the steps. Thewalls along the left and under the stairscould also use some accent lighting.

16.Save the scene as myTulipGallery6.max.

Add an accent light:

To brighten up the walls, you’re going tomerge another ERCO light into the scene.This one is an accent light that is mountedto the wall.

1. Restore the Asset Browser and drag theERCO_VIZ4_85024023_1xT4_90W.max fileinto the scene.

Page 32: Maya Tutorials - Materials, Shaders and Global Illumination

32 Chapter 1: mental ray: Introduction to Materials, Shaders and Global Illumination

2. Choose Merge File from the flyout menuand click Use Scene Material when yousee the Duplicate Material Name dialog.

3. On the Merge:Raytrace Global Tracksdialog, click OK.

4. Drag the light into the Top view and placeit by the corner at the foot of the stairs.

5. Minimize the Asset Browser.

6. Turn on the Select And Move button andthen right-click the button to open theMove Transform Type-In dialog.

7. In the Absolute:World group enter thefollowing:

• X: = 22’6.0”

• Y: = 156’5.5”

• Z: = 9’0.0”

8. Click the Select And Rotate button.

The Move Transform Type-In dialogchanges to the Rotate Transform Type-Indialog.

9. In the Absolute:World group enter a Z:rotation of -35.0 degrees.

10.Decrease the Dimmer setting to 50%

11. Right-click in the Camera01 viewportand then click the Quick Render button.

Add more accent lights:

With the addition of the accent light, youshould add more to the walls under thestairway and along the curved wall on theleft.

1. Select the accent light,ERCO.85024.023, and turn on theSelect And Move button.

Page 33: Maya Tutorials - Materials, Shaders and Global Illumination

Lesson 3 – Add Lights to the Gallery 33

2. SHIFT-drag the light to the left, betweenthe doors and the first sculpture as shownin the illustration.

3. Click OK on the Clone Options dialog.

4. Use Move and Rotate tools toposition and orient the light on the curvedwall.

5. Click the Move button and SHIFT-dragthe light to the right and place it betweenthe first and second sculptures.

6. Move and Rotate the new light againstthe wall.

7. Repeat these steps to place lights betweeneach sculpture and along curved wall onthe left.

8. Right-click in the Camera01 viewportand then click the Quick Render button.

The addition of the accent lights give thescene greater detail.

Final Gather:

The scene lighting is complete but youhave only been using global illuminationprocessing for your renderings. globalIllumination calculations, by themselvescan cause rendering artifacts such as darkcorners and the mottled appearance you seeon the ceiling and walls.

You can solve this by turning on FinalGather in the Indirect Illumination panel ofthe Render dialog. Final Gather increasesthe number of rays that are used in theGI calculations, and will give surfaces asmoother finish.

Note: Since Final Gather increases thenumber of rays used for global illuminationprocessing, the rendering time is going togreatly increase.

1. If it’s not already open, click theRender Scene button and then open on theIndirect Illumination panel.

2. In the Final Gather group, turn on theEnable switch and then click Render.

Tip: Turn on Fast Lookup and Preview toquickly preview the scene when usingFinal Gather. When these switches areturned on, the regathering process is spedup to reduced the overall rendering time.

Page 34: Maya Tutorials - Materials, Shaders and Global Illumination

34 Chapter 1: mental ray: Introduction to Materials, Shaders and Global Illumination

Now the mottled appearance is corrected.

3. On the Render Scene dialog, click theCommon panel and turn on Displacement,if you previously turned it off to reducerender time, and then click the Renderbutton.

Displacement was turned off earlier in thetutorial to reduce render time a little bit.With displacement turned on, you cansee that floor no longer looks like a sheetof glass.

4. Save your scene as myTulipGallery7.max.

If you’d like, compare your scene with thesample file, tut_tulipgallery_final_lights.maxthat can be found in the \programfiles\autodesk viz 2005\tutorials\gallery folderon your hard drive.

Lesson 4 – Stylize the RenderedOutputThe mental ray features and shadersincluded in Autodesk VIZ offer many waysthat you can enhance, or completely change,the quality of your final renderings. Thislesson covers some examples of how you canfurther stylize your rendered output.

Set up the lesson:

1. Start Autodesk VIZ, and choose File >Open.

2. Find the \program files\autodeskviz 2005\tutorials\gallery folderon your hard drive and highlighttut_tulipgallery_final_lights.max, then clickOpen.

This is a final version of the gallery modelthat has all of its materials assigned andall of the lighting in place.

Pencil Rendering

Using this technique will give you ahand-drawn rendition of the gallery as if youhad used a pencil.

1. Open the Material Editor and click tothe fourth sample sphere on the bottomrow.

Page 35: Maya Tutorials - Materials, Shaders and Global Illumination

Lesson 4 – Stylize the Rendered Output 35

2. Click the material type button and selectStandard from the Material/Map Browser.

3. Click the gray color swatch next to theDiffuse color in the Blinn Basic Parametersrollout.

The Color Selector: Diffuse Color dialogis displayed.

4. Set the Value setting to 255 and then closethe Color Selector dialog.

5. Change the material name from 18 -Default to Override.

6. Click the Render Scene button andopen the Processing panel.

7. Scroll to the Translator Options rolloutand turn on the Enable switch in theMaterial Override group.

8. Working between the Material Editorand Render Scene dialogs, click and dragthe Override material from the MaterialEditor on to the None button next toMaterial in the Material Override groupon the Render Scene dialog.

9. In the Instance (Copy) Material dialog,make sure Instance is active and click OK.

10.In the Render Scene dialog, open theIndirect Illumination panel and turn offFinal Gather.

11.Click the Render button.

Material Override allows you to render ascene with all its materials replaced by asingle master material.

12.Save your scene as myTulipGallery8.max.

Pen and Ink Rendering

This technique renders a hidden line imagethat presents a sketchy pen-and-ink look.This format is great if you plan to plot a largesize drawing and finish the rendering byhand, using watercolors, markers or coloredpencils.

You’ll accomplish this by making a fewchanges to the Override material you justcreated.

Inked Edges of the Pencil Rendering:

1. Continue from the Pencil Renderingsection.

2. In the Render Scene dialog, open theRenderer panel.

Page 36: Maya Tutorials - Materials, Shaders and Global Illumination

36 Chapter 1: mental ray: Introduction to Materials, Shaders and Global Illumination

3. Scroll down to the Camera Effects rolloutand turn on the Enable switch in theContours group.

4. In the Material Editor, make sure theOverride material is selected and open themental ray Connections rollout.

5. In the Advanced Shaders group, click theNone button next to Contours.

The Material/Map Browser is displayed.

6. Double-click Simple (contour) from thelist.

7. Change the Width setting to 0.13 and leavethe color black.

8. In the Render Scene dialog, click theRender button.

Contours render as a post-effect, so besure to wait for the rendering to finish.It looks like someone inked the edges ofyour pencil rendering.

Note: Contours are not supported byDistributed Bucket Rendering (DBR). Ifyou have access to a group of systemsthat let you use DBR, you must turn offDistributed Render on the Processingpanel of the Render Scene dialog. Ifyou attempt to use DBR, only thebuckets rendered by the system runningAutodesk VIZ will show the contoureffect.

Pen and Ink against a White Background

Now suppose you’d like to render only thecontours on a white background, suitablefor plotting.

Page 37: Maya Tutorials - Materials, Shaders and Global Illumination

Lesson 4 – Stylize the Rendered Output 37

1. On the Render Scene dialog, open theRenderer panel, if it’s not already open.

2. Scroll down to the Camera Effects rolloutand click the shader button next toContour Output in the Contours group.

3. Double-click Contour Only (contour) inthe Material/Map Browser.

4. In the Render Scene dialog, click theRender button.

You’ve got the contours, but they’reagainst a gray background.

5. Working between the Render Scene andMaterial Editor dialogs, click and drag theContour Only (contour) shader from theRender Scene dialog to the fifth samplesphere on the bottom row of the MaterialEditor.

6. On the Instance (Copy) Map dialog, leaveInstance active and click OK.

7. Click the color swatch next to BackgroundColor to open the Color Selector:Background.

8. Change the Value setting to 1.0 and closethe Color Selector dialog.

9. In the Render Scene dialog, click theRender button again.

Now you have the contours showing upagainst a white background.

Tip: If you want heavier line work, as if youused a broader pen tip, increase the widthsetting in the Simple (contour) Parametersrollout of the Override material.

10.Save your scene as myTulipGallery9.max.

Render an Interior Night Scene

To get an accurate impression of how muchscene lighting is actually coming from thephotometric lights, you’ll next set up andrender the scene as if it were night.

Set up the lesson:

1. Reset Autodesk VIZ, and choose File >Open Recent.

2. Choose tut_tulipgallery_final_lights.maxfrom the list.

Page 38: Maya Tutorials - Materials, Shaders and Global Illumination

38 Chapter 1: mental ray: Introduction to Materials, Shaders and Global Illumination

Interior Rendering on a Moonless Night:

1. In the Top viewport, select the light thatrepresents the Sun, Direct01.

2. Open the Modify panel and turn offthe On switch in the General Parameters> Light Type group.

3. From the main menu, choose Rendering >Environment and click the Color swatch inthe Background group to open the ColorSelector: Background Color dialog.

4. Change the Value setting to 0 and thenclose the Color Selector dialog.

Tip: You can set any value controlled bya spinner to zero by right-clicking thespinner arrows.

5. Turn off the Use Map switch in theBackground group and minimize theEnvironment and Effects dialog.

6. Click the Render Scene button andopen the Indirect Illumination panel.

7. Scroll to the Final Gather group and turnoff the Enable switch and then click theRender button.

Interior Rendering when the Moon is Full:

1. Make sure the light, Direct01, is stillselected.

2. On the Modify panel, turn the On switchback on in the General Parameters > LightType group.

3. In the Intensity/Color/Attenuationrollout, set the Multiplier to 0.15 and thenclick the white color swatch next to thespinner arrows.

4. On the Color Selector: Light Color dialog,make the following red, green and bluesettings.

• Red = 205

• Green = 220

• Blue = 235

Page 39: Maya Tutorials - Materials, Shaders and Global Illumination

Lesson 4 – Stylize the Rendered Output 39

5. Close the Color Selector dialog and thenclick the Render button on the RenderScene dialog.

The difference is subtle but you can seewhere the bluish light is being cast againstthe bottom of the curved wall to the leftand the large sculpture shows a bluishtinge.

6. Save your scene asmyTulipGallery10.max.

Render an Exterior Night Scene

Finally, you can add a night (lume) shader asan output shader to see what the buildinglooks like at night.

Note: Night (lume) is a mental ray shader thatdesaturates colors to appear more realistic tothe human eye. For instance, a bright blueball often appears to be a lighter turquoisein the moonlight. Night (lume) boosts dimlighting, so the photometric scene lightswill appear differently after a Night (lume)shader is applied. For this reason, whenusing Night (lume) for its desaturation effect,scene lighting may need to be readjusted.This shader approximates how people see atnight, not how a camera does, so this shaderisn’t intended for photo-realistic renderings.

Set up the lesson:

1. Reset Autodesk VIZ, and choose File >Open.

2. Find the \program files\autodeskviz 2005\tutorials\gallery folderon your hard drive and highlighttut_tulipgallery_exterior_lights.max, thenclick Open.

This scene shows a view from an exteriorcamera and includes lighting around theperimeter of the gallery.

Exterior Rendering using the Night (lume) Shader:

1. In the Top viewport, select the light thatacts as the Sun, Direct01.

2. Open the Modify panel and turn offthe On switch in the General Parameters> Light Type group.

3. Right-click in the Camera02 viewportto make sure it’s active and then click theQuick Render button.

The perimeter of the gallery is lit, but it’svery dark. This can be improved by usingthe Night (lume) shader.

4. Click the Render Scene button andopen the Renderer panel.

Page 40: Maya Tutorials - Materials, Shaders and Global Illumination

40 Chapter 1: mental ray: Introduction to Materials, Shaders and Global Illumination

5. Scroll to the Camera Effects rollout andclick the None button next to the Lensswitch in the Camera Shaders group.

6. Double-click Night (lume) from the shaderlist in the Material/Map Browser dialog.

7. Open the Material Editor if it’s notalready open.

8. Working between dialogs, click and dragthe Night (lume) shader from the RenderScene dialog to an empty slot in theMaterial Editor.

9. Leave Instance turned on in the Instance(Copy) Map dialog and click OK.

10.In the Night (lume) Parameters rollout,change the Multiplier setting to 0.8.

This parameter sets controls how muchthe dim lighting is increased.

11.On the Render Scene dialog, click theRender button.

The lights wash the walls more evenlywith light and they are a bit brighter thanbefore.

You’ll also notice at the center of theimage, there is a half moon shaped lightappearing on the roof. The reason isdue to no radius being specified for theGlobal Illumination group on the IndirectIllumination panel. The default radius is1/10th of the size of the scene. Since thisscene is large the radius is also large. Thephotons that are far away contribute tothe result, and you get the half-circles.

12.On the Render Scene dialog, open theIndirect Illumination panel.

13.In the Global Illumination group, increasethe number of Photons to 3000, turn onRadius and set the radius size to 5’0”.

Since the radius size is being set muchsmaller than the original default, you needto increase the number of photons to makeup for the smaller radius. By making

Page 41: Maya Tutorials - Materials, Shaders and Global Illumination

Lesson 4 – Stylize the Rendered Output 41

these changes you’ll remedy the half circleproblem and reduce any blotchy effectscaused by turning on the Radius switch.

14.Click the Render button.

Now the half circles are gone and if therendering still seems a little “blotchy”,you can increase the number of photonsuntil the lighting is smoothed out.

15.Save your scene asmyTulipGallery11.max.

Tips for Improving mental rayPerformance

Since rendering with mental ray lights andglobal illumination increase rendering timeso much, here are some things you can dothat can help reduce rendering time andimprove performance.

• Turn off options like Displacement orAtmospherics in the Options group on theRender Scene dialog. Make sure to turnthem back on for the final rendering.

• Make sure the model has no gaps wherephotons can escape. If a light is pointed ina direction where there is no surface, themental ray renderer might shoot photonsforever. In the mental ray Messagesdialog, the mental ray renderer displayswarnings that photons are not being

stored. This greatly increases renderingtime. To avoid the slowdowns relatedto this issue, make sure that every lightpoints in the direction of a surface (thisis sometimes impossible to do withomni lights). Another way to avoid thisproblem is to add a big sphere aroundyour entire model.

• On the Indirect Illumination panel of theRender Scene dialog, reduce the Photonssetting in the Global Illumination group.When the photon count is low, the imagewill have a blotchy look because, whenthere are fewer photons, each one has tocount for a larger area. For previewingglobal illumination, a photon setting of100 works well. Be sure to increase thephotons for your final rendering.

• To quickly preview your scene when usingFinal Gather, turn on Fast Lookup (SlowerGI) and Preview (No Precalculations) onthe Indirect Illumination panel. Whenfast lookup is turned on, the mental rayrenderer computes information to speedup the regathering process. While the fastlookup computation can take a long time,it can greatly reduce the overall renderingtime.

With Fast Lookup turned off and Previewturned on, the test system rendered thisscene in 45 minutes.

With Fast Lookup and Preview turned on,the test system rendered this scene in 32minutes.

• If you have access to several systems thathave mental ray licenses, you can use theDistributed Bucket Rendering feature toshare the rendering job so it is processedfaster. This can be turned on from theProcessing panel on the Render Scenedialog.

Page 42: Maya Tutorials - Materials, Shaders and Global Illumination

42 Chapter 1: mental ray: Introduction to Materials, Shaders and Global Illumination

Summary

In this tutorial, you learned about linking adrawing to Autodesk VIZ and how to createand apply mental ray materials to the scene.To further enhance the model, you addedseveral lights to the scene, including the useof pre-made ERCO lighting fixtures andphotometric lighting files. You learned aboutglobal illumination and how it improvesrenderings. Finally, you learned about waysto stylize your rendered output by choosingdifferent mental ray shaders.