' (Current Version: pre-alpha) '

New Home

The OgreCollada project (wiki, forum and source) can now be found on sourceforge: OgreCollada (NOTE: website seems to have been abandoned since Dec 2008, and spam added to the front page in Aug 2009. Access the wiki history to get at the actual Ogre Collada information. One of the external links on the wiki triggered the virus alert in my antivirus program. This note was added Jan, 2011.) This is also a work in progress so some information may still be outdated. The rest of this page is outdated.

OgreCollada

OgreCollada is a project intended to replace the current ColladaPlugin with updated and complete COLLADA support, at least so far as Ogre is concerned. That is, everything in COLLADA that applies to Ogre, OgreCollada will support.

NOTE: Currently, OgreCollada in plugin form also replaces CgProgramManager, since the current design requires that the code have access to the CgProgram class, but a compile- and runtime-dependency on the CgProgramManager library was not desired. This design is likely to change in the near future, but at this time, if you build and use OgreCollada in plugin form, disable loading of your CgProgramManager plugin; the OgreCollada plugin provides the CgProgramManager plugin internally. Note also that the CgProgram and CgProgramFactory code are Ogre 1.4.6; this means that the changes made to the 1.6 (CVS HEAD) code stream are currently potentially incompatible with OgreCollada.

License


OgreCollada is released under the MIT license. In other words, do with it what you like, don't claim it as your own invention, and no warranty expressed or implied and so on. Yes, static-linking is fine (and preferred).

Dependencies

FCollada

OgreCollada leverages the actively-developed and MIT-licensed FCollada library, developed and maintained by Feeling Software. The OgreCollada source distribution includes all of the FCollada source needed to build OgreCollada.

Ogre3D

OgreCollada also depends, obviously, on Ogre. Specifically, the OgreMain library. It is assumed that if you are interested in using OgreCollada, that you already have Ogre available somewhere on your development machine.

Mogre (optional)

If you intend to build the Managed C++ (C++/CLI, aka CLR) configurations of OgreCollada, you need to have access to the Mogre OgreMain library and header files.

Platforms

OgreCollada builds and runs on Windows and Linux at present.

Windows


Windows projects for Visual C++ 8.0 are provided.

Linux

On Linux, the current build script support is Scons; autotools support will be added in the future.

Downloads

Currently OgreCollada is available only in source form.

Source

You can get the source from anonymous SVN, at
https://svn.clashofsteel.net:8445/OgreCollada/trunk
(Link seems to be dead - Jan4, 2011)

You will most likely be prompted to accept the SSL certificate we used — we use a self-signed certificate; it is not there for trust, but for password security.

Anonymous access credentials:
username: anonymous
password: anonymous

If I get a chance, I will figure out how to make SVN/mod_svn accept empty username and passwords.

Building From Source

Windows

Building from source gives you the option of building OgreCollada as an Ogre plugin, or as a static library.

On Windows, you need to do the following once you have obtained the source:

  • Change the project settings for Debug/Release/Debug DLL/Release DLL to point to where your OgreMain header (.h) and lib (.lib) files exist. If you are using an Ogre SDK, this will be in $(OGRE_HOME)/OgreMain/include and $(OGRE_HOME)/lib.
    • If you are building ColladaViewer, you need to point the ColladaViewer project to where your wxWidgets headers and libs exist.
    • If you are building the Debug CLR and/or Release CLR configurations, you need to point the project settings to where the Mogre OgreMain headers and libs exist.
  • Build Solution
    • For Ogre Plugin: Select Debug DLL or Release DLL. Plugin will be copied to the bin/ directory in the OgreCollada source root.
    • For static library: Select Debug or Release. Currently, the recommended method of linking OgreCollada as a static library is to include it in your project and link it implicitly via the Project Dependencies feature in Visual Studio. This means you will need also the FCollada, FArchiveXML and LibXML projects in your solution as well, and have those set as dependencies of your project executable.

Linux

(I have not performed the Linux build myself — the SCons build files were provided by another developer). Currently, the only way to build on Linux is with SCons. In the future, autotools scripts will be available for OgreCollada.

Binaries

Binary SDK builds of the library are not yet available.

Tools

