Difference between revisions of "Collada Importer"

From FreeSpace Wiki
Jump to: navigation, search
(Creation of article, mostly background and some links)
 
(LODs: some non-obvious pitfalls, hope this is the appropriate place)
 
(17 intermediate revisions by 3 users not shown)
Line 1: Line 1:
This is the WIP page to document the design and implemenation of a Collada to POF model converter.  This article was created in response to [http://www.hard-light.net/forums/index.php/topic,54757.html Cash prize for Collada - POF support!]
+
This is the WIP page to document the design and implementation of a Collada to POF model converter.  This article was created in response to [http://www.hard-light.net/forums/index.php/topic,54757.html Cash prize for Collada - POF support!]
  
 
==Background==
 
==Background==
The goal of this project is to create a stable import system with which to convert the open-standard Collada (DAE) XML-based model format to the Freespace POF binary model format.  Many other export options exist, but each has its flaws and none seem to work flawlessly.  Using a cross-application format such as Collada and a community-developed converter should help address many of the existing issues.  The conversion application [http://www.hard-light.net/wiki/index.php/POF_Constructor_Suite_2 PCS2] already has COB->PMF, PMF->POF, and the reverse of both.  We have access to the specifications for POF through Volition's documentation but the format is difficult to work with directly.  We have access to the PMF specification through the source code to PCS2, but better documentation (in a more human-readable format) for this could be useful.  However, PMF is designed to be an easily-accessed format to be used in between other formats and the PMF->POF conversion routines in PCS2.  Currently the plan is (barring serious objection by the community) to create a library of routines to convert a DAE file to a PMF file.  This library could then be utilized in PCS2 using its existing PMF->POF support, or that functionality could be utilized in another standalone converter.  With that in mind, the following are the requirements and specifications a converter and the models must adhere to.  As for working with the Collada format, one such possibility is the [http://www.feelingsoftware.com/content/view/62/76 FCollada] library, a free set of routines to interface with Collada.
+
The goal of this project is to create a stable import system with which to convert the open-standard Collada (DAE) XML-based model format to the FreeSpace POF binary model format.  Many other export options exist, but each has its flaws.  Using a cross-application format such as Collada and a community-developed converter should help address many of the existing issues.  The conversion application [http://www.hard-light.net/wiki/index.php/POF_Constructor_Suite_2 PCS2] already has COB->PMF, PMF->POF, and the reverse of both.  We have access to the specifications for POF through Volition's documentation but the format is difficult to work with directly.  We have access to the PMF specification through the source code to PCS2, but better documentation (in a more human-readable format) for this could be useful.  However, PMF is designed to be an easily-accessed format to be used in between other formats and the PMF->POF conversion routines in PCS2.  Currently the plan is (barring serious objection by the community) to create a library of routines to convert a DAE file to a PMF file.  This library could then be utilized in PCS2 using its existing PMF->POF support, or that functionality could be utilized in another standalone converter.  With that in mind, the following are the requirements and specifications a converter and the models must adhere to.  As for working with the Collada format, one such possibility is the [http://www.feelingsoftware.com/content/view/62/76 FCollada] library, a free set of routines to interface with Collada.
  
 
==DAE File Prerequisites==
 
==DAE File Prerequisites==
 +
 +
The conventions for a DAE file will be similar to those for [[Styxx's POF Conversion plugin for 3D Studio Max]].  All major modelings apps should be able to understand a model that follows these conventions.
 +
 +
Treat everything as case sensitive. All numerical sequences to be interpreted by the converter must be contiguous and begin with 01 unless otherwise specified.
 +
 +
For appropriate helper generated fields the centre is determined by translation field, the radius is determined by the X scaling and the normal is determined by the rotation fields.
 +
 +
This list is in progress and is subject to change. Suggestions should be made in [http://www.hard-light.net/forums/index.php/topic,54757.0.html Cash prize for Collada - POF support!]
 +
 +
===LODs===
 +
detailX, where X ranges up from 0 at top level. Don't forget to apply transformations. detail0's center should be at (0,0,0), otherwise paths will be incorrectly aligned in FS2 (even though PCS2 shows them correctly).
 +
 +
===Subobjects===
 +
Subobjects should be set as children of their desired parent object. Turret barrels should be a child of their turret base. <br>
 +
Helpers should be grouped as children of a child of the subobject with a name starting with "helper".
 +
 +
===Debris===
 +
debrisXX at top level.
 +
 +
===Shield===
 +
shield
 +
 +
The shield mesh should be triangulated and at top level.
 +
 +
===Subsystems===
 +
subsystem<subsystem name>, no <>, at top level. <br>
 +
Helpers should be grouped as children of a child of the subsystem with a name starting with "helper".
 +
 +
===Engine Glows===
 +
Grouped as children of a node with a name starting with "thrusters". <br>
 +
Should be a child of a helper node if linked to a subsystem or at top level otherwise.
 +
 +
===Dockpoints===
 +
Grouped as children of a node named "dockpointXX" at top level. <br>
 +
Helpers should be grouped as children of a child of the dockpoint with a name starting with "helper".
 +
 +
===Gun banks===
 +
Grouped as children of a node named "gunbankXX" at top level.
 +
 +
===Missile banks===
 +
Grouped as children of a node named "missilebankXX" at top level.
 +
 +
===Turret Firepoints===
 +
Grouped as children of a node with name starting with "firepoints" which is a child of the turret submodel node helper node.
 +
 +
===Eyepoints===
 +
eyepointXX at top level.
 +
 +
===Paths===
 +
Grouped as children of a node with name starting with "firepoints" which is a child of the subsystem, submodel or dockpoint helper node.
 +
 +
===Glowpoints===
 +
Grouped as children of a node with name beginning with "glowbank" which is a child of the submodel of the glowbank. Texture name should be stored as a property "$glow_texture=<texture name>". Timing, type, normals and LOD are ignored pending suggestions on dae format storage
 +
 +
===Insignia===
 +
insigLODXX-YY; triangulated UV-mapped mesh at top level; texture will be included in the texture list unless its name begins with "insignia".
  
 
==Converter Requirements==
 
==Converter Requirements==
 
Must output a PMF compliant with the structure utilized by the PMF importer of PCS2.
 
Must output a PMF compliant with the structure utilized by the PMF importer of PCS2.
 +
 +
==How to Get Collada Support==
 +
You need POF Constructor Suite 2.0.3 (link below), and Spicious' latest development executable (link below).  This executable has two more dependencies, the libColladaDOM DLL and VC2008 runtimes, also linked below.  Install PCS2, backup pcs2.exe in the install folder, copy the new one from Spicious' archive to your PCS2 folder, copy the libcollada dll to the install folder, and install the VC2008 runtime.  You should be good to go from there.
  
 
==External Links==
 
==External Links==
 
[http://www.hard-light.net/forums/index.php/topic,54757.html Cash prize for Collada - POF support!]
 
[http://www.hard-light.net/forums/index.php/topic,54757.html Cash prize for Collada - POF support!]
 +
 +
[http://www.khronos.org/collada/ COLLADA Specification]
  
 
[http://www.feelingsoftware.com/content/view/62/76 FCollada Home Page]
 
[http://www.feelingsoftware.com/content/view/62/76 FCollada Home Page]
  
 
[http://alliance.cvs.sourceforge.net/alliance/pcs2/ PCS2 CVS Repository] - For COB->PMF reference, only PMF format docs
 
[http://alliance.cvs.sourceforge.net/alliance/pcs2/ PCS2 CVS Repository] - For COB->PMF reference, only PMF format docs
 +
 +
[http://www.collada.org/owl/index.php?login=1&failure=1 COLLADA Test Model Bank]
 +
 +
[http://the158th.hard-light.net/spicious/pcs2.7z Spicious' PCS2 Dev Build with Collada support] [http://scoobydoo.freespacemods.net/Completed/Misc/pcs2.exe Last known DAE PCS2 Build based on 2.0.3] [http://the158th.hard-light.net/spicious/libcollada14dom21.7z libColladaDOM DLL for this build] [http://www.microsoft.com/downloads/details.aspx?familyid=A5C84275-3B97-4AB7-A40D-3802B2AF5FC2&displaylang=en VC2008 SP1 Runtime for this build]
  
 
[[POF Constructor Suite 2]]
 
[[POF Constructor Suite 2]]
 +
 +
[[Styxx's POF Conversion plugin for 3D Studio Max]] - The basis for the DAE model conventions
 +
 +
[[Category:Modding]]

Latest revision as of 16:20, 9 July 2010

This is the WIP page to document the design and implementation of a Collada to POF model converter. This article was created in response to Cash prize for Collada - POF support!

Background

The goal of this project is to create a stable import system with which to convert the open-standard Collada (DAE) XML-based model format to the FreeSpace POF binary model format. Many other export options exist, but each has its flaws. Using a cross-application format such as Collada and a community-developed converter should help address many of the existing issues. The conversion application PCS2 already has COB->PMF, PMF->POF, and the reverse of both. We have access to the specifications for POF through Volition's documentation but the format is difficult to work with directly. We have access to the PMF specification through the source code to PCS2, but better documentation (in a more human-readable format) for this could be useful. However, PMF is designed to be an easily-accessed format to be used in between other formats and the PMF->POF conversion routines in PCS2. Currently the plan is (barring serious objection by the community) to create a library of routines to convert a DAE file to a PMF file. This library could then be utilized in PCS2 using its existing PMF->POF support, or that functionality could be utilized in another standalone converter. With that in mind, the following are the requirements and specifications a converter and the models must adhere to. As for working with the Collada format, one such possibility is the FCollada library, a free set of routines to interface with Collada.

DAE File Prerequisites

The conventions for a DAE file will be similar to those for Styxx's POF Conversion plugin for 3D Studio Max. All major modelings apps should be able to understand a model that follows these conventions.

Treat everything as case sensitive. All numerical sequences to be interpreted by the converter must be contiguous and begin with 01 unless otherwise specified.

For appropriate helper generated fields the centre is determined by translation field, the radius is determined by the X scaling and the normal is determined by the rotation fields.

This list is in progress and is subject to change. Suggestions should be made in Cash prize for Collada - POF support!

LODs

detailX, where X ranges up from 0 at top level. Don't forget to apply transformations. detail0's center should be at (0,0,0), otherwise paths will be incorrectly aligned in FS2 (even though PCS2 shows them correctly).

Subobjects

Subobjects should be set as children of their desired parent object. Turret barrels should be a child of their turret base.
Helpers should be grouped as children of a child of the subobject with a name starting with "helper".

Debris

debrisXX at top level.

Shield

shield

The shield mesh should be triangulated and at top level.

Subsystems

subsystem<subsystem name>, no <>, at top level.
Helpers should be grouped as children of a child of the subsystem with a name starting with "helper".

Engine Glows

Grouped as children of a node with a name starting with "thrusters".
Should be a child of a helper node if linked to a subsystem or at top level otherwise.

Dockpoints

Grouped as children of a node named "dockpointXX" at top level.
Helpers should be grouped as children of a child of the dockpoint with a name starting with "helper".

Gun banks

Grouped as children of a node named "gunbankXX" at top level.

Missile banks

Grouped as children of a node named "missilebankXX" at top level.

Turret Firepoints

Grouped as children of a node with name starting with "firepoints" which is a child of the turret submodel node helper node.

Eyepoints

eyepointXX at top level.

Paths

Grouped as children of a node with name starting with "firepoints" which is a child of the subsystem, submodel or dockpoint helper node.

Glowpoints

Grouped as children of a node with name beginning with "glowbank" which is a child of the submodel of the glowbank. Texture name should be stored as a property "$glow_texture=<texture name>". Timing, type, normals and LOD are ignored pending suggestions on dae format storage

Insignia

insigLODXX-YY; triangulated UV-mapped mesh at top level; texture will be included in the texture list unless its name begins with "insignia".

Converter Requirements

Must output a PMF compliant with the structure utilized by the PMF importer of PCS2.

How to Get Collada Support

You need POF Constructor Suite 2.0.3 (link below), and Spicious' latest development executable (link below). This executable has two more dependencies, the libColladaDOM DLL and VC2008 runtimes, also linked below. Install PCS2, backup pcs2.exe in the install folder, copy the new one from Spicious' archive to your PCS2 folder, copy the libcollada dll to the install folder, and install the VC2008 runtime. You should be good to go from there.

External Links

Cash prize for Collada - POF support!

COLLADA Specification

FCollada Home Page

PCS2 CVS Repository - For COB->PMF reference, only PMF format docs

COLLADA Test Model Bank

Spicious' PCS2 Dev Build with Collada support Last known DAE PCS2 Build based on 2.0.3 libColladaDOM DLL for this build VC2008 SP1 Runtime for this build

POF Constructor Suite 2

Styxx's POF Conversion plugin for 3D Studio Max - The basis for the DAE model conventions