A drawInfo Tutorial

Recently a few people asked me how drawInfo works, so I thought I'd make a tutorial about how I do it. I use Tedius' DI-Machine and Wings3d to export models to .obj format. Make a new folder where you can put all of the files needed. I'll call mine "drawinfo" and stick it on the desktop.


Open up Wings3d and make your model. I find it easiest to texture everything while in Wings. For this tutorial I'll texture each side of a simple box differently. Save this as testbox.wings into your drawinfo folder and export an .obj version.


Open up your command line and cd into your drawinfo folder. Then type "php di-Machine6.php testbox.obj" and hit enter. Make a file called "testbox.bzw" in your drawinfo folder and paste the output into it. Alternately you can pipe the resulting .bzw code into a file of your choosing.

Change Directory      Run The Script
cd into "drawinfo"                                     Run the PHP script

Terminal Output

At this point you'll need to do some simple hand coding. Make sure all the materials are right and link to the correct texture. Rename the "define object" and "group object" lines to a more specific name. Uncomment "angvel" if you want your object to spin. Make sure you delete the "extents" and "sphere" lines or else your object may randomly disappear if you use "angvel." In the group, shift the object down 10 units to put it back on the ground. You may also want to scale it up a little, depending on how big you made it in Wings3d.

DI-Machine exports a bunch of handy comments, but in case yours isn't working, here's a sample drawinfoed box that works.

An overview of a drawinfoed box

Fire up bzfs and see how it looks. You can do a lot of stunning things by adding some dynamicColor and multiple drawinfoed objects. I've tested a watchtower with a spotlight that sweeps back and forth through 90º and I've seen a map by Trepan that has a sphere that moves in a figure eight path. For these kinds of applications you need to synchronize the "angvel" of the drawinfo, and the "alpha sequence" of the dynamicColor.

You can also offset the model in Wings3d to have the object rotate around the origin. You can then shift its group and have the object rotate around any point on the map. It's also nice on models of airplanes to give the group about 15 degrees of spin so it changes altitude.

Spinning Box

You can also use modeltool if you'd like, but I don't because I had a lot of problems with it in the past. There's a good tutorial by Optic Delusion about it here if you want to give it a go.