Meshellator is an open source 3D asset import library, available for both .NET 4.0 and Silverlight 4.0. Meshellator is the underlying library for the 3DS, OBJ and NFF content importers for XNA which I have mentioned previously.
Supported file formats are quite limited at the moment. If anybody wants to contribute more, please feel free!
As well as importing meshes from a file, Meshellator also allows you to create meshes from primitive shapes:
Meshellator is quite easy to use. After you’ve added a reference to
Meshellator.Silverlight.dll), the following line is enough to load from a file into a
Scene object. The
Scene object contains collections for meshes and materials, and should be quite intuitive to navigate.
Scene scene = MeshellatorLoader.ImportFromFile("85-nissan-fairlady.3ds");
Loading one of the built-in primitive shapes is just as easy. Each of the primitive shape methods have some parameters for size and tessellation level.
Scene scene = MeshellatorLoader.CreateFromTeapot(10, 20);
Given that there’s several open source asset import libraries already - in particular Open Asset Import Library (or Assimp) - why make another one? Good question - if you’re working purely on Windows, and don’t mind a bit of interop into native code, then Assimp is indeed the solution I’d recommend. It’s mature, well supported, and supports a whole host of formats.
Meshellator, on the other hand, is new and only supports 2 or 3 file formats at the moment. However, I believe it has a useful place in the .NET ecosystem, as the first (as far as I know) fully managed open source asset import library. Because it’s fully managed, it also works on Silverlight.
You can browse the Meshellator source code here, and you can download the binaries from two places:
The source code (but not the binary downloads) includes a viewer application.
The viewer application is not developed enough to be that useful, but it may be of technical interest - it combines AvalonDock, FluentRibbon and SlimDX in a WPF MVVM application based on Caliburn. As a historical aside, this viewer application is what eventually became XBuilder, after I realised that the world didn’t need another general-purpose model viewer, and the “model viewer as a Visual Studio extension” niche was more interesting.