Early during the development of my XNA game engine I started using a custom model processor which is integrated heavily into the deferred renderer and uses obj files as it's input.
Over the past few months I've been getting in the completed models from the 3D artists working on our projects and more recently I've been optimizing them and getting them all into the proper format for the game. We have a few artists creating cars in particular and they're all using different modelling packages and have created their models to slightly different scales.
I decided upon the ideal scale for our engine some time ago and wanted to rescale all the models to the correct size within game and also to rescale them so their center points were in the correct location. So, I thought rather than making a C# tool I'd make a simple little web script to do it (since I am a PHP developer by day).
The screenshots below show the tool in it's current incarnation:
Using the tool I now follow the following procedure to get the cars ready for our engine:
1. Load in the complete model and rescale it to the correct size in game units. Keeping a record of the scale multiplier.
2. Load in a mesh containing only the four wheels, rescale it then translate it so it's XZ center is 0,0 and the bottom of the wheels touch the Y axis as Y=0. Marking down the 3 distances used for translation.
3. Load in a mesh of the car body without wheels, and translate by the same values as used for the wheels.
4. Load in a mesh containing only the front left wheel and translate it so it's center is 0,0,0.
5. Download the body and wheel meshes from the tool for import into the game.
Long winded, but the models are then perfect for importing into our engine. By centering around the mesh containing only the wheels that effectively becomes the point around which the car turns (rather than the center point of the entire mesh).
I've put this in the web section since it's all written in PHP with GD for the previews. It could even render a 3D wireframe view which wouldn't be that hard but wasn't needed for the tool. I doubt anyone else could make use of this but might post the source in a future update.
I know this is probably easier done in the modelling packages themselves but I'm a noob with Maya and Max and for me, this was the quickest way to get the models how I needed them!
If you found this post helpful please leave a comment below: