7 Mar 2009

How to export a model from 3ds Max and import it into Unreal 3.

Tools Needed:

3ds Max or Maya (This tutorial is Max based)

Unreal 3 Engine

Photoshop

I will assume that you already have a model with textures ready.


To begin with there are a few things that help with Unreal 3 based content to help things run a bit smoother.

- Use the least amount of smoothing groups as you can. Usually I try to get everything down to 1 but when you have a 90 degree angle you usually have to use a second one.

- No overlapping uvs when you create the normal maps, ao, etc. If you have to overlap stuff then move the pieces that overlap out of the grid. (I use chuggnuts uv tools for this)

- Your collision mesh should be as little triangles (polys) as possible and is used for player and vehicle collision. So you are able to eliminate tiny pieces of the model to optimize it as much as possible.

(The collision mesh made in this tutorial is not optimized and was made just for a quick mesh to show naming conventions. I will have a tutorial on creating collision meshes for UE3 later.)

- When in the editor. Save and save often. Sucks to have spent all kinds of time tweaking materials and have it crash on you and lose everything. Notes are good ideas as well.


In max working in layers is the easiest way to keep yourself from going crazy when you have a ton of different objects and pieces of models and keeping your naming conventions up so you aren't trying to figure out what object134 or cylinder43 is and what it does for your model.

Here you can see my layers labeled for my game model and my collision model. Collision models should start with UCX_

layers

Here is what my collison mesh looks like compared to the game mesh.

So to get ready to export the game mesh and collision mesh should both be in the center of the grid with the pivot points at (0,0,0) and in the middle of the mesh. (Though this can be changed for certain things depending on what the object is.)


Select your game model and collision mesh and export selected and choose *.ASE file type and match the settings below.


Ok now your mesh is ready to be imported into Unreal 3.


So lets open the editor now and import our mesh and texture files.

Find the *.ASE file you created earlier and click open to import it.

Name your package.

In the Group area you can create folders within your package and seperate the Textures from Meshes if you want. For this tutorial I'm just going to put everything into one single package.

Hit OK to move on.

Now select your package from the left hand side and you should see your mesh in the window with no textures applied.


Now lets import our texture files so we can create our materials.

We import all of our texture files like we did with our mesh EXCEPT with our normal map we will change the CompressionSettings to TC_NormalMap instead of TC_Default.

After those are all loaded up you should see your mesh and textures all in the window. Now it's time to create our material for our model.

Right click on a blank area inside the same window where your mesh and textures are and select New Material

The package window will pop back up now. Make sure you are creating your material in the same package as where your models and textures are at.

Once this is done the Material Editor will open up and will show a blank gray ball and all the different commands to the right.

Keep this window open but go back to our package and select your diffuse map. (Left click it once)

Now back in the Material Editor click and drag TextureSample from the list of commands on the right into the node area.

Do this for your normal, diffuse, specular, etc...

Now we need to connect them to the correct nodes. We do this by dragging from the black square to the matching node on the list. (ex. diffuse, specular, normal)

Once all these are done you should have something that looks similiar to this.

I will explain what the Constant and Multiply functions do in a later tutorial covering more of the advanced parts of the material editor.

Now lets save the material you created by clicking on the green check mark in the menus above (if you are using roboblitz or a newer version of UE3)


Close out the material editor after thats done and open up your mesh now into the Static Mesh Editor / Viewer window.

Still no materials on it and it is still ugly as sin. So click on the LODInfo tab to the right and it should expand into another drop down menu. Keep expanding those until you come to [0] with a Material tab.

Select your material from the package (GENERIC) window and back in the Static Mesh Editor click on the apply selected material to mesh button. (Highlighted in image below)

Now your mesh should show up in the viewer with the materials applied to it.

Now just save your package now before you shut down the editor by going to File > Save and then save the package as a *.upk file.

We are done for now. I hope that helps you guys and gals get a grip on the basics of the Unreal 3 engine for now.

No comments: