Basic visualization in Maya

From TOI-Pedia

This tutorial covers creating a basic visualization using imported geometry in Maya. The tutorial has been created for geometry exported from Revit Architecture (FBX export), but can also be used for other polygon mesh geometry in Maya.

Introduction

This page uses abbreviations for the mouse buttons:

LMB: Left Mouse Button

MMB: Middle Mouse Button

RMB: Right Mouse Button

Prerequisites

For this tutorial you'll need the following software:


Shaders

The visual representation of all 3D geometry in Maya is determined by shaders. By assigning a shader to a surface of an object, you control how that surface will appear when visualizing it. The shader controls properties such as color, transparency, reflectivity and many more.

The process of creating a 2D image of your 3D modeling is called Rendering. The type of render engine you use and its settings determine the overall look and quality. The result can be a basic, flat-shaded image or a highly realistic image with all kinds of light effects.

In this tutorial we will use Mental Ray for Maya as the render engine. Mental Ray has its own shaders: the Mental Images Architectural Shaders (MIA). These enable you to create a broad spectrum of materials, giving you loads of control on the appearance of your model; from conceptual to hyper-realistic.

Preparation: 3D model

In this tutorial we'll use a 3D model that was exported from Autodesk Revit. You can import 3D geometry from most applications:


  1. Download the Maya project for this tutorial. Save it in a convenient location
  2. Extract the ZIP-archive
  3. Open Maya
  4. File » Set Project... Browse to the location where you extracted the ZIP-archive. Select the "Basic_visualization_project" folder and click Set
You've now specified in which project you're working. This is essential to make sure Maya knows on which set of files and in which folder structure to work. Remember that you need to Set your project every time you start Maya and before you open a scene file.
Imported mesh geometry in Maya
  1. Open the "Wijburg_fbx_export.mb" scene file
  2. Press 5 on your keyboard to switch to shaded mode.
  3. In your perspective viewport, click Shading » Wireframe on Shaded

Cleaning the polygon mesh model

When you import a polygon mesh, it will be triangulated in most cases. This makes it a little bit more difficult to work with in Maya. In the next steps we'll fix this:

All geometry is selected
  1. Select all objects by dragging a selection window across you model
  2. TOI shelf tab.jpg
    Open the 'TOI' shelf
    if you don't have the TOI shelf, refer to the prerequisites
  3. Clear edges icon.png
    Click the Clear Edges icon in the TOI shelf
  4. The Clear Edges script will now run and remove unnecessary edges from the selected objects (undoing the triangulation where possible). This may take a while


The end result should be a cleaned 3D model:

Basic visualization-cleaned model.png

There's still one issue with this model. Because of the way it was exported from Revit, there's a large number of materials (shaders) which aren't optimized for rendering in Maya. In the next sections will examine how to organize your shaders and correct this issue.

Selecting the Render Engine

The render engine takes care of translating the information in your 3D model into a 2D image. Which shaders you can use in Maya depends on the render engine you select. In this tutorial we're using Mental Ray and its MIA material shaders.

  1. Open your Render Settings: use the button in the Status Line Render settings status line.jpg or go to Window » Rendering Editors » Render Settings.
  2. Set Render Using to Mental Ray
    Maya Render Settings Mental Ray.png
If the Mental Ray option is not shown in the pull-down menu of the Render Settings, go to: Window » Settings/Preferences » Plug-in Manager and make sure the check-boxes for Mayatomr.mll (Mayatomr.bundle on Mac) are checked.

Managing shaders in the Hypershade

Shaders (materials) are organized and created in the Hypershade.


Open the Hypershade: Window » Rendering Editors » Hypershade

The Maya Hypershade

You can access the Hypershade through: Window » Rendering Editors » Hypershade

The Hypershade has the following components:

Menu- and Toolbar
Menu's and buttons for frequently used functions
Library
Overview of all the shaders that are present in your scene. Note that there are tabs for other types of shaders, besides materials, as well.
Create Bar
Overview of all types of shaders that are available. When you click an item, a shader of that type is created. It will show up in the Work Area, but also in your library
Work Area
Shaders may be linked to create advanced shader networks. This is done here.


