OBJ2WCP

Table of Contents:

Introduction
How to use
Progress
License
Download

Introduction

OBJ2WCP is a command line application that converts models from Wavefront OBJ format to an IFF source code file, which can then be compiled by WCPPascal into a Wing Commander Prophecy/Secret Ops IFF mesh. OBJ2WCP is written in Java and the source code is available in the download.

Information on the file formats can be found here: WCP 3D model format | OBJ file format

How to use

First, you must place any OBJ and MTL files into the same directory as the converter. Having the bitmaps in the same folder is not required. To start the program, use your OS command line to go to the directory of the program and type:

java ModelConverter

Simply type in the model name and the starting MAT number, then watch it go! After the program is done, compile and build the .pas file with WCP Pascal.

Preconditions: The OBJ mesh must be fully triangulated, the model and material must be in the same folder, starting MAT number can be no longer than 8 digits, all materials must have textures, OBJ/MTL filename cannot have spaces, all vertices must have UV coordinates, all faces must have a vt reference.

The program works by looking for the material library file in the OBJ file, reading the material library and all materials, then reading the rest of the OBJ file. The program stores vertex/normal/face data in arrays, then streams out the IFF file by converting each string representing each line to an array of bytes and passing it to the file output stream.

Progress

The progress of each individual aspect of the program is shown on the progress chart below. Note that this chart may be updated at any time.

Code Section Status Description
OBJ Parsing code Complete This code reads the OBJ file and the values of vertex positions, UV coordinates, vertex normals, and faces.
MTL Parsing code Complete This code reads material and bitmap names from MTL files.
Value adapting code Unsure This code adapts the values taken from the OBJ file so that it is usable by the WCP engine.
IFF Output code Complete This code writes the WCP Pascal file, ready for compiling into WCP format.

In the future, I may add a few features, including:

- Group parsing, for LODs and Capship Components
- Command line argument parsing
- VTNM Calculator
- Loading of external files for Hardpoints, Radius, etc.
- Model viewer

License

OBJ2WCP is licensed under the following terms:
- You may use this program for non-commercial or commercial purposes.
- You may redistribute this program, as long as it is redistributed free of charge.
- You may modify the source code and redistribute your modified versions, as long as they are redistributed free of charge.
- If you are redistributing the program, please provide a link on your website to http://www.ciinet.org/kevin/java/index.html. If for any reason this is not possible, (e.g. uploading to Mediafire) provide a link to http://www.ciinet.org/kevin/java/index.html on the site where you are linking to your uploaded file on mediafire.

Download

Updated 2011/01/05 - unknown1 value is now calculated properly. Thanks, gr1mre4per!

OBJ2WCP 1.2 is available for download here: obj2wcp_1.2.zip (14.7 kb)