Friday, June 22, 2007

Wings 3D

Wings 3D is one of the free (as in speech and beer) 3D graphics programs that has an exporter allowing the creation of sculpted prims. It runs on a wide variety of platforms, thanks to being written in Erlang, a functional programming language developed by Ericsson (so thank you to Sweden!).

Natalia Zelmanov has two parts (one, two) of a tutorial on using Wings 3D to create sculpted prims up on her excellent blog. I would amend her instructions slightly.

First, if you are using Ubuntu Feisty Fawn, then you have access to Wings 3D version 0.98.35, and the exporter, as far as I can tell, works with it quite nicely.

Second, just copying the files for the exporter into what appears to be the correct directory does not make sculpted prims visible in the Wings 3D menu as an export option, so I would do the following:
  1. Install Wings 3D using your favorite method, be it Synaptic, whatever the KDE program is for managing packages (sorry, I don't use KDE that much), or just "sudo apt-get install wings3d".
  2. Head over to the SL forum thread where Omei Turnbull announces his creation of the exporter (thank you Omei!) and download it.
  3. At least in the version of Wings 3D in the Feisty Fawn repositories, the "install plugin" command only knows about gzipped tar files, so convert it from a .zip into a gzipped tar file using the archive twiddler of your choice.
  4. Run Wings 3D, click File > Install Plugin, and point it at the gzipped tar version of the exporter.
Poof! Now, when it comes time to export, "Second Life Sculpty" will be on the list of export formats you can choose from.

Sculpted prims, version one, only come in one flavor, namely those that are topologically equivalent (homeomorphic, to be official) to a sphere. So, as Natalia says, the way to start is to create a sphere, or rather an approximation of a sphere that has vertices that correspond directly to the entries in the "texture" that defines the sculpted prim's shape. Those textures are 2n by 2n, so make your sphere have 2n "sections" (think longitude, or citrus fruit) and 2n - 1 "slices" (think latitude) for values of n that the exporter supports. According to Natalia, n can run from three to six, i.e. 8, 16, 32, or 64 sections. (SL supports 128 x 128, and I'm hoping the exporter will eventually allow that; I may need that resolution someday.)

(Why the different number of slices? Because they don't wrap around like the sections. If there were just one slice, there would be two rows (or columns, depending on how LL lays it out) in the texture, one at each pole, and adding a slice adds one row (or column) where you split one slice into two, so to get 2n rows (or columns) you only need 2n - 1 slices.)

(WARNING! There's a bug open related to this. Textures undergo JPEG compression, and JPEG compression is lossy; it throws away information. This isn't a big deal for textures used as textures were initially intended, i.e. for painting objects, but for defining sculpted prim shapes, it is disastrous. Please head over to the JIRA and vote for VWR-866, and until the bug is dealt with, go with at least 64 x 64 for serious sculpted prim work.)

Now... you have your sphere, what are you going to do with it? Of course, you have to wrangle it into the shape you want. Because of the way sculpted prims work, you can only use operations that don't change the number of vertices. This is the point I'm at now; I need to go through the Wings 3D docs, and determine which operations those are, and how to use them to get the shape I want. (Then comes texturing them, i.e. creating a texture that is really used to paint the sculpted prim. I have no idea how to do that, so I'm hoping for more installments of Natalia's tutorial!)

No comments: