OXP howto model

From Elite Wiki
Jump to: navigation, search

Create your model

in Wings3D or a similar program.

How you do this is up to your creativity, but Aegidian has created the following tutorial for Wings3D.

Sv wings mode object.png Launch Wings3D and select the object mode.
Sv wings menue object cube.png Right-click in the workspace to pop up the object menu. Select the options for the cube.
Sv wings options cube.png Cubes created by Wings3D measure one unit on a side. In Oolite these units are meters and a 1m x 1m x 1m spaceship is a bit small, so we're going to scale it to 30m wide, 10m tall, and 30m long.

You'll need to dolly the camera away from your object a bit to be able to see it all in the view now. I use the scroll-wheel to do this, but ctrl-alt-[left mouse button] and up or down will also work.

Another approach is to create the standard sized cube and Right-click and choose .Scale Axis. Choose the .X. axis then press tab to allow numeric input, this is a percentage, so enter 3000 to scale the objects x-axis dimension to 30m. Do the same scaling on the .Y axis, scaling by 1000%. and on the .Z. axis scaling by 3000%.
Sv wings workspace cube.png This gives us our basic shape, 30m wide by 30m long by 10m high.
Now some details, we'll add a bevel for the front viewscreen and some fins.
Sv wings mode edge.png First the bevel, select the edges mode and press space to clear the current selection.
Sv wings workspace cube edge.png Select the upper front edge, Right-click to pop up the menu and choose Bevel.

Move the mouse until you've got the right look, then left-click to set the bevel. You can also press tab to allow numeric entry of the bevel amount again.
Sv wings workspace cube bevel.png Voila. The first step is done. Next the fins. These will be a bit trickier.
Sv wings workspace cube edgeB.png Select edges mode again and press space to clear the selection.

Then choose one of the two upper edges going from front to back.
Sv wings options cut.png Right-click for the menu and then choose .Cut and choose 2 2 to cut the line into two pieces.

Do the same for the line on the other side. You'll find yourself in points mode, with the indicated point selected.
Sv wings mode face.png Now we need a quick trick to make life easier - choose faces mode and press command-a to select all faces.
Sv wings workspace allfaces tesselate.png Right-click and choose Tesselate and then Triangulate, which will make turn all the flat faces into bunches of triangles.
Sv wings workspace tesselated.png
Sv wings workspace cube edgeC.png Return to edges modes and select the two edges to become fins.
Sv wings options extrude normal.png Right-click and choose .Extrude and Normal and move the mouse until you are pleased.
Sv wings workspace flying brick.png Tadaa! A flying brick.


pic 1
pic 2
pic 3
pic 4
pic 5
pic 6
pic 7

If you've read the tutorial above it's time to think about a few more things.

Optimize

Optimizing models and textures for a game is no fun, specially if it's a model with lots of greebles and funny details.

Simple example

So let's stick with a simple example - a simple cone combined with a cube. When creating the UV-Map in Wings3D this map is really in no way optimized. Doing optimizations as postprocess is a real pain, believe me .-)

Let's say you have created a model in Wings3D (pic 1) and created the UV-Map (pic 2). You can see that Wings3D does some preparations for you, e.g. the UV information is taking place in the maps area and the polygons are separated (in chunks), based on the method you've used to create the UV-Map. It's a good starting point but far away from a optimum for a game.

Wasted texture informations

You can see in a few OXPs background images in the UV-Maps (pic 3). This is just wasted texture information, results in bigger filesizes and and makes optimization tools pretty senseless. These tools are using Deflate, LZ77, RLE (Run-length_encoding) and other algorithms to optimize the texture information streams in the maps. Better use a solid color (black, grey or white).

Wasted faces

Wings3D is a box-modeller and creating objects in Wings3D always results in closed objects. Result is that quite a few faces are just wasted (pic 4), because they are not visible at all, but still eating memory and processing time. This can easily go in a few thousands of faces when a lot of models are used in installed OXPs. Luckily there's a way as Wings3D provides a hole material. This is a special feature to reduce the amount of data when exporting the model as .obj as the faces won't appear in the exported model and UV-Map.

Resort the map

The next step is to resort (and sometimes scale) the polys in the UV-Mapper. Best practice is to leave a little bit space between polys (pic 5). This is a lesson I had to learn with my models. I was always wondering why some artifacts appeard at the edges and why the mipmapping doesn't work properly.

Mipmapping

To get it working properly expand the areas with real texture information by a few pixels (pic 6). Oolite will do the mipmapping (if its available) automagically. Mipmapping or Level of Detail (LOD) is a antialiasing technique to improve the quality when textures are minified / magnified. See Mipmap for more infos.

Tesselation is evil

And last but not least tesselation (or subdivision) is evil if its used to smooth objects appearance. We can see it in a growing number of released OXPs, and it is really the worst case. Tesselation (pic 7) is a time eater for a game as it increases vertex and face counts a lot and often enough results in higher texture sizes. Both are adding time to the setup of entities whenever they are spawned in the game. Oolite handles smooth groups and hard/soft edges so in most cases there is absolutely no need to raise v/f counts. A really simple example how to use the smoothing option in combination with materials entries in Oolite can be found in the RVandGS.oxp.

Details and Greebles

Another point to consider is if a detail has to be done in the model itself or if this can be placed in a normal map.


Export the model

to obj( mtl texture) and convert to *.dat format.

3 steps

The picture above shows 3 simple steps to export the model and use one of the converter scripts to get the .dat file.

  • If you have the Wings stuff ready for export (means a model with UV-Map), simply use the Wavefront (obj) exporter (Step 1+2). You'll need to configure it as shown in Step 2. Once exported you have three files (.obj, .mtl and .png).
  • Copy the Obj2DatTexNorm.py to your folder where the model has been saved to.
  • Open a shell and switch to the folder with the model (and script) and type in: Obj2DatTexNorm.py mymodel.obj (Step 3).

Please note that the converter script Obj2DatTexNorm.py needs Python 2.7 or higher (but doesn't work out of the box with 3.x!!). There is still Obj2DatTexNorm.py available which will work with Python 2.5, but the recommended tool is Obj2DatTexNorm.py.

Edit shipdata.plist

Supply the in-game values relevant to your model.

Subentities

Entities can have sub-entities, which are defined by quaternions. There are several types of SE:

  • Model Entities: can be any model, with any properties.
  • Turrets: are a specialised model entity.
  • Flashers: blinking lights
  • Exhausts: although they are defined seperate from subentities, they can be regarded as subentities.

One important thing to remember is that frangibility is defined for the main entity, not seperately for every SE.

Links