Join Adam Crespi for an in-depth discussion in this video Understanding the export pipeline and export formats, part of Animating for Unity 3D in 3ds Max.
Getting animations from a 3D package over to a game engine has historically been a bit of a mess. I've got a door here in this scene. And we can see that the door by hitting G to turn on the grid is at 0, 0. It's down on the floor and as centered as it can be. I've named all of the objects because name spaces do come across. Here's door frame 01, door 01 and doorknob 01. It's a separate object because it's slightly egg shaped so we want to see it turn. These objects all have materials on them and pressing M to pull up the Slate Material Editor will show us what's going on.
There's a chrome standard and this one is on the doorknob and backplate. There's a blue for the door frame and a light blue on the door. All of these are standard materials, double clicking on them shows us their parameters. I'll pull up this name bar and we can see that they're just standard blend shaders. I haven't really tweaked anything in here besides the color. And this is because what comes across is really just the name of the material, the placement either by object or by polygon, and the diffused color and diffused map.
These objects have their pivots really wherever they are created. The pivot for the door is at the pivot of the original box but it's been modified to, well, bend out slightly. The pivot of the door frame is somewhere close to in the middle and the knob reflects its modification using symmetry. For export, then, we'll use FBX. We want to make sure we export only what we want. And often collapsing the stack to an editable poly is part of this. I've done it for these objects. And we need to make sure we're getting the right pieces across into Unity.
I'll click on the Max icon, and choose Export and holder disc fbx. This is going to go out in my default projects folder unless I set it to go somewhere else. I'll put this into the 0101 folder in the exercise files. Here in 0101 I'll export this as door and click Save. In the export format the preset is for media and entertainment. If we look in Geometry we have options as to what comes across.
This door has smoothing groups on the frame to keep it round looking against the hard edges. So I'll check Smoothing groups. Under Animation, it's checked by default. And in Extra Options, we have options here to bake any animation in it. And also to look at deformations and our curve filters. It's important to note here that skins and bones come across but morphs or morph targets do not and so we need to have bone driven or whole object animation. It won't take in vertex animation on an object.
Farther down, we can see we can take across, to some formats, cameras and lights, but those won't travel to our game engine. In Advanced Options, we can open up the units. And in units, uncheck Automatic, and convert to meters. Unity's units are meters. So we cam model 'em whatever we'd like. Exporting out in meters lets us set the scale of the imported object at one, so it's the right size in our scene. And we'll display things like ambient inclusion and physics correctly.
I'll click OK and my door is exported.
- Setting pivot points
- Using standard naming conventions
- Setting the root node
- Position object for export
- Exporting the animation
- Testing the animation in Unity
- Setting states and transitions in Mecanim