You can navigate in the Library and Work Area using the same navigation as in the Maya viewport: Alt + MMB to pan, Alt + RMB to zoom.


As you can see, there is a large number of Phong shaders in this scene. This is caused by the way Revit exports 3D models in the FBX format. Almost every object currently has it's own shader. This isn't manageable and moreover: Phong shaders are fairly old and not optimized for the Mental Ray render engine. This will result in lower performance and limited options. So we will replace them with Mental Ray MIA materials.

There's also a Lambert1 shader in your library. This is the default material in Maya.

Lambert1 is the default material in Maya. Don't delete or change it!

First we'll assign the Lambert1 material to our entire model, so we can remove the Phong shaders from the Hypershade. Lambert1 will be a temporary material. We'll assign final MIA shaders at a later stage.


Assign Lambert1 to selected objects
  1. Drag your Hypershade to the side, so you can see your perspective view.
  2. In your perspective window, select the entire model.
  3. Drag you Hypershade back, so you can see the Lambert1 shader in your Library
  4. RMB-click on Lambert1 and keep your mouse button pressed
    Select Assign initialShadingGroup To Selection and release your RMB.
  5. In your perspective view you should see a small color change as the objects change to a slightly darker shade.
  6. In the Hypershade, choose Edit » Delete Unused Nodes to remove Phong shaders which should now be unused. This may take a moment depending on the complexity of your scene. If not all Phongs are deleted, you probably didn't assign Lambert1 to all geometry in the previous steps.


The end result should be a nice and clean Library in the Hypershade:

Basic visualization-cleaned shaders.png

Materialization of the main elements of the building

Now we can start creating our own materials for our 3D model. These are called shaders in Maya. There are many types of shaders, each with their own unique qualities and options. In architecture most materials can be created using a single type of shader: the MIA Material X shader. The MIA material is a shader that can only be rendered using Mental Ray in Maya.

In this section we're going to create some basic shaders for our 3D model, starting with an opaque material. Opaque materials don't have sharp reflections (not shiny), but only have diffuse reflections. There are two main parameters that control the appearance: the color and the 'weight'. The color is rather self-explanatory; weight determines the amount of light that is reflected (diffuse); the rest is assumed to be 'absorbed'. Most natural materials absorb at least a small amount of light.

Creating a new Diffuse MIA Material X shader

Create MIA Material X in the Hypershade
  1. Open the Hypershade
  2. In the Create Bar, Open the Mental Ray section, then click Materials
  3. Click mia_material_x in the list.
  4. A new mia_material_x node will appear both in your material library and in your Work Area:

Hypershade-New MIA X created.png


Now a new shader has been created, we can configure it:

MIA Material X Attributes
  1. Double-click the new mia_material_x node
  2. The Attribute Editor will open. Depending on your settings it will either open in a new window, or it will be docked into the main interface (commonly on the right side). See the image at the right.
  3. First of all: give your shader a proper name!. You'll probably have quite a few materials in your model, so proper naming is crucial. At the top, change the name from mia_material_x1 to something more meaningful, such as mia_stucco_exterior.
  4. Note: By default a new mia_material_x will be reflective. We'll change this first. In the Reflection section, set the Reflectivity to 0.
  5. The Diffuse section has settings for the attributes related to diffuse shading. Double-click the color swatch of the Color attribute to pick a color. In this example we're going to create a White material for our stucco walls. Don't pick a 100% white color, as white in the real world is seldomly perfect white.
  6. Next we're going to change the weight. White stucco will absorb a small amount of light, so the Diffuse weight will be somewhere between 0.8 and 0.95. When you choose a darker shade for your stucco, the diffuse weight will be lower (0.4 - 0.8).
  7. That's it for now.


Don't change the roughness; it's not the roughness in the way you probably think it is.


Our first MIA shader applied to the model