OgreCollada comes with some development tools, primarily used while I was testing the library, so they are not intended to be full-featured content-development tools, but instead, can serve as tools to verify that what you exported as COLLADA will look as you expect in your Ogre app, without having to fire up the app.

Ogre ColladaViewer


A simple viewer application that allows you to preview your COLLADA document in an Ogre render window. This app is implemented as a wxWidgets application for portability; in order to build this application you will need to have wxWidgets headers and libs available on your system. The Linux build scripts check for wxWidgets presence; currently Windows users will need to point the ColladaViewer project settings to where your wxWidgets headers and libraries exist. In the future, license permitting, I will include the prebuilt wxWidgets headers and libs with OgreCollada.

Current navigation is extremely limited: only the mouse scroll wheel is recognized, to zoom in and out of your scene. Holding down CTRL while scrolling zooms at 1/10 the rate.

Ogre ColladaConverter

This is a work-in-progress command-line application intended to perform the same tasks as the OgreXmlConverter tool — namely, produce Ogre .mesh, .skeleton and .material files from the content contained within the COLLADA document. It is in very early stages of development — at last check, it crashes with programmable materials because there is no render window created by this application.

ColladaMaya/ColladaMax


Currently, there is a need to provide altered versions of these two Feeling Software plugins; see below in the COLLADA FX section.

Language Bindings

C# (C++/CLI)

I have got a start on Managed C++ (C++/CLI, aka CLR) bindings for OgreCollada. This works for me with a particular build setup — since it depends on the Mogre build of Ogre, you needs to link it against the Ogre libs as built within the Mogre project. This means in turn that you need to have Mogre in source form, or at least the OgreMain libs and headers from the version of Mogre you are using. Given the above, this support is listed as "experimental", but know that it does work. Limitations: currently no support for resource-created notifications in the Managed version of OgreCollada.

These bindings are available in the "Debug CLR" and "Release CLR" project configurations of OgreCollada.

Using OgreCollada

OgreCollada is as compatible with the COLLADA 1.4.x specification as FCollada is. (There is one missing feature in FCollada, mentioned in the TODO list below). This means that so long as the DCC tool you are using emits compliant 1.4.x COLLADA, OgreCollada should be able to import that document without problems.

The major additions to COLLADA in 1.4.x versus the 1.3 and prior versions, are COLLADA Physics and COLLADA FX.

COLLADA Physics

