Overview
If you are creating a game using the Unity (or another) game engine, you will likely be using a 3D authoring tool like Maya to produce your game assets. As such, you will need to export out of Maya and into your game engine of choice. This article will go over the process from Maya into Unity or Unreal Engine.
Setting Maya's Working Units
- Make sure you have set your active project directory, and generated the project's internal file structure.
- Go to Window > Settings/Preferences > Preferences.
- In the Preferences window, on the left section view, click on the header: Settings. Under Working Units, look at Linear and set it from centimeter to meter.
Quickly creating a Crate asset
- In this example, I will make a simple crate asset. I already have a color texture and normal map that have been added to the current Maya project directory under sourceimages/crate. Create a cube primitive after setting the project's Working Units.
- Assign a new material, I'm using a Standard Surface. If you are creating an asset for an Unreal Engine project, use Blinn instead.
- Editing the material node in the Attribute Editor, click on the checkerboard icon to add a node next to the Color attribute. We'll be using File to connect our color texture.
- Navigate to our folder with our color texture, and select it.
- Make sure to enable Textured in your viewport.
- You will see the Cube has its texture applied, albeit not in the way we want. We will now do a bit of fixing with the UV Editor.
- Go to Window > Modeling Editors > UV Editor.
- With your cube selected, you should see your object's topology (layout and flow of vertices, edges, and faces) overlaid on top of the applied color texture. In this case, our unfolded cube over the crate color texture. If you don't see the texture with the object selected, save and restart Maya.
- Right-click, hold, then drag into Edge Mode.
- Select the 5 internal edges of the crate that are not part of the cut edges.
- In the UV Editor, go to Cut/Sew > Cut or press [Shift] + [X].
- The crate's faces should now be cut along our selected edges. Switch to Face mode.
- Select all of the crate's faces.
- In the UV Editor, go to Modify > Stack Shells.
- All of your faces should be stacked in the middle of the UV unit. With them still selected...
- ...go to Modify > Unitize.
- And now all six cube faces should have the crate texture fully applied. Minimize or close out of the UV editor. If you haven't already, go into Object Mode.
- Let's also make sure our crate's normal map applies correctly (which it should given our quick work in the UV editor). With the crate still selected and viewing the material node in the Attribute Editor, scroll down to the Geometry dropdown. Add a node for the Bump Mapping field.
- Again, select File.
- Now, for the bump2D node, set Use As from Bump to Tangent Space Normals.
- Click on the file2 node tab. Under File Attributes, click on the folder icon next to Image Name.
- Navigate to where your textures are, and select the normal map.
- Great, now we should see some subtle detail work/bumping along the crate's wooden grains. For our purposes, we will be bringing over this example asset, and re-applying its material/textures in Unity and/or Unreal.
Exporting into Unity
- With the crate selected, go up to File > Send to Unity > Selection.
-
You will be prompted to set your Unity directory. Navigate to your Unity project folder, then open/set it. Afterwards, you will be prompted to choose where in the Unity project do you want your asset to be saved. In this case, I have made a new folder Imported > Crate. With that location open, turn your attention to the right sidebar showing your export options.
- Under the Embed Media dropdown, enable Embed Media. This will not bring over our textures, as those we will need to import manually into Unity.
- Name your file, and make sure the type is set to FBX export. Now switch over into your corresponding Unity project.
- You will see the exported FBX with the mesh and material; however, unfortunately the material does not include our textures. Let's make a new folder (aptly called Textures) into which we will bring those back in.
- First, let's extract the material. Right-click on the crate material (crate_MAT) and Extract from Prefab.
- Select the location in your project where you would like your material to be saved/extracted to.
- Open that asset folder, find your textures in your Maya directory, then click and drag them in.
- You should now see your textures added to the Unity project.
- Go back up a directory, and drag your cube asset into your scene.
- Now, in your asset browser, select your material. In the Inspector (right side), look at the top right for a padlock symbol. It will be unlocked. Click to toggle/lock it. This will allow you to navigate/click on other objects without losing the currently selected object's properties/attributes.
- Navigate to where your textures are. In the inspector, note where the Albedo field is for your selected material, under Main Maps. Notice the collection of square slots next to each field. This is a quick means for dragging in your texture maps. Click drag your crate's color texture into the slot for the materials Albedo.
- In the Scene viewport, you should now see your crate has its color texture applied.
- Similarly, click and drag your crate normal map into the Normal Map slot of your selected material. Save [Ctrl] + [S].
- You may get a prompt regarding your normal map image not being set/imported as a normal despite being used as one for the material. Click on Fix now.
- And now, we have our crate brought from Maya into Unity with both its textures re-applied. This process may vary based on a number of factors, but will generally follow these steps and some of these considerations.
Exporting into Unreal Engine
Preparing in Maya
- If needed, convert our object's material to Blinn for easier exporting/importing into Unreal Engine.
- Select the object, go to its material. Click the dropdown in the top center of the Attribute Editor bearing the name of the currently set material. Scroll, find, and select Blinn.
- Select the object, go to its material. Click the dropdown in the top center of the Attribute Editor bearing the name of the currently set material. Scroll, find, and select Blinn.
- In Maya, relink the color texture (and any other maps). Adjust your material's attributes as needed.
- Save.
- Select your object in Maya. Go to File > Send to Unreal > Selection.
- Choose the Unreal project directory. Select.
- Choose the destination for the FBX file (Import folder, by default). In the right bar with the export settings, make sure to enable Embed Media. Click Export Selection.
- Go to your Unreal Engine project. In the Content Drawer: make a new folder for Imported assets. Inside there, create a folder for your asset (Crate, in this example). Click on Import on the Content Drawer.
- Find the Import folder, it is in the directory above the Contents folder. Go into that folder, select the Crate FBX file. Select and Open.
- You will see a new import option prompt open up. Make sure to toggle/enable Convert Scene Unit. Import all.
- Your crate's static mesh, its material, and its texture(s) should all be in the current directory. Save all [Ctrl] + [Shift] + [S]. (When switching your material in Maya, make sure to rename it to avoid it being named as a generic blinn1. That said, you can rename the Unreal Engine Material accordingly).
- Click and drag the static mesh into the scene. Congratulations, you have imported your asset into your Unreal Engine project!
Further Resources
- Maya 2023 Help: