My apologies for the slow pacing of this series. Things are pretty hectic for me at the moment, with work and personal circumstances. Fortunately today I had some spare time to put the following together:
The above was created in 3D Studio Max 2010. it consists out of four rectangles: floor, large side, small side and window. Further two instanced pillars and a tilted pyramid are used. The two small sides/walls are instances of each other, meaning that they’ll mirror each other’s appearance and other qualities except for position and orientation. When you copy a selected item using Ctrl+v, you get offered to either make a copy or an instance. A copy is independent, an instance is as described earlier. Using the right choice here can make life much easier 🙂
To prepare the elements of this scene for use with jPCT-AE we will have to export each of them to a suitable 3D object file format. I picked OBJ (Wavefront .obj file) because it’s the most common and light-weight of all: http://en.wikipedia.org/wiki/Wavefront_.obj_file
The demo provided on the jPCT-AE page uses 3DS format files, which are relatively huge and complex to parse. OBJ on the other hand are ASCII format and can be read and corrected by a human with a text editor. This makes them far easier to debug as well. Another thing the demo does is serialize the 3D object files using a serialize function only available in the desktop version of the engine. We’ll look at that one later as it can provide a nice speed boost to the loading of resources. For now we’ll keep it simple.
In 3D Studio Max you can export to OBJ files using the standard export feature which I assume you can find. Select the mesh you wish to export, go to export and select ‘Export Selected’. On the next screen pick a name for the mesh and select OBJ as the file type. After clicking next, you get the OBJ export dialogue. The default settings are fine, although you want to make sure you’re exporting materials too (first two checkboxes). Check the 3DS manual if you want to know what each feature does. Do be sure to click the Map Export button. On this screen you’ll want to disable ‘use map-path’, enable ‘extended map-params’, ‘convert bitmaps’ and then pick a suitable map format. This will be used for the textures added to the mesh. I picked PNG here since that’s a nice portable and small format for mobile applications. TGA is more suitable for high-end purposes, and isn’t as widely supported.
Now, just keep exporting each mesh in the scene until you’re done and have a folder filled with OBJ, MTL (material) and PNG files. In the next installment I’ll show you how to take all these loose bits and reassemble it into a coherent whole again, inside the game environment 🙂