Importing Models

Due to the fact that you are not going to be able to create the assets that you need for your game, you will may need to go beyond what is available in UDK for your art assets. This section of the notes will go over the following:

  • a few useful places to find models
  • what to look for when looking for models for your game
  • minor fixes you may need to perform on your model and how to do them.

where to find art

Here are a few places where you can start your search for your models:

  • opengameart.org
  • turbosquid.com

What to look for in your game art

Good art does not mean it is good art for game. Aside from aesthetics, there are real technical limitations on models that you can use for games that are different than those that you can use for still images or films. The reason for this is that game art has to be rendered in real time. Thus art has to look good without using a lot of resources.

If you take a look at the models inside UDK you can see their triangle counts.You will notice that for most art assets (things that decorate the world) the number of triangles is limited to between 500 and 1000 triangles. Some assets are bigger (there is a human statue that is around 4500 triangles). However in modelling terms this is not a lot. It is also unlikely that there will be many instances of this human statue in a level so one art asset with 4500 triangles is not that bad.

Art that is found on sites like turbosquid are not necessarily used for games. they may look awesome but they aren't meant for games. Generally speaking, you're probably safe for any art assets below 2k triangles. When looking for art, if the triangle count gets over 2k, ask if you really need it and how often it will be used. If the art asset is over 10K, it must be something that is absolutely necessary for your level. anything that goes much higher than that... you need to look for an alternate

Fixing Art Assets

When you get art assets sometimes there are things in it that you may not need. For example, the modeller may have placed a floor underneath the model so that the model looks like it is sitting on a floor when it was rendered. Since your floor will be your game world you will want to remove that. You can fix a model using a 3D content creation tool. There are several such tools available. For example 3DS Max, Maya or Blender. The instructions on dealing with export below are for 3DS Max, which is also available in the lab computers.

Scale your model

16 units is 1 foot. Before you export your model you should size it so that it looks appropriate in your world. You can do this by creating a box that is 6 feet tall and 1.5 feet wide (96 X 24). this is the approximate height of an Unreal character. Using it as a guide do a uniform scale of your object so that it is appropriate

Export

You can export a model as an Ascii Scene Export (ASE) from max. Unreal understands this format and will load it.

You can also export using FBX which is a format defined by autodesk.

Importing Into Unreal</span></h2>

Once you import your mesh and texture into Unreal, you will be able to see the package in the package list of your content browser (if not you can navigate to it anyways).

Importing the Mesh

To import a static mesh, in your content browser click the import button (located under the package list), navigate to your ase or fbx file to import it. For package name choose something OTHER THAN MyPackage or the same name as your map!.
Group name should be something like meshes. The name of your mesh cannot have any spaces in it. If your original ase/fbx file had spaces in the name, you will need to edit this to ensure it aligns with unreal naming conventions.

Importing the texture

To use a texture on a model you must create a material with it. To do this, start by importing the texture into your package.

In the content browser:

  • hit the import button
  • choose your texture. NOTE: not all image formats are supported. You may need to convert your image to a supported form (bmp, tga, dtx, etc) which can be done using programs like photoshop or gimp.
  • Enter your package, group and texture name into each of the fields in the popup box. NOTE: the image name cannot have a space in it.

Once your texture is imported, you can make a new material by doing the following:

  • Click on your texture so that it is selected
  • right click in the grey area of your texture browser (the pane where the samples show up but just in an occupied spot).
  • from the context menu choose new material.

  • this will once again bring up the new package item dialog box. Fill in package name as being same as what you were using for your mesh, group should be material, and name is whatever best describes your material

If you did everything correctly you should be able to see something like the following:

clicking on a blank area in the middle panel (where it looks like there are little spheres) choose New TextureSample from the context menu. As long as you had your texture selected, you will see it show up in a little box in that area.

If you did not have it selected, the sample shown will look black. However you can apply your texture by selecting it in the content browser window, then going back to the material editor, right clicking on the texture box and choose "use current texture" from the context menu.

Once you have the texture sample loaded into the material editor, connect the diffuse dot with the top dot black dot in the texture sample. You should now see a sphere with your texture applied.

Click the close box and it will ask if you want to save it.
Choose yes and your new material is now part of your package. This however doesn't save your package, choose file save from the content browser window in order to save the package itself. Remember to name your package something different than your map!

Applying the texture to your mesh

In the content browser window double click on the mesh you wish to apply the texture to. This will bring up the static mesh editor dialog box.

Collisions

When you bring in your mesh for unreal it will typically not have any collision on it. That is, you can run right through it like its not there. Depending on the usage of the mesh this might not be an issue.
However, if you need your mesh to be more solid you will have to add collision to the box.

There are two ways that you can do this. You can either create a custom collision mesh in 3DS max and bring that into unreal or you can use the tools supplied by unreal to make this mesh. It is easier to do it in unreal but less exact. Depending on the situation, it may be worth your while to create a custom collision mesh.

Creating a Collision Mesh Inside Unreal

Firstly in order to see what the collision mesh looks like you need to click on the show collision button. Do this before applying collisions so that you can see what it looks like:

For simple meshes where a simple bounding box will do, You only need to choose 6DOP - simplified collision from the collision menu. However, that may not always work. For example, suppose you have the archway as shown in the image above. If you use a simple bounding box, you will not be able to run through it.

In general any convex shape (think of i as shapes without "dents") can be handled with a simple bounding box. (one of the 6DOP or 10Dop selections will work). However, for shapes that are concave (such as this arch) you will need to something more complex. To do this choose auto convex from the collision menu and it will bring up a dialog box. Adjust the sliders as low as possible while maintaining the mesh in a way that is satisfactory for what you want. You can adjust and apply the sliders as you go to see how the collision mesh looks.

Custom Collision

Depending on the shape of your object, you may wish to create a custom collision box for it. While autoconvex will do a alot for collisions, it may not be enough to handle what you need. If that is case, a custom collision box is the way to go. To create a custom collision mesh you will need to add a mesh in 3DS Max to your model and export that again along with your original model.

Suppose you have made the house as shown below and you wish to add a custom collision model to it.

The easiest way to do this is to create a number of simple primitive geometry and place them where you wish for collision to be detected.
For this house, you can create a box for the floor, a triangular prism for the roof and 5 boxes for the walls (3 for the side and back and two separate ones for the front. Each of these objects needs to be named with the following conventions:

  • For unaltered boxes prefix the item with UBX_
  • For unaltered spheres prefix the item with USX_
  • For custom convex objects prefix the item with UCX

Unaltered boxes and spheres means that they cannot have altered it beyond the basic settings used to build the primitives.

Custom primitives must not be concave (ie no indents).

Below shows the same house with a custom collision box on the floor and the naming convention for that box.

Once you have completed creating the custom collision boxes select all the objects (model + all collision boxes and export as usual. When you bring it into unreal, your object will have a custom collision box.

Below is the house with a custom collision box inside the unreal static mesh editor window. You can see that there is a pink box around the floor. This box is the box that was created in max with the special naming convention. NOTE: this collision box is incomplete. the house has no walls or roof.