Now we're going to apply this shader to parts of our 3D model:

  1. Drag your Hypershade to the side so you have a clear view on your perspective view in the main window.
  2. Select (some of) the walls of your model. Use Ctrl+Shift+LMB to add to your selection, use Ctrl+LMB to remove objects from your selection.
  3. Drag your Hypershade back, so you can see your new Stucco material in the Hypershade
  4. RMB-click on mia_stucco_exterior (or whatever name you specified) and keep your mouse button pressed
    Select Assign Material To Selection and release your RMB.


Creating a Reflective MIA Material

Some materials are mostly characterized by the fact that they are reflective. In some cases this becomes apparent because you can see reflected images in the material (reflection), like with mirrors or highly polished marble for example. But also when there's no apparent reflection, they can still stand out because of a related phenomenon: the reflective highlight. In computer graphics (CG) these two related phenomena are sometimes handled and configured separately, as we will see in a bit.


First we're going to make our first reflective material. We'll start by making a metal material for our railings.

  1. In the Hypershade, create a new MIA Material X shader, just like the previous example.
  2. Open the attributes of the new shader.
  3. Name it! For example: mia_metal


MIA Material X Attributes


Now let's examine some of the Reflection attributes a little closer:

Reflectivity
The amount of light that is reflected. See also: the physics of the MIA Material
Glossiness
When set to '1, all reflected light will be reflected in a 'sharp' reflection (like a mirror). When set close to 0, reflected light will be highly diffused (like brushed aluminum)
Glossy samples
determines the quality of glossy reflections. A higher number will result in higher quality (but at a -sometimes very high- performance penalty!). Has no effect when glossiness is set to 1 (only sharp reflections)
Highlights only
when enabled, Mental Ray will not calculate a reflection image, but only highlights. This is a great time-saver for materials which don't really have a noticeable reflection apart from the highlight!
Reflection Color
Advanced. Sets the color which is used to 'change' the color of the reflected light. Incoming light is multiplied by this color to determine the color of the reflection. When set to white, the color of reflected light will not change (default and used in most cases). But some materials change the color of reflected light. This effect can be set here.
Metal Material
Advanced. When enabled, the diffuse color defines the color of reflections, and the reflectivity parameter sets the "weight" between diffuse reflections and glossy (metallic) reflections. When off the reflection color parameter defines the color and the reflectivity parameter the intensity and colors of reflections (default).


Glossiness can be very costly to render, resulting in long rendering times. Use this only when really necessary and when it's visible. For distant and very small objects it's often difficult to see the effect, so don't apply it in those cases; it will save you loads of rendering time.


Back to our metal material:

Metals applied to our model
  1. Set Reflectivity to 0.3 for a not too shiny metal material.
  2. Leave Glossiness at 1. We don't need glossy reflections (the small effect that would be visible does not outweigh the cost of extra rendering time)
  3. Set Highlights Only to On
  4. We leave the reflection color set to White and we won't use the advanced Metal Material option.
  5. Go to the Diffuse section
  6. Set the Diffuse color to something you like. Maybe a fairly bright red? Or a modest black?
  7. Set the Diffuse Weight to about 0.9. Metals (painted or not) will absorb a little light.
  8. That's it!


Now you can assign the material to the railing in your model.


If you'd like to use two different colors of metal, you can duplicate your shader. Select it in the Material Library of your Hypershade. Click Edit » Duplicate » Shading Network. A duplicate appears in the Hypershade. Double-click it to change the color (and maybe some other attributes. Don't forget the name!


You can continue making materials for the floors, roof, ground and so forth. In the section Materialization of details we'll continue making materials for the details such as the roof fascia, doors and windows. We'll also cover creating a transparent glass material.

In the next section we'll set up for rendering, so you can see how your materials look in the rendering. You'll probably want to make some adjustments based on the results.


Setting up for Rendering

