Sunday, March 18, 2007

Back from GDC and Maya Exporter

Oh yeah, finally back from the 2007 GDC held in San Francisco. It's been great except for the travel part...but the story is far too long for me to tell. Got sick because of it too...

So with all of this I hadn't much time to update this blog. Now here's a quick update, my Maya model exporter is working.

Yeah I decided to switch to Maya since I didn't have the 3dsmax SDK and was using MaxScripts which kinda sucked for this. On a side note, I like the Maya API, but it is not so much simpler to export a hardware friendly mesh than it is using Max.

Most 3d authoring softwares uses different arrays for the vertices' positions, normals, colors, texture coordinates... so you got to somehow re-create your own vertex array and dupplicate the vertices based on cuts in the lighting, coloring or texturing. The best example is a cube where you want to have some kind of flat shading on all the faces. So the way those are represented in 3d editing softs most of the time is by 8 vertices and 24 normals. If the cube was "smoothly" shaded, there would have been only 8 normals also. So what you got to do is to match each normal with each vertex and dupplicate them when needed. And you got to do this as well for colors and texture coordinates...that is if you want your artists to see exactly the same result in your engine.

On top of that, Maya lets you have non-coplanar polygons and each polygon can have more than 3 vertices so you somehow need to triangulate the mesh as well. After a bit of grunt work, I finally came up with a lightning fast exporter.

I still need to extract all the skinning information like the weights and bone indices per vertex and the hierarchy itself, this will be further down the road as for now I'm just focusing on loading my data and having some kind of world rendered on screen in my XNA C# engine.

No comments: