Importing .OBJ, .MD2 and .3DS into SceneJS
I’ve made three new plugins for SceneJS, to import mesh geometry from these file formats:
OBJ - a lightweight geometry definition file format first developed by Wavefront Technologies which contains mesh data — namely, the position of each vertex, the UV position of each texture coordinate vertex, normals, and the faces that make each polygon defined as a list of vertices, and texture vertices.
MD2 - a model format used by id Software’s id Tech 2 engine in games such as Quake II and Soldier of Fortune. This format is primarily used for animated player models and uses keyframes for mesh positions, which SceneJS interpolates within a vertex shader to create smooth animation.
3DS - one of the file formats used by the Autodesk 3ds Max 3D modeling, animation and rendering software. This format has become a de facto industry standard for transferring models between 3D programs, or for storing models for 3D resource catalogs.
|Run .OBJ demo||Run .MD2 demo||Run .3DS demo|
The plugins provide new scene node types, and like all plugins, are automatically loaded into the engine as you need them.
As usual, we’ll start by pointing SceneJS at where you keep your plugins:
..then importing an .OBJ is as easy as:
Importing meshes from the other formats is similar. To import .MD2, your node would be:
And to import .3DS:
Shouts out to:
- K3D.JS - SceneJS uses this library for parsing. It’s nice and fast because it loads the
files into typed arrays, which it then parses.
sudo comments powered by Disqus