Category Archives: Maya

Maya: Infinite white background lighting

The infinite white background look is a very popular look for technical stuff that is suppose to look very clean. You can check it out here how to set up lamps for photography: http://vimeo.com/23653086. In Maya with mental ray you can easily create the effect using Final Gather or an ambient occlusion as light source.

Example Scene

I am using  3 spheres with mia_material_x materials (Default with diffuse color = blue, Chrome Preset, Glass Physical Preset).

Applying material preset

In addition a large poly-plane serves as floor and has a lambert with color = 1,1,1 (white),  Diffuse = 1.0 applied to it.

bg_material settings

Final Gathering

  1. Create a Camera (rename it to “Render_Cam”)
  2. In the Attribute Editor change the Environment > Background Color to white

    Camera Background Color

  3. In the RenderSettings in the Common Tab under Common Options deactivate Default Light

    Disable Default Light

  4. Activate Final Gathering in the Indirect Lighting Tab
  5. In addition to the common quality settings the render quality is determined by the Final Gather Settings increasing Accuracy generally makes better renders.

    Final Gather render, Rendertime 0:05

Note: If you want to render with other cameras you have to set up the environment color again. Alternatively you could use something like a large white sphere around the scene
Also notice that no specular highlights are created by this render, additional poly planes with a lambert wiht incandecence set to white can help to set highlights.

Ambient occlusion light source

  1. Create an Area Light
  2. In the Attribute Editor under mental ray > Area light, activate Use Light Shape, change Type to Custom. under mental ray > Custom Shaders connect a mib_amb_occlusion Node

    Area Light Settings

  3. In addition to the common quality settings the render quality is determined by the Ambient occlusion settings increasing Sample Quality and Adjusting the Max. Distance generally makes higher quality renders.

    Final Render Ambient occlusion Light, Rendertime 0:08

    Notes: Notice that the glass ball has a unnatural shadow. This may look okay depending on the effect you are going for, but generally you would want to exclude glass objects from the Ambient Occlusion calculation using the MI label attribute.

    The Specular Highlights also seem very strong and fake. To reduce this effect in the mia_material_x properties under Advanced you can set the Specular balance to 0 to remove any physically inaccurate specular highlights.

ao_exclude

Snippets: Ambient Occlusion exclude Objects

While using mia_amb_occlusion strange effects can happen when rendering transparent objects. (left glass with AO, right glass eliminated from AO)

To eliminate this effect from an object an extra attribute named  “MI Label “. This short snippet adds the attribute to the selected objects and sets it to the value of 5.

import pymel.core as pm

selection = pm.ls( selection=True )
for item in selection :
   pm.addAttr(item, ln="miLabel", at="short", dv=5)

In the mia_amb_occlusion node the attribute  “Id Inclexcl” must be set to -5 (or negatate the value you set for the MI Label).

Screenshot - 8_28_2012 , 2_55_19 PM

Maya 2013 python: Batch File Converter 0.1

Here is a batch file converter from various formats to mayaAscii or mayaBinary

*Bonus Tools Required: http://www.the-area.com/bonus_tools

Running the script

  1. Download the Script from here
  2. Extract to your User\Documents\Maya\scripts directory
  3. Start Maya, open the script editor and type or copy the following text into the Python window:
    import BatchConverter
    BatchConverter.BatchConverter()
    
  4. Use the “Execute All” button in the script editor OR make a shelf button by selecting the text in the Python window and going to File -> Save Script to Shelf

Optimized Pillar for UDK: Part 3 – Maya Export/ UDK Material Settings

Collision Model

  1. Create > Polygon Primitives > Cylinder(Subdivisions Axis = 8)
  2. Scale it to be used as a collision object for the column
  3. Rename it with the prefix “UCX_” (e.g. “UCX_pillar_column”)
  4. Repeat for the “pillar_base”

    Finished simple collision models

Export to UDK

Select “pillar_base”, “pillar_column”, ”UCX_pillar_base”, “UCX_pillar_column”
File > Export Selected (FileType FBX Export)

Import UDK

Simply drag and drop the resulting .fbx file into the “Content Browser” (make sure import textures/

Create Height Map

  1. In Photoshop open the normal map of the column.
  2. Open the Channel view and copy the Red channel to the Alpha Channel

    Copied Red Channel

  3. (optional) Add effects like noise or texture overlays to this channel
  4. Save it
  5. Repeat for the base

Modify UDK Material

  1. Open the  mat_column material from the Content Browser
  2. Create a Bump Offset Node and duplicate the Texture Sample Node for the Normal Map
  3. Connect the nodes in this way:

 Create a Prefab

  1. Place the base and as many pillars as you need
  2. For the top modify the Movement > Rotation > Roll attribute to 180

    Fake top part

  3. Select all parts of the Pillar, RMB > Create Prefab

Conclusion

Final pillar in UDK

Creating a simple collision object allows UDK to automatically create the collision model. With the Prefab its easy to create multiple pillars.

Important Note: If in the Material a Texture is applied , the Bump Offset must be connected to that Texture

Optimized Pillar for UDK: Part 2 – Normal Maps

General Tips:

Using the Layer Editor

In maya to organize your screen create 3 Layers (“high”, “low”, “collision”) to better organize your screne

Add all the geometry created in the last tutorial to the “high” Layer by first selecting all objects and then RMB on the layer “high” > “Add selected Objects”

Select the Layer “low”, so that the new Objects created are created in that Layer.

Using Gridsnapping

Using the same grid size as in UDK allows you to create modular assets that can be easily placed into a Level.

I adjusted my base to be 16 UnrealUnit (uu) high.

Low Poly Model

Column

  1. Create > Polygon Primitives > Cylinder(Subdivisions Axis = 16)
  2. Rename it to ”pillar_column”
  3. Scale the cylinder to fit the base mesh
  4. RMB on the cylinder > Assign Favorite Material > Blinn (rename it to “mat_column”)

    correctly scaled Cylinder

Head/Base:

  1. Duplicate the “pillar_column” (Ctrl-D)
  2. Rename it to ”pillar_base”
  3. In the side view, move the vertex points on the y-axis to fit the base mesh.
  4. Mesh > Insert Edge Loopand then scale the loop to create a simpler model (repeat as few times as possible but still retaining the original silhouette of the object)

    Finished Model, after adding several edge loops and proper scaling

UV-Layout

In many cases a new UV-Mapping has to be created with the UV-Layout tools. In this case by using the Edge Loop tool I tried to avoid that for this tutorial.

UV-Texture Layout

  1. Window > UV-Texture Editor

    Default UV-Layout for a Cylinder

  2. Select the “pillar_base”
  3. Use the “Move-UV Shell Tool” to change the position of the UV-Shells. Pressing R switches to the scale tool.
  4. Arrange the UVs into a similar way as in this image:

    optimized UV-Layout

  5. Repeat for “pillar_column”

Light Map

  1. Window > UV-Layout
  2. select the “pillar_base” (in Object mode)
  3. (UV-Layout) Polygons > Copy UVs to UV-Set > Copy UVs into new UV set (options) (name it lightmap)
  4. Repeat for “pillar_column”

 Create Normal Map

Theory

A normal map is similar to a bump map, however the amount of displacement information is stored for each axis. Like a bump map the height displacement is stored in  grayscale. The x,y,z information is mapped to the r, g, b channels of an image.

Generate Normal Map

1. Switch to the Rendering view

Switch to Rendering -View

2. Lighting/Shading > Transfer Maps… Change following values in the tabs:

  • Target Meshes: Select the Low Poly Object (“pillar_base”) and press the button “Add Selected”
  • Source Meshes: Select the High Poly Object (“pillar_base_high”) and press the button “Add Selected”
  • Output Maps: Select your output directory, change the Fileformat to Targa, the Mapspace to “Tangent Space”
  • Connect Output Maps: Connect Maps to: Assigned shader (easier for the export to UDK late
  • Maya Common Output:Adjust the Map width for your puropses, Sampling Quality 8×8 for final export

    Transfer Maps Settings Part 1

Transfer Maps Settings Part 2

3. Save your scene file

4. Click on Bake and wait while the normal map is generated

Testing and adjusting Normal Maps

Simply press render to view the generated Normal map

If the map looks wrong. In the Transfer Maps tool, Target Meshes > Display Both to preview what maya takes all into account when calculating the normal map.

Dealing with normal Map errors

Adjust the Search envelope to include objects that are further away.

Conclusion:

Finished ColumnNormal Map

Finished Base Normal Map

To create a normal map a low poly and a high poly object is needed. This method reduced the original tris count from 10526 to 400 for the object.

In the next part we will look at how to use the map correctly in UDK.

Important Note:

While generating Normal Maps it many errors can occur (and it takes a lot of time). Before changing the Sampling quality always test it by doing a test render in low sampling quality.

The Lightmaps created in this tutorial are not adjusted properly and only serve to prevent UDK errors.