Basic visualization in Maya
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.
Contents
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:
- Revit to Maya (Polygon mesh)
- Rhino to Maya (NURBS surfaces)
- Sketchup to Maya (Polygon mesh)
- Download the Maya project for this tutorial. Save it in a convenient location
- Extract the ZIP-archive
- Open Maya
- Browse to the location where you extracted the ZIP-archive. Select the "Basic_visualization_project" folder and click Set
- Open the "Wijburg_fbx_export.mb" scene file
- Press 5 on your keyboard to switch to shaded mode.
- In your perspective viewport, click
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:
- Select all objects by dragging a selection window across you model
-
Open the 'TOI' shelfif you don't have the TOI shelf, refer to the prerequisites -
Click the Clear Edges icon in the TOI shelf - 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:
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.
- Open your Render Settings: use the button in the Status Line or go to .
- Set Render Using to Mental Ray
Managing shaders in the Hypershade
Shaders (materials) are organized and created in the Hypershade.
Open the Hypershade:
You can access the Hypershade through:
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.
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.
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.
- Drag your Hypershade to the side, so you can see your perspective view.
- In your perspective window, select the entire model.
- Drag you Hypershade back, so you can see the Lambert1 shader in your Library
- RMB-click on Lambert1 and keep your mouse button pressed
Select Assign initialShadingGroup To Selection and release your RMB. - In your perspective view you should see a small color change as the objects change to a slightly darker shade.
- In the Hypershade, choose 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:
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
- Open the Hypershade
- In the Create Bar, Open the Mental Ray section, then click Materials
- Click mia_material_x in the list.
- A new mia_material_x node will appear both in your material library and in your Work Area:
Now a new shader has been created, we can configure it:
- Double-click the new mia_material_x node
- 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.
- 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.
- 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.
- 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.
- 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).
- That's it for now.
Now we're going to apply this shader to parts of our 3D model:
- Drag your Hypershade to the side so you have a clear view on your perspective view in the main window.
- 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.
- Drag your Hypershade back, so you can see your new Stucco material in the Hypershade
- 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.
- In the Hypershade, create a new MIA Material X shader, just like the previous example.
- Open the attributes of the new shader.
- Name it! For example: mia_metal
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).
Back to our metal material:
- Set Reflectivity to 0.3 for a not too shiny metal material.
- 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)
- Set Highlights Only to On
- We leave the reflection color set to White and we won't use the advanced Metal Material option.
- Go to the Diffuse section
- Set the Diffuse color to something you like. Maybe a fairly bright red? Or a modest black?
- Set the Diffuse Weight to about 0.9. Metals (painted or not) will absorb a little light.
- That's it!
Now you can assign the material to the railing in your model.
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
- Open the Indirect Lighting tab and open the Environment section:
- Click the Create button for Physical Sun and Sky
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
- Open the Common tab.
- In the Image Size section set the image size, using one of the presets, to 320x240 or 640x480 for test renderings.
Further reading: Basic rules of composition
- Open the Quality tab and go to the Anti-Aliasing Quality section
- 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
- Open the Features tab
- Make sure Raytracing and Final Gathering are enabled.
- Open the Indirect Lighting tab and open the Final Gathering section.
- Set the Accuracy to 30.
- Set the Point Density to 0.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.
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.
- In your persp viewport, navigate your camera to the desired location for rendering.
- In your viewport, choose
- Enter a name for this bookmark and press Enter. The bookmark is saved.
- Click (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
in the menu bar of your viewport.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.
- 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).
- Select all windows and assign this shader. The glass part of the window will have this material as well for now.
- Open the Hypershade and create a new mia_material_x. Open the attributes (double-click).
- Name the material mia_glass.
- 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.
- 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.
- 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:
- Now click one of the Windows:
The object is highlighted in a light-blue color. - Hover your mouse over the glass pane:
PArt of the window should be highlighted in green. - LMB-Click to make the selection.
- Drag your Hypershade back in to view. Assign your glass material.
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).
- Go back to Object Mode
- Select the window(s)
- Click the (Isolate Select) button in the menu bar of your view panel. This will hide all objects that are not selected.
- Go to Component Mode, Face selection
- Navigate to the back (interior) side of the window. Select the inner glass panel.
- 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.
- Exit the Isolate Select mode by clicking the Isolate Select button again
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:
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.
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)
To change the image size:
- Open your Render Settings
- Go to the Image Size Settings
- 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
- Change either the width or height to the desired number of pixels
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.
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.
- Open the Quality tab and go to the Anti-Aliasing Quality section
- 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.
- Set the Anti-aliasing contrast to 0.05. This improves the current Anti-Aliasing quality a bit without too high of a performance penalty.
- 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).
Lighting Quality
- Open the Indirect Lighting tab and open the Final Gathering section.
- Set the Accuracy to 80.
- Set the Point Density to 0.8.
- Set Point Interpolation to 40.
File Textures: gamma correction
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:
When you have installed our TOI Toolbox in Maya (refer to Prerequisites), you can use the TOI Texture Tools to do this. Click the icon in the TOI shelf.
In the Gamma corrention for Mental Ray, click the Update Framebuffer and Exposure Gamma.
That's it!