We're going to use the Mental Ray render engine and its Physical Sun and Sky system. You've already set the rendering engine to Mental Ray in the previous steps. Now we're going to take care of setting up the Physical Sun and Sky for lighting and configure Mental Ray for some basic settings that control the quality.

Creating the Physical Sun and Sky

Indirect Lighting Environment options
  1. Open the Indirect Lighting tab and open the Environment section:
  2. Click the Create button for Physical Sun and Sky


The SunDirection in the origin of your Maya scene

Maya creates a directional light in the origin of the scene that determines the direction for the Physical Sun light.

The Sun direction (or: its position in the sky) also automatically controls the color of the sky dome. To adjust the direction of the light, you can select the directional light and rotate it using the rotate tool.

The physical sky and physical sun have now been set up and provide physically accurate lighting to render your scene.

Basic Mental Ray Configuration

It's recommended to configure some specific Mental Ray Render Settings. Most render settings control the quality of the images and which methods, features and options to use. In general most options that increase the quality or enable highly realistic features, cause the time the computer needs to calculate the image (rendering) increases. So it's worthwhile to spend a little time optimizing these settings.

In most cases you can lower some settings when you're still making test renderings. Only when you're rendering the final images, it's necessary to increase the image size (width and height in pixels) and the quality settings.

Open your render settings again by clicking the render settings button.

Image Quality

Render Settings: Image Size
  1. Open the Common tab.
  2. In the Image Size section set the image size, using one of the presets, to 320x240 or 640x480 for test renderings.
You can also specify the image resolution manually. Changing the ratio between width and height to something other that the default 4:3 can be very useful. Square (1:1) or widescreen (16:9) renderings have a very different impact. It also enables you to specify a portrait image, by switching width and height.

Further reading: Basic rules of composition


Render Settings: Image Anti-Aliasing Quality
  1. Open the Quality tab and go to the Anti-Aliasing Quality section
  2. Open the Raytrace/Scanline Quality subsection. Set the Max Sample Level to 1; the Min Sample Level will automatically be set to -1.


Lighting Quality

Mental Ray Final Gathering settings
  1. Open the Features tab
  2. Make sure Raytracing and Final Gathering are enabled.
  3. Open the Indirect Lighting tab and open the Final Gathering section.
  4. Set the Accuracy to 30.
  5. Set the Point Density to 0.6.
  6. Set Point Interpolation to 20

Lowering the settings at this moment will ensure quick render times. The quality will not be very high, but at this stage these setting should suffice for this type of scene (Exterior rendering using Physical Sun and Sky). Our test renderings will mainly be used to check our new materials and determine the best sun direction.

Making the first Rendering

To be able to make a rendering, you need to set your camera to desired location and viewing direction. At this moment there is only one perspective camera: persp. We could use this for rendering. For now we'll do that, but it may be useful later on to create additional camera's, especially when you want to create multiple renderings from different locations in your scene.

When you use the Physical Sun and Sky and you create new Cameras, be sure to update the camera connections to the physical sky

We want our render to be made from the same position each time we render. As the persp camera is also the camera we use to navigate through and work on our model, this would be a problem. To solve this, we'll create a Camera Bookmark for the position we choose for rendering.

  1. In your persp viewport, navigate your camera to the desired location for rendering.
  2. In your viewport, choose View » Bookmarks » Edit Bookmarks...
  3. Enter a name for this bookmark and press Enter. The bookmark is saved.
  4. Click Maya Render current frame.png (Render the current frame) in the Maya Statusline

When you want to position your camera to one of the positions stored in your Bookmarks, choose View » Bookmarks » 'name of the bookmark' in the menu bar of your viewport.

A normal perspective viewport doesn't give an exact insight in which area will be visible in the render. Use View » Camera Settings » Resolution Gate to display a frame (gate) around the part that will be visible.

Materialization of details

The section Materialization of the main elements of the building covered assigning shaders to objects in our model. But for some parts of the model it would be great to be able to assign shaders only to certain parts of an object. For example: most windows are a single object, containing both the window frame and the glass. Of course we'd like to assign different shaders. Fortunately you can do that. This section shows you how.

  1. Create a shader for the window frames. You can decide whether it's opaque (for example: painted wood), or somewhat reflective (metal or high-gloss paint).
  2. Select all windows and assign this shader. The glass part of the window will have this material as well for now.

