Monday, July 14, 2014

How to convert regular trees to AC

Here is a quick rundown on how I am currently doing the conversion of the trees so it light up properly in game.

First, you will need these 3dsmax script:

gMaterialTool made by Mario Morais
Quick Attach by antomor
Detach by ID by Jeff Lim
Elements to Objects by Garp

Note: If you are already familiar with gmat tool and not aware of quick attach, you might be wondering why I have you download an attach script when gmat can attach selected objects together... quick attach is incredibly faster than both gmat and 3dsmax built in attach window list.

Now, you should import only your trees in a new max file.

Select all your tree objects, containing each multiple trees, and use the quick attach script to attach them all together.  Quadrify the resulting mesh.

Now, use Detach by ID to detach all materials from this merged object.  The reason why I did it this way, you will end up with objects containing all given material for all the track in one object.  This will ease up the work a great deal.  I use the following settings:  Prefix of KSTREE_ and I tick material name, and leave all other defaults.

I recommend that you work extensively with layers too.  Create a new layer for each kind (same mat) of trees and move all individual trees inside, and name the layer after the material name.  This will help you keep track of the many tree objects you will end up with.

So now you got all trees sorted out by mats, hide them all, but one, and here is how you proceed:

Enter element sub object mode, and select all faces.  Use the built in detach with both checkmark ticked to duplicate the faces.  This is needed to have double faces on your mesh so you X or whatever other shapes than Y works right in game.

Now select the move tool, and choose the local axis, and move it either 0.05 or -0.05 on the local z axis, depending on your needs, and then flip the faces.  If all is right, you will see both faces when you turn around the viewport.  If it didnt worked, you will end up with two black faces.  In this case, undo, and use the other value (0.05 vs -0.05).

Now use the Elements to Objects script to detach all elements into separate objects.  I find that gMat tool is highly unoptimized and isn't appropriate for larger tasks.  There are scripts out there that does a better and faster job.  This is an example.  I came up to a large group of trees, and the detach to elements from gMat tool didn't worked out and borked my max file.  I had to load and restart, then I searched for a better script.
And the script auto center the pivot, reset xforms to boot... so you don't have to do this by yourself afterward.


Now comes the trickier part... you knew there had to be one, cause this was real easy so far... :)

You need to use gMat tool with the group attach function (with attach checkmark ticked), and figure the proper radius for your trees.  If your meshes are x shape and rather meet in the middle, you will likely use a tight value.  If they are spread out a little, like in a cross, like some trees I have in Nord, you will need higher values.

gMat tool doesn't undo well.  So be careful.  Always work with small group of trees at first and save often.

The reason is this, the script does the attach one after the other, and if you wanna undo your attach, you need to undo each attach.  As most of your trees will have at least 4 polys... It's not long before you max out default Max undo limit.

So in doubt, and at first, try with a group of 3-4 trees max.  If the trees meet in the middle, try with a value of 1m or so.  If they dont meet, you can guesstimate by using the measure tool by measure the offset of a cross style tree.  Measuring both middle edge and how far they are spread out you will have an idea how much radius you will need.

This is no miracle script and for areas with overlapping trees, you are better to select the faces consisting of a tree and use the attach button in gmat (no need for quick attach in this case, gmat does this quick enough :))

You should now rename all these individual trees to a proper name like KSTREE_GROUP_MATNAME_000 and up.

Now you should have a new layer naned like KSTREE_GROUP_MATNAME, and have tree objects named like KSTREE_GROUP_MATNAME_XXX inside.

The last step is to make sure the pivot is centered.  You can select all trees and center pivot with gmat tool or with 3dsmax however you like.

Then hide this layer, and repeat for all other mats.


2 comments:

  1. I have made a track map for your version of the nordschleife. Pls see my private message in the official AC forum. Cheers :) Love your work

    ReplyDelete
  2. Thank you very much, I have received it and replied!

    Many thanks once again, I'm sure many will appreciate this, myself included!

    ReplyDelete