Maya To UDK: Importing Static Meshes Using ActorX & FBX
In this tutorial you'll be learning how to import Static meshes from Maya to UDK (Unreal Development Kit) using the ActorX plug-in, as well as the FBX Importer plug-in in Maya. Most importantly we'll be setting up the Maya Grid system to match the Unreal Grid system. We'll be using Maya 2011 here as the ActorX plug-in is only available up until version 2011, after which Epic Games stopped developing ActorX due to the implementation of the FBX pipeline in UDK.
Alright then, first let us setup the grid system of Maya to match with the Unreal Grid System.
Understanding the Grid System
1. A Maya unit is equal to 1 unreal unit, therefore the Ratio of the Maya and Unreal grid is 1:1.
As most of you all know, Character height in Unreal units is around 96 Unreal units tall. But measuring that 96 units in Maya is real pain, we might have to zoom out the camera a couple of times back and forth just to measure 96 units high in the viewport.
To set that up, we really need to understand the Unreal unit first, like how are the grids divided.
If your grid system in Unreal is set to 16 units, then the size of each small square (or grid-line) is 16 Unreal units (UU), and the distance between larger gridlines highlighted in a darker shade, is 128 Unreal units. Therefore, the equation is:
128 / 8 =16 small squares, OR 16x8 =128 Larger squares. That means, the larger Gridlines in Unreal are subdivided by 8 units. Or smaller gridline is multiplied by 8 units. Now that we have the equation, it's time to setup the Maya grid.
Load Maya and then go to display option, Click on the box near the Grid menu to get the grid option, just like in the pic below.
Maya Grid Options
Length and width: As shown in the above pic, this field is for displaying and setting the length and width of the grid in the Perspective view, for example: A Max size of X=512 OR Max size of -X (minus X)= -512 (minus 512). Therefore the total height of X is 1024 that is 1024 square Grid units in Perspective mode. You can set anything you want, but make sure the units are powers of 2. I'm going to set 512 units here. Length and width is just for viewing purposes in Perspective mode.
Grid lines every: As shown in the above pic, in this field whatever Grid units you set in unreal is multiplied by 8 , which subdivide (explained in the next topic) the larger grid line. Unreal grid units in my case are set to 16 units, therefore I'm going to put a value of 128 here (16x8 = 128). We will now have a distance between the darker or larger grid lines of 128 units.
You can also change the color of the Grid lines and Numbers to something like a dark Blue, this is really good for viewing and also measuring larger Grid lines if you want a large object to be modeled quick.
Subdivision: As per the UDK grid system, the number of Small Squares is multiplied by 8 to form larger squares, therefore the larger grid-line is subdivided 8 times. Hence the Value here is 8.
In short, remember the Subdivision value (i.e. 8 )and set the Value of Every Grid-line in Maya to the power of 2. But also make sure that you're setting them according to the Grid-line that you've set in Unreal.
Setting up the Z-Axis in Maya:
We also need to set the world coordinate system in Maya according to the Unreal Engine.
In the Unreal engine, the Z-Axis faces upward. So we also need to set that up in Maya, just go to Windows->Settings and Preferences-> Preferences and in the Categories section, go to Settings and change the world coordinate system to the Z-Axis (shown in the pic above highlighted in green.) If everything is set according to the image above, then let's measure and check the grid-line of Maya.
Measuring the Grid-lines of Maya:
Measure the grid-line of Maya, just to check whether it matches with Unreal or not.
Go to Create->Measure Tool->Distance Tool. With this tool you measure in Maya by clicking the A and B point of any objects. The moment you select the Distance tool from the menu your cursor will change into something like a crosshair. Hold down the X key on your keyboard and click on any two corners of a small grid square of your choice. After that you'll see some value on the screen like in the above image.
If it shows the distance value as 16, then your Maya grid system is matched with the Unreal grid system of 16 units. That's it! You now have the perfect grid-line system of Unreal in Maya. Let's move on to importing the static Mesh from Maya to UDK.
There are two ways of importing static meshes, one is by using the ActorX Plug-in and one is with the Maya FBX Plug-in. Let's start with the Actor X plug-in first.
Before we start, make sure that the Actor X plug-in is installed on your machine, if not. Then download it from the Unreal website or if you have UDK installed on your machine then you can find your suitable version of the plug-in in the installed directory of UDK here: Binaries->ActorX. Copy the ActorX.mll file and paste it into your Maya install directory in the following location: Bin->plug-ins folder.
Enabling the Actor X plugin:
Open Maya and go to Windows->Settings and Preferences->Plug-in Manager.
Enable/Check the ActorX.mll. Also do the same for fbxmaya.mll
Check the Loaded and Auto load options for both, this will enable the plug-ins to load, and also auto load next time when you start Maya, so that you don't have to Check/Enable the plug-ins every time you load Maya.
To bring up the Actor X plug in, we need to type “axmesh” in the script editor window. Axmesh brings up the properties windows for exporting static meshes. It exports in .ASE format which is recognizable by Unreal Engine. Typing axmesh into the script editor window every-time is a bit time consuming, so let's create a shortcut for that in Maya.
Creating a shelf for the Axmesh command:
In Maya go to Windows->General Editors->Script Editor, this will bring up the script editor window.
You should see two tabs in script editor window, one is MEL and the second one is Python. Select the MEL tab and below that type axmesh into the script editor window. Now select the text axmesh, and then middle mouse click on the selected text and drag and drop it onto your shelf as illustrated above.
A new icon will appear on your shelf and that's the shortcut for the axmesh command.
Exporting Static Meshes:
I've made a simple palm foliage. Let's see how to export it via Actor X. This foliage has 4 leaf meshes, each mesh has the same UV layout (i.e. Overlapping.) This is just to demonstrate how to import multiple objects that have the same UV Layout or overlapping UVs.
As you can see all the 4 leaf meshes above have the same UV layout, they are overlapping Uvs and sharing the same texture. But for the lightmaps we need to have separate UVs layouts with no overlapping at all, or else there will be some issues with lighting or some shadow artifacts in the scene. So let's create a separate UV layout to do that. Just select your meshes in your scene and the go to Create UVs->UV Set Editor. A small dialogue box will appear on your screen as shown in the image below.
The UV Set Editor basically shows you a list of all the UV sets linked with your mesh. This is the place where you can add or edit more than 1 texture and UVs.
IN the UV Set Editor, you should see map1. It's actually the main default UV map layout in Maya which is un-deletable. Let's add one more UV layout here for our Lightmap. Just select map1and hit the Copy button. It will now create a new uvset named uvSet1 below map1.
Now select the newly created uvSet1 in the UV Set Editor and also select all the UVs from theUV Texture Editor window and then go to Polygons in the File menu, and select Layout or you can hold down theSHIFT key and right click in UV Set Editor window and then select Layout UVs. This is the best option in Maya, as it will fit all the UV layouts in the 0-1 space randomly.
Now we have two UVs sets (map1, uvSet1) where map1 is the base UV set for the texture, and the UVs for the lightmaps are laid out randomly in the set of uvSet1. You can rename uvSet1 to Lightmap by hitting the Rename button on the right. It is now time to export this mesh using the Actor X Static mesh exporter.
Select all the Meshes and click on the axmesh command shortcut you created on your shelf, or type axmesh into the Script editor window of MEL. Make sure that your meshes are selected before executing the axmesh command or it'll throw some errors at you.
You'll get an ActorX Static Mesh exporter window just like in the pic above after executing the axmesh command. Check the Selected item only and the Auto triangulate option and then hit Export Mesh. Save the file to your desired location.
This is how we export static meshes in Maya using the ActorX plug-in. Now let's see how to export this same mesh using the FBX exporter plug-in.
Exporting Meshes through FBX plug-in:
The advantage of FBX plug-in is that it's available in later version of Maya. It's a built in plug-in, so you don't have to type or execute any commands in the script editor window. So just select the meshes if you have set all the UVs properly (like we did above for ActorX.) With the meshes selected, just go to the File menu in Maya and then click export selected.
As shown in the image above, just change the File Type to FBX export. Make sure that you've enabled the FBX plugin in maya.
Importing A Static Mesh into UDK
In UDK, go to the Content Browser and create a new package, for example: Foliage and import all the textures for the foliage (just like I have done in the image above.) Let's setup the material for our foliage mesh.
I've setup my textures and material as shown above. So now let's import the static mesh.
Well, we have exported the same static mesh from Maya in two different formats (.ASE & FBX), Let's import the FBX version first.
Importing in FBX format
Now right click in the content browser inside the same Foliage pack, Click on Import and import the static mesh in FBX Format.
After importing the FBX file, you'll get an import window as shown in the above image. If your mesh is not combined into a single mesh and you want your meshes to be merged into single mesh, then scroll down a bit to the Static Mesh section and Enable/Check the Combine Mesh option.
With this option you can combine multiple meshes into a single mesh or else UDK will import each and every mesh as a separate static mesh. Mostly it is used for importing various/different parts of Character meshes. Once done with the settings, hit OK to import it. That's it, this how we import a static mesh in FBX format into UDK.
Importing ActorX (.ASE) format
For importing static meshes in ActorX format (.ASE), you simply just have to Import and press OK because there's no options or settings to change. It will import as a single mesh, no matter whether you mesh is combined or separated.
That's it, Thank you for reading.
- Quick Tip: Optimizing Textures In Unreal Development Kit
- A Comprehensive Beginners Guide to UDK
- SpeedTree To UDK: The Complete Workflow
- UDK: Creating Events With Unreal Kismet