Learning Unreal Engine 3 – UE3 Editor

Importing Meshes

If you’re a 3D artist, this section is for you.  It talks all about how to get a mesh you’ve created out of Maya or Max (or any other program, really) and into Unreal.  Please read Working With Packages if you haven’t already - it covers the basics of importing any asset type.


The process for exporting is basically the same for both Max and Maya, so I’ll cover both of them in this document.  I’ll assume you’re familiar with the workings of your 3D program, so I won’t go into too much detail on either.

1) Setting up the exporter

The format you’ll use to get your meshes into Unreal is “.ASE”.  Max comes default with an ASE exporter, but you’ll need to install a plugin if you want to export from Maya.


The exporter for Maya is called ActorX.  You can download it from Epic’s web site here.  You may also need to download the DLL file listed on the site, msvcr71.zip. 


Copy the plugin and DLL into your Maya plugins folder.  Launch Maya, open the Plugin Manager, and “loaded” and “auto-load” for the ActorX plugin.


To open the exporter, enter the command “axmesh” in the script window.  (You’ll probably want to make a shelf icon for this.)

2) Create a mesh and export it

Let’s start by creating a simple sphere.  Just create it at the origin, and make it fairly large.  (We’ll worry more about scale later.) 



To avoid warnings, you need to make sure your object has a material assigned, and that the material has a texture plugged in to the diffuse slot.  Do that now.


Select the sphere.  Go to File->Export Selected, and for “Save As Type”, select “.ASE”.  Enter “sphere.ase” for the filename, and save it somewhere easy to get at, like your desktop.


In the ASCII Export dialog, check the following settings and hit OK.



Run the exporter tool (use your shelf button, or just type “axmesh” in the script panel.)


In the Static Mesh Exporter dialog, check the following settings and hit Export Mesh.

Enter “sphere.ase” for the filename, and save it somewhere easy to get at, like your desktop.

3) Import the mesh

Switch back to Unreal.  Open the Generic Browser and go to File->Import.  Browse to your exported file (sphere.ase), select it, and hit Open.


You’ll see the Import dialog.  The “Name” should be already filled in (based on the filename.)  But you’ll need to choose a package to put the sphere into.  Either create a new package, or type the name of an existing one.  Hit OK to import your mesh.


Select your package in the Generic Browser list, and it should have your sphere listed inside of it.  Save your package, and the sphere is ready for use!

4) Place your mesh in the level

That might have seemed like a lot of work, but once you’re all set up, bringing in a new mesh is really easy.  For now though, it’s time for some payoff.  Let’s place the sphere in our level. 


Open up the test level you’ve been working on (or create a new level) and save it as a new filename.


As we did in the second tutorial, select the mesh in the generic browser, switch back to your main editor window, hold the “s” key, and click on the ground.


If you’re like me, the sphere is pretty small, and it’s half way sinking through the ground.  Still, pretty cool!  You can rebuild lighting, run the level, and run around your sphere.


So let’s fix the sphere’s scale and its pivot point.  Switch back to your 3D program (Max or Maya.) 


By default, one unit in Max or Maya is 1 unit in Unreal.  (And the player is roughly 88 units tall.)  So use that as a guide and make the sphere about as big as the player.  (Make the radius 44, while will give us a diameter of 88.) 


The pivot point of your object, when you export it, is simply the origin of the world.  So move the sphere up so that the very bottom is sitting at the origin.  It should look something like this.


Re-export over your old ASE file, and re-import into the same package.  Move the camera around in the game world and you’ll see the sphere update.  It may seem a little on the small side, but if you run your level and run into the sphere, you’ll see that it comes just over the top of your head.


Save your map, and we’ll move on to some even cooler stuff.


One final note about Maya – if you’re working with larger assets (the size of buildings) you may need to open up the Camera Attribute Editor and modify you clip planes.  Make the far clip plane something large (100,000), but also increase the near clip plane (to 0.5 or 1) or you’ll encounter artifacts.

5) Add a material to your mesh

Let’s replace the checkerboard texture with a real material.  We’re going to be hopping back and forth between packages in the Generic Browser, so you may lose track of your sphere mesh, but remember you can always find the package alphabetically, or right-click on the sphere in the scene and select “Sync Generic Browser”.


Double-click on the sphere object in the Generic Browser.  This opens up the Static Mesh Editor, where you can set all kinds of properties, including what material is assigned to the object.  Try zooming and rotating around the sphere using the left and right mouse buttons.


The material is kind of buried.  It’s under LODInfo->0->Elements->0.  Open that up now.


To plug in a material, we’re going to need to find one in the Generic Browser.  So move this window off to the side (Don’t close it!).  Find a package with a good-looking material in it, and select the material.  (Try HU_Floor2.) 


Now switch back to your Static Mesh Editor window.  Click on the little green arrow to the right of the Material field.  The material you selected will be applied to the object.  If it doesn’t work, you may have accidentally unselected the material, or selected something different (like a texture, or like your sphere mesh!) 


Your sphere should now show up textured in the level.  Save your package and test it out!


One other useful thing – if you press the eyeball icon at the top of the Static Mesh Editor window, that will set the thumbnail angle in the generic browser to match the current view of the object in the Static Mesh Editor.  It’s not that big of a deal with a sphere, but for other object types this can be very important.

6) Generate collision geo for your mesh

If you’ve been testing like I told you, you’ve probably noticed that you can run right through your mesh.  That’s no good!  We want it to block our progress – in other words, we want to collide with it.


Unreal treats rendering and collision completely separately – and with good reason!  We want the player experience to be smooth, with no snags on small extruding bits of polygons.  Not to mention it’s better for performance.  When you shoot at an object it uses the visible mesh to detect if you hit it, but for the player, we need simple collision geo.  Right now there’s no collision geometry for our sphere, which is why we can walk through it.  Let’s fix that.


We can create custom collision geo in Max/Maya (and we’ll do that in a minute), but for something simple like a sphere we can let Unreal generate collision geo for us.  Make sure your Static Mesh Editor is open, then click on Collision->6DOP simplified collision. 


Now click on the “Show Collision” button, and zoom out from your sphere a little.  You’ll see a green box around it – that’s your collision geo! 


Save your package and run the level.  You can’t pass through the sphere anymore.  And if you try, you can probably tell that you’re colliding with a box, though during normal gameplay you’d probably never notice.


Try some of the other options for generating collision geometry.  Sphere collision seems like an obvious choice, but I just tried it and it doesn’t seem to work.  Bummer.  You can get a much closer fit with 26DOP Simplified Collision or Auto Convex Collision, but 10DOP-Z is probably the best balance of detail and performance – it creates a rough cylinder shape around your sphere.  Try it out, and you’ll see that you really don’t need more detail than that.

7) Add custom collision geo to your mesh

You can build your own collision geo (in Max or Maya) from any type of polygon object that you want.  Starting as a box is most common, but you could do a cylinder or sphere if you need to.  You can also piece together a couple objects to form your collision geo – if it’s a big irregular shape like an archway, you might have 3 boxes that roughly cover the shape of the geo. 


The main thing to understand about authoring your own collision geo is that it needs to be made from convex meshes.  It’s simple to understand in 2D – just avoid indentations!



It’s a little harder to visualize in 3D, since the triangulation of your mesh starts to matter.  But don’t sweat it too much – just make sure you always view your collision in Unreal after you import your mesh.  If it looks like it got split up, then it wasn’t all convex, and you may need to fix it.


So here are my five rules for building collision geo.

1) No concave surfaces!

2) Keep it simple!  Every polygon and every additional primitive hurts performance.  (And as we saw with the sphere, it doesn’t need to be an exact match.)

3) Try for a snug fit.  The collision can poke out a little, and it can fit inside the mesh in others, it just needs to “feel” good when you run around it.

4) Only build what the player will notice.  If it’s a teapot, a simple box will do.  If it’s a statue, maybe a lopsided cylinder. 


So let’s build a collision box around our sphere.  Go back to your 3D program and… well, make a box around your sphere.


So how does Unreal know the difference between collision geo and renderable geo?  It’s all in the naming conventions.  Edit the name of your collision box so that it has “_MCDCX” at the end.  (Yes, it needs to be all capital letters.)


Select both the box and sphere, export, and re-import into Unreal.  On import you’ll notice a new dialog asking if you want to overwrite the existing collision geo.  You do!  (If this message doesn’t pop up, you may have done something wrong, like misnaming the collision or not selecting it for export.)


Open up the static mesh editor, turn on collision, and you should see your box.  Save your package and test it out.  All set!


Oh, and for demonstration purposes, here’s what happens if you have concave geo.  I grabbed one of the verts and pulled it up.  You can see that it has an indentation now, and that it sliced the extruding part into a separate collision mesh.  (And it says “Num Primitives: 2” – another good tip!)


One last thing – if you need to use multiple collision primitives to cover your mesh, just name them all with “_MCDCX” at the end and make sure they’re selected when you export.  They should come into Unreal properly.

8) Other pitfalls to watch out for, and useful tips, when creating your own static meshes

Polygon Count – As with any game engine, we’re concerned with the number of triangles a mesh has, not polygons.  Take a look at an Unreal scene to get a sense for the triangle counts they used.  Lots of meshes are in the range of 400-1000, though special case stuff (like statues) can be upwards of 6000.  Small stuff that repeats a lot tends to be more like 100-400.  Remember that polygons slow down performance AND eat up memory, which makes your map slower to load, and may actually prevent it from loading on PS3.  The maximum triangle limit is around 30,000 triangles. 


Multiple Materials – You can apply multiple materials to your mesh, but try to keep the number as low as possible.  From a performance standpoint, every new material you add effectively counts as an extra mesh. For a one-off special object, it’s not a big deal, but be careful with meshes that will be repeated many times around the scene.  (In Maya, just apply materials to the mesh’s faces as you would normally. In Max, create a multi-sub material, and set the number of sub-materials as low as possible.)


Surface NormalsYou need to pay careful attention to the direction your surface normals are facing.  Be sure to look at your mesh with backface culling on (or some other similar trick) to make sure polygon normals are facing the proper direction.


2-Sided Faces – This is closely related to the previous point.  Most Unreal materials support only one-sided faces.  (In other words, backfaces are transparent.)  You CAN make a material two-sided, but the backfaces generally won’t accept lighting properly.  In most cases, you’re better off duplicating your geometry and flipping the normals.


Hard/Soft Edges or Smoothing Groups – (Max vs Maya terminology) – Unreal will use the smoothing groups or hard/soft edges you set.  So set it!  It makes a big difference in the look.


UVsUnreal supports UVs just like you’d expect.  You can also create a second UV set and use it to generate lightmaps (but we’ll discuss that more in a later tutorial.)


Vertex Colors – Unreal supports vertex coloration, but you need to author a special material to use it.  By default, most materials ignore it.


Setting the Grid – It’s useful to set your grid and camera properly inside Maya or Max.  Set the grid spacing to a power of two (like 32 or 64), and the subdivisions also to a power of two (like 4.)  This way, you can make sure all of your objects will line up properly when you get them into Unreal.


Setting the Camera – Particularly in Maya, you may need to set the Far Clip Plane to a larger number than default.  (say, 100,000 units.)  But if you do that you’ll lose precision, and you’ll notice flickering.  To fix it, also increase your Near Clip Plane (say, to 0.1 or 0.5.) 


Creating a Reference Mesh – Sometimes it’s hard to judge scale of environment props just by measuring them.  In lots of cases, the best way to figure out scale is to create a box mesh that roughly fits the shape and size of the character – this makes it a lot easier to eyeball the size.  A typical UT3 character is 88 units tall, so make a box with that height, and proportions that look good.  (88x20x35 looks pretty good, for instance.)  You can then move the box around your Maya or Max scene to help judge height.


Next: Importing Textures

Back to the Topic Index


other tutorials