Some time has passed since I last wrote an entry in this blog. I was busy at university, finishing my bachelor’s degree and the corresponding thesis, which just today I have defended.
With all this liabilities gone I finally found the time to port my library to XNA 4.0, which to my suprise went relatively smoothly, thanks to dozens of developers who already dealt with it and shared their experiences on the XNA forums and in their blogs (Also I must admit that even though many breaking changes were made, most of them were for the better).
As a result I created two new XNA 4 libraries, which now can be downloaded from the Codeplex project (http://omixna.codeplex.com/).
The importer library imports and processes COLLADA .dae files and creates binary XNB files from them. During this process HLSL shaders are generated to fit the material definitions supporting basic phong materials and three normal mapping techniques (Dot3 Bump Mapping, Parallax Mapping, and Relief Mapping). The library still lacks support for custom shaders defined in the COLLADA file (through the BRIDGE profile). However, this is very easily added and is next on my todo list.
The Collada Model library contains the deserializer classes for loading Collada models processed by the collada importer/processor. Furthermore it offers complete access to all of the model’s data, as well as two classes for static (not animated) models and animated models (using skinned mesh animation, a.k.a. skeletal animation).
That means I’m using my own Model class for drawing the 3D models. Right after support for custom shaders I want to add a possibility to create standard XNA models from them, so they can be used with tools or engines which rely on them, such as SunBurn for XNA.
The great thing about this is that now I can simply add .dae files to my content project and load, display and animate the models with no more than four lines of code:
// Loading via Content Pipeline (during LoadContent call) ModelData modelData = Content.Load<ModelData>("marcus_animated"); var model = new SoftwareSkinnedModel(modelData); // Rendering the model (during Draw call) model.Draw(world, view, projection); // Animating the model (during Update call) model.PlayFirstAnimation(gameTime.ElapsedGameTime.Milliseconds / 1000.0f);
First thing I did after porting to XNA 4.0 was testing the library with some models from various sources. Even though the library does not yet support all COLLADA files it worked with models exported from Spore (the PC game), most Google Earth / Sketch Up models and animated models from 3ds max.
In the near future I’d like to create an open-source project from my libraries in hope that they get improved by the developer community for the sake of all XNA developers. However, there’s some dirty code still left to be cleaned up. Also the data was extracted from the XML not very elegantly. Luckily the design allows for easily exchanging sinlge parts, such as the classes that extract data from the XML (such as geometry, animation etc.).
Since now I’m in the middle of the semester break I will surely have time to do this before April.
Feature-wise support for B-reps is on my todo list, too. Even though right now a bounding-box that encompasses the complete model is automatically generated the possibility to define your own bounding representations in the DCC tool of your choice is intriguing.
Also right now the skinned mesh animation is implemented only on the CPU-side, i.e. dynamic vertex buffers are used and animation calculations are executed on the CPU. Hardware accelerated animation would be nice, however, I’m not sure whether it’s possible to combine external (unknown) shaders (defined in the COLLADA file) with my own vertex shader that performs the actual animation. If it’s not possible I guess this will only be possible with standard materials based on COLLADA’s common profile.
The libraries now have been published at codeplex.com: http://omixna.codeplex.com/
The importer itself moved to GitHub: https://github.com/Bunkerbewohner/ColladaXna/wiki
You have done great job Mathias….
Is your Collada Importer support Geometry approsimation…
Is there any way to download your Collada Importer
I already created a project over at Codeplex.com, but have not yet made it public. I will do this within the next few days.
The importer does nothing like geometry approximation, it just loads triangle based meshes from the COLLADA file for geometry. Other polygonal representations can be converted to triangles using COLLADA Refinery.
NURBs and other representations are not supported right now.
Looking forward to your codeplex project.