I'm a professional game developer from Wakefield, England, working as a senior programmer for Rebellion North.
I'm a married father of five and I a also sometimes do Retroburn stuff.
Martin 'Bytrix' Caine
Father. C++ Games Programmer. Cyclist. Guitarist.
emailfacebooktwittermessengersteamxboxliveretroburn
Tags
2013 3d alphalabs amazon apple archivirtual asynchronous battlefield bad company 2 ben 10 bepu beta blackmagic design blog blue marble bootcamp borderlands bsp calibration charity charvel childsplay comments competition content tracker counter-strike crash csgo css3 cycling dear esther deferred deus ex develop conference direct x discipline documentation doom 3 bfg dpi dr bott eidos elite force email deliverability eurogamer expo facebook focus fresnel game development game horizon game republic gamedev games gaming geoip girls make games global offensive grid guitar half-life 2 hawken hd7 hobbyist htc humble indie bundle imac indie indie trials indietrials intensity pro ip-countryside iron man 3 jamulus rift jquery kids kinect launch conference left 4 dead live lost mac mac osx manchester manhacks mass effect 2 matrox maya minecraft mirrors edge montreal morrowind movies museum of the microstar music mxo2 mini mysql nausea network networking nokia normal mapping obj oculus rift omnitrix ouya pedal for pounds php physics playstation suite port25 portal portal 2 positron posters powermta project aedra project euler promotion properties proton pulse ps vita ps4 psn racer reddit rendering retroburn game studios reviews rift racer riftracer roadkill roller coaster sdl2 shadow racers sharks shoct skyrifters snds space cadet spam trap star trek steam stencyl storage super stock sd1 fr superhot team fortress 2 tesselating tesselation texture editor thunderbird thunderclap ticktock games tiga track builder track bulder trials tv twitter uk ultimatrix usergroup vequencer video vireio visual assist visual studio vorpx voucher vr vr cinema war thunder warren web willow windows 8 windows 8.1 windows phone 7 workbench wp7 wp7dev xbla xblig xblig network xbox xbox live indie games xna xnaukug xperia play zombies on the holodeck
Archive
Links
Web
XNA
Games
Email Deliverability
Friday, May 21st 2010 / Web

obj scaling, translating and rotating tool

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:

A car based on the Ferrari F430 A car based on the Lotus Elise

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:
 
Comments
Tags:   obj   php   web
0