Classic Battlefield Modding Wikia
Advertisement

Exporting the AImesh in 3dsmax

by Dnamro



Understanding AImeshes
When you create a navmesh, the editor exports data for the terrain and all static objects. By default, the data for the static objects are their bounding boxes. This normally doesn't make for very good navmeshes, so there is a possibility to provide better information for these objects. This better information is a form of simplified collision mesh that are called AI meshes. The AI meshes have to be closed, not self intersecting, and non-manifold. The point is, if you want to have a custom object in your map and you don't want it to show up like a big rectangular hole, then you have to create an AI mesh for that object. This is also required if you want the object to be destroyable (like a bridge). The good news is that you can put any amount of detail into your AI mesh and hence it is possible to create navmeshes of the most complex of objects (it is just a matter of time).

The Navmesh rules tutorial provides examples of what is not allowed in AImeshes. The same rules apply:

Navmesh rules

The AI mesh is the COL3 mesh. It should be an accurate model of the volume that makes the object. As stated earlier, it cannot be self intersecting, open, or manifold. You need to build a mesh and export it.

The Aimesh must also be a closed volume. If you filled the mesh with smoke between the polygons of the mesh, there should not be any openings for the smoke to escape. A cube is closed since it has polygons to keep that smoke inside it any way you turn it. A cube missing one side is not closed.

But when you say, "AImesh" you're not talking about the navmesh, you're talking about the collision mesh bounding box around objects that tells the bots that they can't go through that object, and have to navigate around it right? So if we just rebuild or make custom collision meshes on the static objects currently in game (such as the kubraDam wall) then when the navmesh generator goes to make a navmesh over it, it would then have a more detailed collision bounding mesh to get its data from? Or am I WAY off as usual? lol So what's the process? import the static object, build a more detailed col3 mesh around it, get it back in the game and let the navmesh generator do its magic? Or physically join the col3 mesh into the navmesh by hand in 3ds/maya? I'm still hazy on the requirements of such a process.

The AI mesh is a mesh that helps the nav mesh tool to create a more detailed nav mesh. Export it as a col3 mesh. How you chose to build your ai mesh is up to you, but using the soldier collision mesh (COL2) as a base is a good recomendation. With no AI mesh, the Kubra dam would consist of two large boxes, with ai meshes, you can get tunnels and stairs and all kinds of things in there.

All the collisionmeshes for any model, be it a staticobject or genericfirearm or playercontrolobject, are contained within its single .collisionmesh file in objects_client.zip

Sp, an easy way to make the Aimesh is to make a copy of Col2, rename it as Col3, and adjust as necessary. Since Col2 determines player collisions, it makes sense that it would be the appropriate mesh to copy, particularly when dealing with buildings and staircases. You have to build collisionmeshes in 3dsMax, Maya, or Gmax as part of the modeling process.

Remember that most objects - and in particular anything that the mesh tool has problems with - is usually saved as an .obj file in the debug folder tree somewhere. these have the advantage of being already correctly placed in the scene example - the kubra dam_right object kept navmeshing as a bounding box, because it was self-intersecting. You can import this object and use the polygons you want to manually fill in that part of the navmesh

Closed Mesh

.The closed mesh business can be a bit confusing. It can be difficult to wrap you head around how can one make an aimesh for a building, and it not be open? The building has multiple open doors and stairwells. Are these not holes in the aimesh?

Actually, no they are not, if the walls have thickness and the bottoms of them are covered by polygons too. In Max if you select Edge mode then 'Select Open Edges' and the count is 0, then the object is closed. any open edges at all and it is considered open.

AImesh1 LG.png

An extremely simple closed cube 'building' viewed from below with no floor - note that even the parts that would be underground are covered by polygons, so there are no open edges anywhere on it. no open edges = every edge has a polygon on both sides of it.

Now, if we flip this around think about viewing the model from to the top with a floor and no roof, this would be preferred. Since most buildings are not set up for players to walk on the roof, they are not needed. A solid floor provides a flat walkway for the bots and each wall segment does not need to intersect with the ground. However, if the mapper wants the bots to be able to walk through each opening, then the building may need to be sunk into the map enough so that each opening will intersect with the ground.

AImesh flip.png

Now, lets look at a more complicated object that has access to the roof through a stairway.

The stairs becomes a simple ramp and every surface still has two polys per edge. Normally a floor is used, but is removed in this picture just to see the inside of the structure. The bots would be able to move through the doorways and up the ramp to the stairway. The ramp would be too steep to a normal AImesh, but this is just an example to show how buidlings can be closed meshes and still allow the interior to be navmeshed.

AImesh2.PNG

Bridge AImesh Exmaple

The base mesh is in green and the col3 is blue. The col3 is completely closed and follows the contours of the ramp exactly (ie: where a bots feet would go)

AImesh bridge.PNG

Notice that you only have to really worry about where a bots feet (or wheels) will go when navigating the bridge. Rails have no effect on a navmesh, so they are not needed. Bot's won't go past the edge of a navmesh.

Now for a more complicated walkway, all you need is just the path the bots will follow. In this next example, the beams or poles that hold up the walkways are not needed so can be removed from the Aimesh. Now, if the bots where going to be able to walk under the bridge, then you would want to include the poles. However, you don't need the whole pole. You could actually just keep a stump of each pole, just make sure each one is a closed mesh and does not intersect with other meshes. So, yes, you can have multiple separate objects as one collision mesh.

Good Luck with your AImesh!

Aimesh4.PNG


Advertisement