Basic Visualization-More materials applied.png


Use the GlassThin Preset
  1. Open the Hypershade and create a new mia_material_x. Open the attributes (double-click).
  2. Name the material mia_glass.
  3. For the configuration, we're going to use one of the presets. Click the Preset button (top right) and hold your mouse button down. Choose GlassThin, then Replace. This will completely replace the current attribute settings with those of the GlassThin preset. You can close the Attribute Editor for now.
  4. Move the Hypershade to the side.


Next we're going to select only the glass panes of our windows. To do that we need to switch Maya from Object Mode to Component Mode. In Component Mode you can select components (such as: edges, vertices and faces) of objects.

  1. Click the Modeling_with_polygons#Component_mode Component Mode button in the Statusline. Deselect any component filters that may be active. Then make sure the Face selection is selected:

    Maya-Componentmode Face selection.png
  2. Now click one of the Windows:

    Basic Visualization-ComponentMode Selection step1.png
    The object is highlighted in a light-blue color.
  3. Hover your mouse over the glass pane:

    Basic Visualization-ComponentMode Selection step2.png
    PArt of the window should be highlighted in green.
  4. LMB-Click to make the selection.
  5. Drag your Hypershade back in to view. Assign your glass material.
Assigning shaders to faces can be a bit tricky at first. Start with assigning them one at a time first. After a bit of practice you can make selections of multiple faces and assign shaders in one go.
In this tutorial we use the option of selecting faces by the whole face (you can click anywhere in the polygon face). There is another method in Maya: selecting by Face Center. Every face then gets a small square in the center that is used to select the face. Sometimes this is easier. You find this option in Window » Settings/Preferences » Preferences » Selection

Now there's a small problem: the glass has two faces (one on the outside, one on the inside) and we've only selected the outer face. To select the inner face, we have to go to the other side of the window. To make this a little easier, we're going to temporarily hide all other objects, except for the window(s).

  1. Go back to Object Mode Maya-Objectmode.png
  2. Select the window(s)
  3. Click the Maya-Isolate select button.png (Isolate Select) button in the menu bar of your view panel. This will hide all objects that are not selected.
  4. Go to Component Mode, Face selection
  5. Navigate to the back (interior) side of the window. Select the inner glass panel.
    Basic Visualization-Isolate Select Selection.png
  6. Assign the glass material. You could also delete the face (press del) in this case, as a single face is enough to visualize the glass.
  7. Exit the Isolate Select mode by clicking the Isolate Select button again
Note that the glass is displayed black in your viewport. This is because your viewport only display very basic shader properties. Transparency, reflectivity and so on won;t be visible until you render!
When you have to select multiple faces, sometimes it's easier to drag a selection window, maybe selecting to many faces, and then removing specific faces from your selection: Ctrl-click or dragging a window selection while holding Ctrl.


You can use the same method to assign materials to the flat side of the roof, the roof fascia's and other details. Your result could look something like this:


Basic Visualization-Render materialized low quality.png

In some cases you may have some difficulty when you assign a material to the glass panels where it seems the shader has been assigned properly, but when you render, another shader is displayed. This has to do with the fact that when you have multiple windows in your model of the same type, these are created as instances (used here in the Modeling a Orthogonal pavilion Tutorial). A quick solution is to select your windows and convert them from instances into normal objects through Modify » Convert » Instance to Object


Note that the render quality is still low. It good enough though to check your shaders. In most cases you need to make some small -or larger- adjustments to the color, weight or reflectivity.

Solar study

When using the Physical Sun and Sky, you can manually position the Sundirection. This is fine for some visualization purposes, but when your visualization requires accurate sun lighting, you may want to use the Sun Simulator script for Maya (developed by TOI, TU Delft).

The TOI Sun Simulator is part of the TOI Maya Toolbox (see prerequisites).


Improving the render quality

So far we've rendered using low quality settings to improve speed. When your light-setup and materials are finished, you may want to make a final render with higher quality.

There are three areas to improve the quality:

  • Image size. The number of pixels, width and height, of your image
  • Anti-aliasing. Edges, especially diagonal or curved, are course and jagged.
  • Light quality. Quality of the light calculations (Final Gathering)

Image size

We've used a small image resolution to improve the rendering speed. But 640x480 or equivalent is too small for full-screen display or printing.

In the next examples we assume a landscape orientated image with a 4:3 aspect ratio. Change the numbers accordingly if your image is in portrait orientation or has a different aspect ratio.

When you're displaying the image on a computer display or beamer, you need at least 960 x 720 pixels(or equivalent). You may go up to 1400 x 1050.

When you're going to print the image, the required size depends on the size you'll bee printing the image or the size you want it to be on your poster.


  • A4/A3 posters: multiply the dimensions in centimeters by 60.
    Example: 15 cm * 60 = 900 pixels (150 pixels/inch)
  • A2-A0 posters: multiply the dimensions in centimeters by 45.
    Example: 60 cm * 40 = 2400 pixels (100 pixels/inch)


Image Size settings in the Render Settings

To change the image size:

  1. Open your Render Settings
  2. Go to the Image Size Settings
  3. Check "Maintain width/height ratio". This will automatically change either the height or width when you the other setting, keeping the width/height aspect ratio the same
  4. Change either the width or height to the desired number of pixels
Note that the Resolution setting is only needed when you specify the width or height in a distance unit (mm, cm or inches). Maya will then calculate the number of pixels using the resolution.


Anti-Aliasing

Anti-aliasing quality controls the smoothness of edges in renders. The image below shows the difference between high and low settings of anti-aliasing. High settings improve the quality of the render, but will also increase render time.

Phys06b.jpg

We've already set the Anti-Aliasing quality min/max to -1/1. This is fine for most renderings. Only for fine details you may want to increase this a step further.


Render Settings: Image Anti-Aliasing Quality


  1. Open the Quality tab and go to the Anti-Aliasing Quality section
  2. Open the Raytrace/Scanline Quality subsection. Make sure the Max Sample Level is set to 1; the Min Sample Level will automatically be set to -1.
  3. Set the Anti-aliasing contrast to 0.05. This improves the current Anti-Aliasing quality a bit without too high of a performance penalty.
  4. Under Multi-Pixel Filtering, set Filter to Mitchell. This will yield sharper results. Gauss would be less sharp, Lanczos even sharper (often a little too much).
Only increase the Max Sample Level to 2 when this is really necessary. It will increase render time.

Lighting Quality

Mental Ray Final Gathering settings, final quality
  1. Open the Indirect Lighting tab and open the Final Gathering section.
  2. Set the Accuracy to 80.
  3. Set the Point Density to 0.8.
  4. Set Point Interpolation to 40.


If the lighting is still a bit spotty, you can increase the Point Density to 1.0 (not higher) and increase the Accuracy in steps of 20 until the quality is good. If the spottiness doesn't change when you increase these settings, it's probably something else...

File Textures: gamma correction

Mental Ray gamma correction in the TOI Texture Tools

When you use file textures (not part of this tutorial), please note that you must apply Gamma correction to get proper results. Failing to apply gamma correction will yield washed out results:

MR gamma correction off.jpg
MR gamma correction on.jpg

When you have installed our TOI Toolbox in Maya (refer to Prerequisites), you can use the TOI Texture Tools to do this. Click the TOI shelf texturetools.jpg icon in the TOI shelf.

In the Gamma corrention for Mental Ray, click the Update Framebuffer and Exposure Gamma.

If you don't (want to) use the TOI Texture Tools to fix this or if you want to learn a bit more, refer to Exposure control and File textures

That's it!

Personal tools
Actions
Navigation
Tools