Icefox's picture

General-purpose mesh loader --where to go next?

Okay, so I'm working on the Meshomatic project (http://www.opentk.com/project/Meshomatic), which is hopefully going to be useful to someone out there as a general .NET mesh file loader. I actually bothered to get it into a usable state last weekend, and it successfully loads and textures .obj and .ms3d files and generally has an API that I'm okay with.

However, I'm not really a guru in the field of 3d art and programming, so I ask those out there, what else should this library do? Collada file support was on the list of things I wanted at the beginning, but right now Meshomatic only loads geometry, while Collada can hold scene data, lighting, shaders, skeletons and so on. Would it still be worth it to only load geometry out of these?

So... main feedback I suppose I'm looking for:

  1. File formats. It loads .obj and Milkshape, what else would be most useful? Collada? Lightwave?
  2. Features. Are materials worth loading? Most games I've seen use textures to define specularity and such, rather than materials. What about skeletons? Problem here is that, for instance, .obj does not include skeleton or animation data. So what's the common subset of features that most people want? It's rough in general because I either have to implement a million features slightly differently, or only implement some features that are most commonly shared, or try to find some vague middle ground in a field I'm not an expert in. It might honestly be best to remove any common format from the thing, and instead just have a collection of entirely separate loaders in one package.

Thoughts?


Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Hortus Longus's picture

Hi, Icefox.

For my own projects I have been wandered over to a format such as Cal3D (http://home.gna.org/cal3d/), because I can use it with my favorite 3D-tools (Blender and 3DSMax), perhaps you will have a look? I think, this format has all what you are searching for. Perhaps. :-)

Can I have a short word (not criticism)?
After looking a short view in you code (not tested yet) I have seen a point of danger (so far as I know), if you are using a statement like this:

 using(FileStream s = File.Open(file, FileMode.Open)) {
				...
				s.Close();
				return mesh;
			} // X 

There is no need for "s.Close();" because at the point "}" (where I have written // X) NET is including a call to close (and also dispose).
Normally this does not make anything, but if you use several files at the same time, this can lead too much irritating behavior (crash included). Ok?

Icefox's picture

Thanks for the advice. I'm honestly still a relative noob at C# I'm afraid; it appears I need to work on my best practices.

I'll take a look at Cal3D. I'm really not entirely sure WHAT I'm searching for yet, but it looks like something that could be worth including.

Acedia's picture

This is exactly something that I was looking for. However suport for .X files, and .FBX files would be awesome. I know that the .fbx files might prove a pain, but support for .x would be awesome. I'm currently porting a game engine from Xna to OpenGL. This is still a closed project, and i'm not really inclined to talk about it much, however if you could provide support for atleast .x, and collada would be awseome. Thanks for doing this.

As for your delema about loading Materials, Skeletons, etc. I would suggest at first, just loading the actual model data, for each file type you want to support. Then after your supported model loaders work, then start adding the Features like Skeletons, Materials, and other file specific features. Animations would be a plus, however not really needed at the moment.

Icefox's picture

Looks like Collada and .X are next on the list then, after which I start working on skeletons and such. Cal3D may get added as well, I'm not sure yet. Unfortunately from what I've seen of how the licensing for .FBX works, "a pain" is putting it mildly, but I'll put it on the to-do list.