The TODO list below identifies COLLADA Physics support as a post-1.0 issue. This may move up in priority (likely, will, since I will need it personally, but it is one of those things that will be done when it's done). In short, OgreCollada will simply parse the COLLADA Physics objects and fire notifications when they are complete, so that the application can deal with the physics data how it likes. No particular support for or integration with any physics library is planned, or implied — OgreCollada will simply provide to the application the raw physics data and physics body/shape data, when it encounters any.

COLLADA FX

COLLADA 1.4.x introduced support for the programmable graphics pipeline. COLLADA FX can best be thought of as an XML version of CgFX/.fx (the nVidia and Microsoft "effect file" formats). COLLADA FX's native/preferred high-level shader language is Cg; this is not surprising considering that the COLLADA FX specification was created by nVidia personnel. (Note: While GLSL is also supported in COLLADA FX, there are no plans at present in OgreCollada to support shaders defined in <profile_GLSL> blocks.)


While some may see this as a limitation, the fact that Cg has a stable API and the current implementation of Cg (version 2.0) supports Shader Model 4.0 hardware, makes this a wise choice (in my opinion) for the preferred shading language in COLLADA FX. This also means that unless you are a masochist, you will most likely provide your shader effects to your artists in the form of CgFX files (those using Maya and Max, anyway), since the ColladaMaya and ColladaMax plugins (also developed and maintained by Feeling Software) have native COLLADA FX support, and can import CgFX files directly into the applications.

Upon export, the CgFX effects are converted into COLLADA FX (much the same way that you can perform this conversion in nVidia's FX Composer), and it is that form that FCollada (and therefore OgreCollada) read the programmable effect. One problem with the current stock ColladaMaya and ColladaMax plugins is in how they handle <annotation> elements in COLLADA FX.

The reason this is a problem is that OgreCollada needs to have some way to tie uniform shader parameters to the Ogre named and named-auto parameters available; the COLLADA FX specification does not provide enough unique and standard information to allow this mapping without additional information embedded in the effect file. The solution in OgreCollada to support these mappings is to leverage the COLLADA FX <annotation> element, for use in providing those bindings in the shader source code. The following is excerpted from the Notes.txt file in the doc/ folder in the OgreCollada source root:

Mapping COLLADA FX uniform variables to Ogre named/named-auto params

To hook up named auto-params, use annotation named "param_named_auto" and the textual
auto-param type name as listed in the Ogre Manual:

<newparam sid="WVP">
    <annotate name="param_named_auto">
        <string>worldviewproj_matrix</string>
    </annotate>
    <semantic>WORLDVIEWPROJECTION</semantic>
    <float4x4>0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0</float4x4>
</newparam>


OgreCollada will match the parameter name in the newparam
sid to the Ogre param_named_auto provided as the string value in the "param_named_auto"
annotation. The newparam value (the <float4x4> element contents above) in this case is
ignored, as is the COLLADA FX <semantic> element.

To hook up named params, similar to above, except that

  1. the annotation name is "param_named"
  2. any value provided in the annotation is ignored by OgreCollada

<newparam sid="Kd">
    <annotate name="param_named">
        <string></string>
    </annotate>
    <float>1</float>
</newparam>


The named parameter type will be extracted from the <newparam> type. Any value in the
type element (the "1" in the <float> type element above, for example) will be used as a
default value.

For named params and named auto-params that are array values (such as a light position in
an array of N lights), append the Ogre auto-param type name with the object's array index.

<newparam sid="light0Pos">
    <annotate name="param_named_auto">
        <string>light_position/0</string>
    </annotate>
    <float3>0 0 0</float3>
</newparam>


The "/0" above indicates that this should be treated as the 0'th light in an array of N
lights. This is the same as providing an "extra_params" value to a named auto-param in an
Ogre material script.

Note that while this does place additional burden on the shader author, there really is no other way to leverage the wide variety of auto-parameters that Ogre provides to GPU programs.

The ColladaMaya and ColladaMax source code is provided in OgreCollada as modified versions of the base source available from Feeling Software, until I can make a patch for them that passes through all shader annotations unfiltered. Once that patch is available in the original versions distributed by Feeling Software, I will remove the altered versions from the OgreCollada source.

Multiple-Cg-profile support

The way that CgFX and .fx work is that each technique targets a single shader profile. Ogre, on the other hand, can check against a list of supported profiles. The design decision to provide this support in OgreCollada is to leverage the <shader>-element annotations to provide additional profiles to check. At present, however, FCollada does not track that information. Therefore, the COLLADA FX support in OgreCollada is limited to a single shader profile per technique, as in CgFX and .fx.

Using OgreCollada In Your Program

OgreCollada's public interface is very simple, by design. In short, you create an instance of the importer/exporter class, import or export a COLLADA document (which populates an Oge SceneManager instance you provide), and then optionally release the instance of the importer/exporter class you created. The following example shows how to import a COLLADA document into your Ogre application

Importing COLLADA documents
#include "OgreCollada.h"

using namespace OgreCollada;

int main(int argc, char* argv[])
{
    // assumes you have a pointer to valid Ogre::Root and Ogre::SceneManager instances
    ImpExp* pImpExp = CreateImpExp(pRoot, pSceneMgr); // you can also set these two values later
    pImpExp->importCollada(pDaeFilename);
    DestroyImpExp(pImpExp);

    return 0;
}


(edit by trs79, replaced ReleaseImpExp with DestroyImpExp)

The above code will load the contents of your COLLADA doc (whose name is contained in the string pointed to by pDaeFilename) into the Ogre scene managed by the SceneManager instance pointed to by pSceneMgr. OgreCollada will not clear your scene when importCollada is called; this allows you to import multiple documents into the same scene.

Each instance of the OgreCollada ImpExp object corresponds to one COLLADA document. An attempt to call importCollada a second time after a document has been loaded will cause the method to fail silently. If you need to load more than one document, make more than once instance of the ImpExp class.

Exporting COLLADA documents

There currently is no support for creating COLLADA documents from an Ogre scene. This is a possible feature for post-release, but for 1.0 there are no plans for converting an Ogre scene to COLLADA.

That said, you are perfectly able to alter a COLLADA document that you imported, and save out to COLLADA the altered version. In fact, that is what the IResourceNotification callback interface was created to support.

The reason that there is no inherent support for hooking up the Ogre objects created during import, to their corresponding FCollada objects, is twofold. First, the Ogre MovableObject "any" and "userDefinedObject" slots do not work that well with the naked pointers provided by FCollada. Second, it is entirely possible (even likely) that the user would want to use those slots for other purposes. For that reason, OgreCollada simply will call back into the calling code to let it know that something was created, and will also provide the code with the Ogre object created and the corresponding FCollada object, and let the code decide what it wants to do with that information.

If you want to alter the FCollada document based on changes in the Ogre application, it is up to you as the application developer to figure out how you want to track the relationships between the Ogre objects and their source FCollada objects, and how and when to update the FCollada document objects. Leveraging the IResourceNotification callback mechanism is the only way you will be notified of the creation of Ogre objects so that you can manage those Ogre/FCollada relationships. Note that if you plan to update the FCollada document in order to save an altered version, you need to include the proper FCollada headers. The FCollada API is documented in doxygen/HTML form in the FCollada/documentation directory.

TODO

Alpha

The final alpha release will be feature-complete. The following issues are still outstanding before that can happen:

  • Support for multi-pass programmable materials (not started; single-pass is complete)
  • Skeletal Animation support finished (in-progress)
  • Patch FCollada to support the way that SketchUp exports its scene graph (not started)
  • Patch ColladaMaya and ColladaMax to pass through all original parameter annotations (in-progress)

Beta

(no issues identified yet; depends on Alpha completion)

1.0

(no issues identified yet; depends on Beta completion)

1.1

  • Parse COLLADA Physics for the sole purpose of providing COLLADA Physics callbacks to the application


See also

<HR>
Creative Commons Copyright -- Some rights reserved.


THE WORK (AS DEFINED BELOW) IS PROVIDED UNDER THE TERMS OF THIS CREATIVE COMMONS PUBLIC LICENSE ("CCPL" OR "LICENSE"). THE WORK IS PROTECTED BY COPYRIGHT AND/OR OTHER APPLICABLE LAW. ANY USE OF THE WORK OTHER THAN AS AUTHORIZED UNDER THIS LICENSE OR COPYRIGHT LAW IS PROHIBITED.

BY EXERCISING ANY RIGHTS TO THE WORK PROVIDED HERE, YOU ACCEPT AND AGREE TO BE BOUND BY THE TERMS OF THIS LICENSE. THE LICENSOR GRANTS YOU THE RIGHTS CONTAINED HERE IN CONSIDERATION OF YOUR ACCEPTANCE OF SUCH TERMS AND CONDITIONS.

1. Definitions

  • "Collective Work" means a work, such as a periodical issue, anthology or encyclopedia, in which the Work in its entirety in unmodified form, along with a number of other contributions, constituting separate and independent works in themselves, are assembled into a collective whole. A work that constitutes a Collective Work will not be considered a Derivative Work (as defined below) for the purposes of this License.
  • "Derivative Work" means a work based upon the Work or upon the Work and other pre-existing works, such as a translation, musical arrangement, dramatization, fictionalization, motion picture version, sound recording, art reproduction, abridgment, condensation, or any other form in which the Work may be recast, transformed, or adapted, except that a work that constitutes a Collective Work will not be considered a Derivative Work for the purpose of this License. For the avoidance of doubt, where the Work is a musical composition or sound recording, the synchronization of the Work in timed-relation with a moving image ("synching") will be considered a Derivative Work for the purpose of this License.
  • "Licensor" means the individual or entity that offers the Work under the terms of this License.
  • "Original Author" means the individual or entity who created the Work.
  • "Work" means the copyrightable work of authorship offered under the terms of this License.
  • "You" means an individual or entity exercising rights under this License who has not previously violated the terms of this License with respect to the Work, or who has received express permission from the Licensor to exercise rights under this License despite a previous violation.
  • "License Elements" means the following high-level license attributes as selected by Licensor and indicated in the title of this License: Attribution, ShareAlike.

2. Fair Use Rights

Nothing in this license is intended to reduce, limit, or restrict any rights arising from fair use, first sale or other limitations on the exclusive rights of the copyright owner under copyright law or other applicable laws.

3. License Grant

Subject to the terms and conditions of this License, Licensor hereby grants You a worldwide, royalty-free, non-exclusive, perpetual (for the duration of the applicable copyright) license to exercise the rights in the Work as stated below:

  • to reproduce the Work, to incorporate the Work into one or more Collective Works, and to reproduce the Work as incorporated in the Collective Works;
  • to create and reproduce Derivative Works;
  • to distribute copies or phonorecords of, display publicly, perform publicly, and perform publicly by means of a digital audio transmission the Work including as incorporated in Collective Works;
  • to distribute copies or phonorecords of, display publicly, perform publicly, and perform publicly by means of a digital audio transmission Derivative Works.
  • For the avoidance of doubt, where the work is a musical composition:
    • Performance Royalties Under Blanket Licenses. Licensor waives the exclusive right to collect, whether individually or via a performance rights society (e.g. ASCAP, BMI, SESAC), royalties for the public performance or public digital performance (e.g. webcast) of the Work.
    • Mechanical Rights and Statutory Royalties. Licensor waives the exclusive right to collect, whether individually or via a music rights society or designated agent (e.g. Harry Fox Agency), royalties for any phonorecord You create from the Work ("cover version") and distribute, subject to the compulsory license created by 17 USC Section 115 of the US Copyright Act (or the equivalent in other jurisdictions).
    • Webcasting Rights and Statutory Royalties. For the avoidance of doubt, where the Work is a sound recording, Licensor waives the exclusive right to collect, whether individually or via a performance-rights society (e.g. SoundExchange), royalties for the public digital performance (e.g. webcast) of the Work, subject to the compulsory license created by 17 USC Section 114 of the US Copyright Act (or the equivalent in other jurisdictions).


The above rights may be exercised in all media and formats whether now known or hereafter devised. The above rights include the right to make such modifications as are technically necessary to exercise the rights in other media and formats. All rights not expressly granted by Licensor are hereby reserved.

4. Restrictions

The license granted in Section 3 above is expressly made subject to and limited by the following restrictions:

  • You may distribute, publicly display, publicly perform, or publicly digitally perform the Work only under the terms of this License, and You must include a copy of, or the Uniform Resource Identifier for, this License with every copy or phonorecord of the Work You distribute, publicly display, publicly perform, or publicly digitally perform. You may not offer or impose any terms on the Work that alter or restrict the terms of this License or the recipients' exercise of the rights granted hereunder. You may not sublicense the Work. You must keep intact all notices that refer to this License and to the disclaimer of warranties. You may not distribute, publicly display, publicly perform, or publicly digitally perform the Work with any technological measures that control access or use of the Work in a manner inconsistent with the terms of this License Agreement. The above applies to the Work as incorporated in a Collective Work, but this does not require the Collective Work apart from the Work itself to be made subject to the terms of this License. If You create a Collective Work, upon notice from any Licensor You must, to the extent practicable, remove from the Collective Work any credit as required by clause 4(c), as requested. If You create a Derivative Work, upon notice from any Licensor You must, to the extent practicable, remove from the Derivative Work any credit as required by clause 4(c), as requested.
  • You may distribute, publicly display, publicly perform, or publicly digitally perform a Derivative Work only under the terms of this License, a later version of this License with the same License Elements as this License, or a Creative Commons iCommons license that contains the same License Elements as this License (e.g. Attribution-ShareAlike 2.5 Japan). You must include a copy of, or the Uniform Resource Identifier for, this License or other license specified in the previous sentence with every copy or phonorecord of each Derivative Work You distribute, publicly display, publicly perform, or publicly digitally perform. You may not offer or impose any terms on the Derivative Works that alter or restrict the terms of this License or the recipients' exercise of the rights granted hereunder, and You must keep intact all notices that refer to this License and to the disclaimer of warranties. You may not distribute, publicly display, publicly perform, or publicly digitally perform the Derivative Work with any technological measures that control access or use of the Work in a manner inconsistent with the terms of this License Agreement. The above applies to the Derivative Work as incorporated in a Collective Work, but this does not require the Collective Work apart from the Derivative Work itself to be made subject to the terms of this License.
  • If you distribute, publicly display, publicly perform, or publicly digitally perform the Work or any Derivative Works or Collective Works, You must keep intact all copyright notices for the Work and provide, reasonable to the medium or means You are utilizing: (i) the name of the Original Author (or pseudonym, if applicable) if supplied, and/or (ii) if the Original Author and/or Licensor designate another party or parties (e.g. a sponsor institute, publishing entity, journal) for attribution in Licensor's copyright notice, terms of service or by other reasonable means, the name of such party or parties; the title of the Work if supplied; to the extent reasonably practicable, the Uniform Resource Identifier, if any, that Licensor specifies to be associated with the Work, unless such URI does not refer to the copyright notice or licensing information for the Work; and in the case of a Derivative Work, a credit identifying the use of the Work in the Derivative Work (e.g., "French translation of the Work by Original Author," or "Screenplay based on original Work by Original Author"). Such credit may be implemented in any reasonable manner; provided, however, that in the case of a Derivative Work or Collective Work, at a minimum such credit will appear where any other comparable authorship credit appears and in a manner at least as prominent as such other comparable authorship credit.

5. Representations, Warranties and Disclaimer

UNLESS OTHERWISE AGREED TO BY THE PARTIES IN WRITING, LICENSOR OFFERS THE WORK AS-IS AND MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND CONCERNING THE MATERIALS, EXPRESS, IMPLIED, STATUTORY OR OTHERWISE, INCLUDING, WITHOUT LIMITATION, WARRANTIES OF TITLE, MERCHANTIBILITY, FITNESS FOR A PARTICULAR PURPOSE, NONINFRINGEMENT, OR THE ABSENCE OF LATENT OR OTHER DEFECTS, ACCURACY, OR THE PRESENCE OF ABSENCE OF ERRORS, WHETHER OR NOT DISCOVERABLE. SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OF IMPLIED WARRANTIES, SO SUCH EXCLUSION MAY NOT APPLY TO YOU.

6. Limitation on Liability.

EXCEPT TO THE EXTENT REQUIRED BY APPLICABLE LAW, IN NO EVENT WILL LICENSOR BE LIABLE TO YOU ON ANY LEGAL THEORY FOR ANY SPECIAL, INCIDENTAL, CONSEQUENTIAL, PUNITIVE OR EXEMPLARY DAMAGES ARISING OUT OF THIS LICENSE OR THE USE OF THE WORK, EVEN IF LICENSOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.

7. Termination

  • This License and the rights granted hereunder will terminate automatically upon any breach by You of the terms of this License. Individuals or entities who have received Derivative Works or Collective Works from You under this License, however, will not have their licenses terminated provided such individuals or entities remain in full compliance with those licenses. Sections 1, 2, 5, 6, 7, and 8 will survive any termination of this License.
  • Subject to the above terms and conditions, the license granted here is perpetual (for the duration of the applicable copyright in the Work). Notwithstanding the above, Licensor reserves the right to release the Work under different license terms or to stop distributing the Work at any time; provided, however that any such election will not serve to withdraw this License (or any other license that has been, or is required to be, granted under the terms of this License), and this License will continue in full force and effect unless terminated as stated above.

8. Miscellaneous

  • Each time You distribute or publicly digitally perform the Work or a Collective Work, the Licensor offers to the recipient a license to the Work on the same terms and conditions as the license granted to You under this License.
  • Each time You distribute or publicly digitally perform a Derivative Work, Licensor offers to the recipient a license to the original Work on the same terms and conditions as the license granted to You under this License.
  • If any provision of this License is invalid or unenforceable under applicable law, it shall not affect the validity or enforceability of the remainder of the terms of this License, and without further action by the parties to this agreement, such provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable.
  • No term or provision of this License shall be deemed waived and no breach consented to unless such waiver or consent shall be in writing and signed by the party to be charged with such waiver or consent.
  • This License constitutes the entire agreement between the parties with respect to the Work licensed here. There are no understandings, agreements or representations with respect to the Work not specified here. Licensor shall not be bound by any additional provisions that may appear in any communication from You. This License may not be modified without the mutual written agreement of the Licensor and You.