Importing 3D models

Detailed 3D models can be imported into OrcaFlex and used to represent the various model objects in shaded graphics. Some examples of these are shown on the OrcaFlex image gallery; others, including the object data, can be found among the OrcaFlex examples. Included with OrcaFlex installation is a collection of very basic, generic models which you are free to use. If, instead, you wish to use a detailed model of a project-specific vessel, buoy, template etc, you can import such models into OrcaFlex one of the following formats:

These describe a surface mesh and, possibly, material (colour and texture) properties for such a model.

3D models to be imported into OrcaFlex should not contain too much detail, otherwise the drawing performance may be very poor – there are limits to the level of detail a graphics card can render efficiently. The largest model that we provide is 350KB and we recommend that you avoid exceeding this size by too much, if necessary by reducing their level of detail before exporting them from the modelling software you use.

OrcaFlex assumes that DirectX models have a left-handed coordinate convention (with the $z$-axis positive into the screen, and the $x$ and $y$ axes in the plane of the screen), and on import applies a transformation to reorient the model to the OrcaFlex coordinate system that also converts the model from left to right-handed drawing axes. If you do not know the original axis convention of the 3D model, or if the default transformation applied by OrcaFlex seems incorrect, then the shaded graphics import form allows you to apply an additional translation and rotation to the 3D model. The model can also be switched between the right or left-handed axis convention (this also modifies the face normals and winding direction to preserve the lighting and culling characteristics).

3D modelling packages

A number of 3D modelling packages are available which support export in .x or .obj format. An up-to-date list of these, both commercial and free or open source, with links to their respective websites, is maintained on our own website on the shaded graphics support page.

Support for Wavefront OBJ file format

The Wavefront .obj file format and the associated material file (.mtl) is a commonly used interchange format for 3D meshes and their properties. A description of the file specifications are here: OBJ specification and here: MTL specification. OrcaFlex supports a subset of these specifications that is sufficient for the requirements of rendering a 3D model in the shaded graphics view. The .mtl file is optional, if no material file is used the object will be drawn in the pen colour defined by that object's drawing data in OrcaFlex.

Supported OBJ file statements

The .obj file defines the mesh vertices, normals, texture vertices and faces for a model. These definitions may be grouped into subsets for the purpose of applying named material properties and for selection purposes when edited in a 3D software package. The following statements are supported by OrcaFlex:

mtllib filename Optional. filename should be a Wavefront material file with the extension .mtl. OrcaFlex only accepts one filename.
v x y z Required. Geometric vertex x, y and z coordinates (floating point values).
vn i j k Optional. Normal vector components i, j, k (floating point values).
vt u v Optional. Texture u, v coordinates. Values greater than 1.0 indicate a repeated (tiled) texture. The texture file is specified in the current material properties specified in the previous usemtl statement.
f v/vt/vn ... Required. Face vertex definitions. v is the (1-based) index into the list of geometric vertices, vt the index into the texture vertices and vn the index into the vertex normal list. There should be at least 3 face vertex definitions per line. If 4 or more face vertices are present (a polygonal face) then OrcaFlex will triangulate these itself. If vt is not required then the second / must be present, e.g: f v//vn.
usemtl material-name Optional. This directs OrcaFlex to use the named material properties defined in an associated .mtl file for all subsequent faces following this line (until the next usemtl statement).
# Comment line
All other statements are ignored.

Supported MTL file statements

The .mtl file defines the material colours and textures that are named in the OBJ file. usemtl statements in the parent OBJ file must have a corresponding material definition in the associated MTL file. The following statements in the MTL file are supported by OrcaFlex:

newmtl material-name Required. The following statements define the material properties that can be specified using usemtl material-name in the OBJ file.
Kd r g b Required. The red, green and blue values in the range 0.0 to 1.0 for diffuse lighting. This is the main colour property for the material.
Ks r g b Optional. The red, green and blue values in the range 0.0 to 1.0 for spectral lighting effects, requires the Ns statement is present.
Ka r g b Optional. The red, green and blue values in the range 0.0 to 1.0 for ambient lighting effects. Some 3D software packages may export this with default values of 1.0 1.0 1.0 (white) and the resultant rendered object will appear just white in OrcaFlex – so edit to 0.0 0.0 0.0 or remove this line completely if not required.
Ns Optional. The focus of the spectral highlights with a value between 0 and 1000. Higher values give sharper and more focused spectral highlights.
d Optional. the default is 1.0. The dissolve into the background (transparency) of the material: 0.0 is fully transparent and 1.0 is fully opaque.
map_Kd filename Optional. The image file (e.g. a .png or .bmp file) to use for a texture.
# Comment line
All other statements are ignored.