Classic Battlefield Modding Wikia

Exporting the AImesh in 3dsmax

by Dnamro

Creating AImeshes with 3dsmax Complete Tutorial

This tutorial is step by step guide to creating AImeshes. This tutorial starts after you have imported the standard mesh and collision meshes for the object your working with into 3dsmax. I will use a simple house with no internal access as an example. You will need a basic understanding of how to get around in 3dsmax. There is a basic navigating in 3dsmax tutorial that comes with the program. Start with those, then come back to this tutorial. This tutorial uses 3dsmax ver 9. Yes, max9 - not 2009, but good old 9. That is because that was the last version that there are conversion tools available. 




MedievalHouse_02 collison mesh file:

Let's get started. First, import the collision mesh and the standard mesh. We will be using the Medeivalhouse_02 for this tutorial. Download the file above and extract it to somewhere that it's easy to browse to, such as your desktop. See the tutorial in the link below for importing, then come back here.

Import collison mesh tutorial: [Collision Mesh Tutorial Link goes here]

First of all, it's important to understand that not every object needs to have a collision mesh. The navmesh generator will navmesh around the area using a rectangular bounding box that matches the outlines of the object. This bounding box extends about 1 meter around any object extensions. This house may work perfectly fine without an AImesh. But if it's close to other buidlings and you want the bots to be able to use the alley between the objects, you may need to give it an AImesh. Some objects may allready have an AImesh that just needs to be fixed up. If not, they use one of the other collision meshes. In this example we will make a clone of the collision 2 mesh.

Here is the house imported:

Slide0001 image004.gif

Select F4 to display the face edges. This will be helpful for editing. 

Slide0002 image002.gif

The lower right viewport selected. This is the best one for moving around and editing. 

Slide0003 image006.gif

Now we want to only look at the collision meshes, so right click on the object and select 'hide selection'. The viewport should be blank. Repeat this step until everything in the viewport is hidden.

Slide0004 image008.gif

Then right click on the viewport and select 'unhide by name'

Slide0005 image010.gif

Select the collision 2 mesh (col2) as shown. 

Note: The collision 2 is usually the less detailed of the collision meshes and therefore easier to work with to create the collision 3. 

Slide0006 image012.gif

We will make a copy of the col2 to use to make the collision 3 (col3). On the main menu, select Edit >> Clone

Note: With Navmeshes, the simpler, the better. Collision 3 meshes that are too complex will be ignored by the navmesh generator. The problem is that the complexity limit is not defined, so it can be a matter of continually simplifying and testing the collison 3 mesh until it works.

Slide0007 image014.gif

Make sure you select copy instead of instance and change col03 to col3. 

Note: The default is instance. If you forget, the copy will be offset the navmesh won't line up properly when you use it.

Slide0008 image016.gif

Next right click on the object in the viewport and select hide selection. This should hide your collision 2, so only your collision 3 is displayed. The right hand menu shows the name of the object selected. If it's not the right one, then right click and hide it and then unhide the col3.

Once you have the col3 displayed, you're ready to edit the mesh. One thing you will need to know how to use is the rotation tool. When selected you see the rotation ring as shown below. 

Slide0009 image018.gif

The rotation tool is at the bottom right corner of the 3dsmax window. It's highlighted above and blown up below.

Slide0010 image019.gif

To get into edit mode, right click on the mesh and select Convert to >> Convert to Editable Mesh as show below

Convert Edit Mesh.jpg

Next we want to clean up the mesh and remove any parts that are not needed. 

Now, in this case we want to only keep the main object and delete anything that isn't joined to it. We could select the main mesh, and then from the main edit menu, select inverse and press the delete key. This is the same method used in navmesh editing to delete all the island meshes.

But, we don't always want to do this. Usually there are parts that need to be joined to the main mesh, so we would only delete the pieces that we don't want and keep the pieces that we need to work with. How do you know what to keep and what to get rid of? Anything that you want the bots to use or avoid, need to be kept and integrated into the main mesh. That will be part of another tutorial. For this tutuorial, there are just two parts and both need to be deleted.

Use the polygon selection tool to select parts of the mesh that are not joined to the main mesh. It's selected below and blown up in the next picture. Select the chimney. It turns a darker color showing that it's not attached to the main mesh. Bots will never walk across this roof, so the chimney is not needed. Press the delete key to remove it.

Slide0011 image021.gif

Polygon editing tool is displayed below.

Slide0012 image022.gif

The chimney is selected below

Slide0013 image024.gif

... And after the chimney is deleted

Slide0014 image026.gif

Next select the porch. The porch is small and not big enough for the bots to get stuck walking into, since the bots try to jump over anything that they run into. It's not worth the effort to add it to join it to the main object, so ...

Slide0015 image028.gif

delete it

Slide0016 image030.gif

Next rotate the object around and inspect it. When you turn it upside down, you will notice that there is no bottom, so you will need to create one. Select the face mode as in the right toolbar.

Slide0018 image032.gif

Select a bottom corner and then select the other two corners for the face, selecting in a counter- clockwise direction to create a face that looks outword. Faces need to look/face in the same direction.

Slide0019 image034.gif

Create a face for the other side of the bottom of the house.

Slide0020 image036.gif

Now that the object is cleaned up and enclosed, editing is finished.

Slide0021 image038.gif

Now, that your finsihed editing, it's time to check the navmesh. Turn it around in the editor and take a good look from all sides, top and bottom and fix anything that you screwed up. This is a really simple AImesh, so there won't be anything wrong. However, for more complex objects there are some other steps to check the AImesh before exporting. This will involve an STL Check, remvoing any extra vertices and checking for any bad edges. Those are explained in detail in the checking the AImesh tutorial here:

(In Progress -place holder for link to checking the Aimesh tutorial)

The last step will be to set up the hierarchy/schematic before exporting the collision mesh. This will be explained here:

Then when your ready to export the AImesh:

At last your ready to get that AImesh into the editor and navmesh. (That is the next tutorial that I plan to work on).