Monthly Archives: August 2012

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

Neals UDK Toolbox 0.2

Ok this is my work in progress toolbox for exporting to UDK.

Changelog:

Version 0.2 includes FBX  and T3D Export features

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 UDKToolBox
    
  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.

Optimized Pillar for UDK: Part 1 – Modelling

In this quick tutorial set, I will be creating a pillar and optimize it for leveldesign purposes as well as gaming performance in UDK.

Preperation:

A quick google image search for references and a quick look into Wikipedia:

http://en.wikipedia.org/wiki/Column reveals that a pillar has 3 Parts to it. It is probably the best to create these as three modular Parts, to combine them later on for different sizes, or exchange the Parts.

3 major parts of a column

Defining the Head/Base:

For sake of the tutorial, I am going to be reusing the base as head.

High-Poly Model:

  1.  Switch to the side View (Make sure you are using UDK-Grid Settings)
  2. Create > CV-Curve Tool. With this tool we will create a profile curve for the base
  3. For the first point enable grid-snapping with pressing the key “x”and place it on the origin. Place the rest of the pivots in any way you would like your profile. (It helps to press “Shift” while drawing the curve for more exact results

    Finished profile curve

  4. Select the profile curve in object mode, Surfaces > Revolve (options)

    Revolve Options

  5. Adjust the profile curve to get a better result (If construction history is turned on, changes will be visible instantly)
  6. Select the geometry, Mesh > Smooth

    Smoothed object

  7. Rename the “revolvedSurface1″ to “pillar_base_high_poly”
  8. Create > Poly > Sphere, place the sphere on the edge of the base
  9. Move pivot to center (Press d to modify the pivot)
  10. Edit > Duplicate Special (options) Rotate Y = 22.5 Number of copies = 15

    Duplicate Special Options

  11. Select all spheres, Mesh > Combine
  12. Duplicate the combined spheres for later, hide it (Strg-H)
  13. First select “pillar_base_highPoly”, then select the combined spheres Mesh > Boolean > Difference

    Finished High Poly Base

  14. (optional) Select all edges and Mesh > Fill Holes

Defining the Pillar:

  1. with Ctrl-Shift-H reveal the combined spheres (Alternative select the hidden object in the Outliner and set the Visibility to 1)
  2. In the Side view, select all Edges, with Ctrl-Pressed deselect all edges except the top edges.
  3. Edit Mesh > Extrude (in world mode translate in Y)
  4. In faces mode, delete the remaining original faces from the sphere.
  5. Create > Polygon Cylinder
  6. Scale it and position it above the pillar base
  7. Rename the Cylinder to “pillar_column_highPoly”
  8. Select the top and bottom edge of the cylinder, Edit Mesh > Bevel
  9. First select “pillar_column_highPoly”, then select the combined spheres Mesh > Boolean > Difference

Conclusion:

By enabling  Display > Heads up Display > Polycount you can figure out how many Tris currently the scene is using (In my case 10526 Tris). In Part 2 I will be looking into Normal Maps how to reduce the polys.

Important Note: Booleans are not very useful, this geometry cannot be directly imported into a game engine. This is only a quick way to get a good looking geometry that will be used to calculate the normal map.