SlimDX ColladaLoader library


requirements | information | limitations | downloads | sourcecode | tracker | forum

 

Features:

  • C# Library to load and display Collada 3D files (.DAE) in DirectX 10 using SlimDX
  • Open source, free to use and modify
  • Integrates seamlessly with SlimDX (Feb. 2010 release) sample framework.
  • Loads multiple static meshes from collada files, currently supporting only 1 texture per submesh
  • Shader driven Managed DirectX 10 code, clean, easily portable
  • Partially implemented ability to load and display Microsoft’s .X file format (still buggy)

Requires:

  • SlimDX (latest release; currently February 2010)
  • Visual Studio 2008 or 2010 (you might get away with SharpDevelop also if you like free software)
  • .NET Framework (2.0+ required for SlimDX SDK)
  • Microsoft Direct X 10 SDK (latest release; currently February 2010)
NOTE: this version does NOT support Skeletal animation/vertex blending/skinning or animation as Benjamin’s original code did. The purpose of this sample is demonstrating how to load a mesh in SlimDX 10, not animate it. I am planning to implement basic animation and skinning at a later time though.

Project SlimDX ColladaLoader

The ColladaLoader project is based upon code written by Benjamin Nitschke, more specifically his blogpost about Skinning with Collada models in XNA . As his Collada parsing code was written in C#, it was the perfect base for my Managed DirectX 10 project using the SlimDX sdk. Benjamin has written a very nice series of articles for developers on using XNA and Collada, so make sure you check out his website. What I did was mainly remove all XNA related code, replaced it with DirectX 10 functions from the SlimDX SDK, and I also disabled most of his Bone and Skinning related code, so now it only loads a static model. I left in most of the original code, so someone who is interested can easily fix it. I also restructured the code to make it fit into a nice standalone package that would integrate easily with the SlimDX SDK. In a nutshell, I reused most of Benjamin’s Collada parsing code, although I also tampered with that a bit in the hopes to make it a bit more compatible with different exporters.

Project Background

For my thesis I wrote a managed Direct X 9 library in C# that could display and animate skinned 3D models that were exported in Blender. We used the .X file format for this. About one year later, the same company where I did my internship for my thesis asked me to develop the same, but this time using Direct X 10, as their new graphics engine was a complete rewrite, using .NET 4.0, Direct X 10 and the SlimDX SDK (since there is no such thing as managed Direct X 10). We decided upon using the Collada file format for this, as it is a widely used and well documented digital asset exchange format (hence Collada .DAE files). Also because there is a lot of support in the open source community for this format and a lot of popular exporters support it.

I decided to keep the colladaloader a clean separate library that wasn’t connected to the rest of the companies engine, so it could be shared with the open source community, as its only fair to give back to the ones who inspired me in the first place.

This in a nutshell is how the colladaloader library was born. Now again one year later after the initial development of the colladaloader lib, I’ve been cleaning up the code for release as a sample. Please do note it is far from a finished library and should only be used as a sample to start your own development. A lot of my code is not clean and inefficient, though it works and shows how to get things done.

Project Limitations

Being an unfinished sample, this project has some limitations you have to take into account:

  • This is not a universal collada loader that will parse every single format of collada file available. This is simply impossibly as there are too many different plugin output formats and no uniform standards. Some exporters will export incorrect or incomplete information, or even addition tags. So in conclusion: you will need to adapt this code sample to your export plugin, the tools you use, and the features you need. It has been tested with the output plugin that is included with Blender 2.4x and some other random Collada files, some worked, some didn’t.
  • The sample is limited in the number of meshes, textures per mesh, bones per vertex etc it can load. If you’re writing a professional renderer, this sample will need a lot of work before its production ready.
  • This is a sample open source project developed and maintained mainly in my spare time, not a commercial solution, therefore prone to errors, and not optimized for real life situations.
  • In a large scale project, the renderer would optimize things by sorting the meshes by the shader they use for optimal performance. This sample project switches between shader (and render states) for every submesh, losing performance unnecessary. Though with current hardware it is more than useable for smaller projects.
  • A professional game engine would probably use a binary file format instead of plain text collada files, which would improve storage and loading times. Also models and other resources should be organized in a folder or tree like structure, instead of throwing all files in 1 big dump folder.

There might be some overflow issues as well as memory cleanup and range/error checking issues in the code. The small things I haven’t had the time to look for yet. Also the code could use some cleaning up aswel as most of the comments should be reviewed.

Project Files and Documentation

Tutorial: How to use the SlimDX ColladaLoader
Readme:SlimDX-ColladaLoader-SimpleCollada10-readme.txt
SlimDX ColladaLoader library 1.0 (beta)

SlimDX ColladaLoader tutorial sample

All project related downloads can also be found at :
https://sourceforge.net/projects/slimdxcollada/files/

Project Forum and Feedback

All project related questions can be posted in the appropriate forum.
Feel free to ask any questions or give feedback on the project there.
If you want to ask me a question in private you can use the contact form.

You can also use the projects tracker hosted on Sourceforge.net to submit bugs and feature requests. Please note you can only submit to the tracker system when you have a Sourceforge account (this is because we want to keep our database clean). If you want to post an anonymous question, please use the forums or the contact form.

Project Source Code and Subversion Access

You can check out an anonymous copy of the source code with the following subversion command:

svn co https://slimdxcollada.svn.sourceforge.net/svnroot/slimdxcollada slimdxcollada

or browse the repository online. If you want to contribute to the code, you'll have to register as a project developer first through the projects sourceforge page.

Rating

Content Type: Library, Sample, Tutorial

Content Tags: .NET, 3D, Computer Graphics, CSharp, Development, DirectX, SlimDX

Average: 5 (10 votes)

Comments

Add a comment

The content of this field is kept private and will not be shown publicly.
  • Lines and paragraphs break automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <pre>
  • Email addresses will be obfuscated in the page source to reduce the chances of being harvested by spammers.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Syntax highlight code surrounded by the <pre class="brush: lang">...</pre> tags, where lang is one of the following language brushes: as3, csharp, css, delphi, jscript, php, xml.

More information about formatting options

Enter the code Image CAPTCHA : *