UDK - Importing Models From Maya as Static Meshes



About the FBX pipeline for Maya 2012:


Models and Static Meshes In UDK

Most models used in UDK are based on "static meshes". Static meshes are models, usually imported from other software. They are called static meshes because they don't contain any animation or rigging data. Even when static meshes are used for moving objects in the game engine, such as an "InterpActor", the static mesh itself doesn't have any animation data.

Static meshes are stored in packages.  This means that if you want to work with models created in other 3D applications, you will need to import the content into UDK and save it inside a package.  Furthermore, in order to work efficiently and not loose track of what is going on, good organization and naming conventions are important.


Organization For Loading And Saving Static Meshes In UDK

There are a lot of different ways to organize assets, and different naming conventions. The ideas presented here are not the only ways to be organized.  However, the following organizational strategy and naming conventions will ensure that your content works correctly in game, and is easy to import and save.

UDK stores assets in "packages", and packages should always be placed somewhere inside the content folder, or in a subfolder of the content folder.  Packages themselves are like zip files.  They can contain many assets and compression is used frequently in order to store the content on disk efficiently.

The default content location for udk is:

Inside the udk content folder, for each project you create, you should have your own folder:


For example, if your name is Joe, and your project is called "house", the folder could be:

Here's a breakdown of the folder structure you should end up with


Set project to your maya project
btw:  I recommend ending all maya projects with "__maya" so that they can be easily identified as maya projects rather than arbitrary folders.




Preparing And Exporting A Static Mesh From Maya

Make your model as efficient as possible first, taking consideration needs for lighting, etc.

Things like UV seams, hard edges, and multiple materials slow down mesh rendering.  Of course,
they also improve the look of the model, so do use them, but only use them where they give
a visual improvement.

Things that slow down polygon drawing:
    New triangle strips/fans
    Hard edges 
    UV seams
    Material Boundaries (really slow, starts a new "draw call")
    New objects
      Keep in mind UDK merges all renderable objects for each static mesh
	Things like Deformation, physics etc will slow it down even more,
	and are beyong the scope of this discussion.
      Also merges smooth skin rigged meshes on export
Remember that you can use multiple levels of detail (LODs) for each static mesh.
Complex versions will be shown close up, and simpler versions shown when farther
from the viewer.

-combine your model or models
 (all combined stuff will be one object in udk)

-move the prop so it is at or standing at the origin
-put the prop/character at the origin
-snap his pivot point to the origin
 (move pivot mode, hold x to snap to grid)
-delete history

Make sure your model has good lightmap uvs
to make lightmap uv set
select your geometry
push the down arrow on the keyboard to select the shape node
open UV window
select all uvs
polygons > copy uvs to uv set > copy into new uv set
then, layout the new uvs so they are non overlapping, non-flipped, and all within zero to one range.
(you can select uvs and use Polygons > Layout to automatically make them non-overlapping)

name your model or models
get a material on the model
 (phong e is best)
 (a lambert is ok)

if you want organized materials name them right:
call the materials:skin00_mat, skin01_mat
call the shading group: skin00, skin01, skin02

the reason for this is because they will show up in UDK in this order
(udk understands this naming convention, and will order material appropriately.)

make collision objects
-very low poly
-all convex

note: the underscores in the above names are *crucial*

Window > Settings Preferences > Plugin manager
enable the plugin called "fbxmaya"
(check loaded and autoload)

To Export:

Select the object you want to export (select the transform node, which Maya does by default when you click on an object)
Edit > Select Heirarchy (selects all children)
File > Export Selection

For file type choose FBX export

In the options on the right
 open geometry section
  enable smoothing groups

go to the path of your package, and to its src_udk folder:


save it with a good name. Make sure it ends in "__mesh"

eg. your_model_name__mesh

(Note that that two underscore separate the descriptive name from the type name. This is a useful technique.)



To import the content into UDK:

Open content browser

click new

name your package just like your folder:
ex:  your)name__your_package_name__udk

name your new material just like your asset, but with _mat on the end


set factory to material and click ok

the material editor will appear
you can leave the material black for now or follow the optional side note.

hit the checkbox (top toolbar, farthest left)  and then close the material window

Right click on your material in the content browser
choose: save
goto your packages folder  (ex: yourname_imrod_udk  )
*don't* change the package name (it should already be yourname_imrod_udk)
click save

Import the mesh by clicking import in the content browser and then choosing your exported fbx file.

A box will appear with import options.  Ensure that the correct package name is entered and that the mesh name is correct.  If the file you imported was named correctly, then the name should be correct automatically.

All of the default options should be correct for importing static meshes, so click "ok" to complete the process of importing your static mesh.

After importing the asset, double click it to open in the static mesh editor
Enter in a better size for the light map resolution. (It defaults to a very low number such as 32. Reasonable numbers for most objects are anywhere from 64 to 512.)  Note that if the resolutions is not high enough, you will have ugly lighting because the texture used for UDK's baked lighting will not be accurate enough. Also note that the higher the resoution you use, the slower the lighting of the object will be when building the lighting for your levels.

512 can be used for very very important objects, but it really slows down the build
256 for large important objects
128 for typical objects
64 for unimportant objects.  

You may wish to use lower values for light map resolution in the static mesh editor, and then override them in your scene. Read the lighting page for more information.

To connect materials to your static mesh:

Open the static mesh
back in the content browser, select the material you want to connect to it
go to the static mesh window again
find LOD info in the right column
open up LOD info, open all the sub headings until you can't open any more
you will see "material" slots, with green arrows beside them, click the green arrows to connect the material



Textures for UDK


Naming Textures
  Name your textures ending in __tex
  Include something in your textures name which represents how you will use it
    eg. __diff__ , __spec__ , __norm__  
  if they are for a specific asset/prop, name them starting with that asset name
eg: pillar__diff__tex, pillar__emis__tex, pillar__norm__tex, pillar__spec__tex Prepare your textures to bring into UDK Textures should usually be square, but don't have to be double wide textures are not uncommon Sometimes rectangular textures are very useful.  They are more challanging to use properly. To use rectangular nonsquare textures, you can tile them in engine later by an amount that makes them square. For example, for a texture that is double width, change V tiling to 2, and the pixels will be squre. Ensure correct texture resolution Each dimension should be a power of 2 eg. 2,4,8,16,32,64,128,512,1024,2048,4096, 8192 (beyond 4096, such as 8192, may need special settings) Ensure Image Mode is RGB and 8 bits per channel Save PSD versions of your textures with all their layers Save copies of your images as specified in the next section. Save copies of your images for UDK Regular textures can be targa's or pngs In general PNGs are better, but use targars for transparent images Because photoshop always fills the transparent parts of PNGs with white, it causes problems. Thus the advice given here is: Use targa's for texture maps with alpha (transparency). When saving ensure you save them as 32 bit. If you use targa's for anything you don't need alpha for, make sure you save as 24bit, otherwise you are wasting a lot of texture memory on the alpha channel. Uses PNG images for most textures. They are much smaller file size than targas and are the same quality. To save them from photoshop, use File > Save For Web Choose PNG 24 as export type Turn off transparancy Save the image Import Textures Into UDK After setting up your project/packages, activate your package and click import in the content browser. Setup your texture settings for each texture (Most of these settings can be changed later by double clicking the texture) Compression Settings: TC_Default (for most textures) TC_NormalMap (for normal maps) Normal map might look funny (dark blue) in material editor, that's ok TC_Greyscale (for only one channel of data) LOD Group: TEXTUREGROUP_Cinematic (good for demo reels)

Matching Your Level Size and Layout In Your 3D Application

You can use the following process to bring a UDK level into Maya.  Similar processes will work for most other 3D applications.

Export your UDK scene so you can open it in Maya
Use File Export All to export from UDK
When working on modeling for UDK, start with a gridwith settings all at one.(Length, Gridlines, Subdivisions)If you want to see a larger grid, make thelength/width larger.To match a particular grid spacing in UDKchange the "Grid lines every" setting.

You should import to maya from UDK,and then clean up the imported model.
Import model to Maya from UDKFile Import > find your obj that UDK exportedGo to 4 views if you are in only one viewChange the grid size to work well with udk:  Display > Gid > Options    Length and Width: 16    Grid lines every: 16    Subdivisions every: 1View > Select CameraChange in attribute editor  near clip: 1  far clip: 99999Repeat for other camerasApply a new lambert to your udk geometryNormals > Unlock  (obj normals are bad)  (Always do this when importing objs to maya)Delete polygons you don't need (double click is useful)

Edit Mesh > Merge > Options
Threshhold = 0.01  Turn off always merge two vertices

Again, delete polygons you don't need (double click is useful)

Select the entire objectNormals > Set Normal Angle Options > Angle=2

Select all the soft edges and delete them.

Select your object
Select all it's edges
  Ctrl-F10  (selects all edges from selected object but doesn't go to edge mode)
  RMB drag > Edge (mode)


If you have MmmmTools:

MmmmTools > Modeler > Modeler Select Hard Edges
Select Invert
Delete edges

If you don't have MmmmTools:
Select > Select Using Constraints
Choose Smoothing > "smooth"
Choose "All and next"
Delete the edges
Push "Close and Reset"  (otherwise you won't be able to select things)

Turn on your viewport culling  In View menu use Shading > Backface CullingIf needed > Normals Reverse
Put your udk reference object on a layer, set  the layer to "R" mode

Now make static mesh objects (and collision objects) and export to UDK. Things will match up in size if you match them to the reference objects.

If you export something away from the origin, and want to put it in exactly the sameplace in UDK, simply edit the properties in UDK, open the movement section, and set the XYZ values to zero.

If you want to be able to recycle objects in UDK, the best method is to export it from Maya at the maya origin. The maya origin will be the object's pivot point in UDK.  You could then move it to the correct location in UDK.

Links - Additional Related Content



Teaching3D is a creation of Joe Crawford