![]()
![]()
| Presentation | Features | Screenshots / Tutorials | License | References / Downloads |
![]()
I'm proud to present this great project !
This project was starten as a set of 3D model loaders for Java/OpenGL. Then, it
become a bigger project and is now a Model API to load, manage and renderer 3D
models. JOGL, LWJGL and GL4JAVA are supported for the 3D rendering. 3D model format supported are the more common
format used in 3D applications/games: 3DS, LWO, OBJ, ASE, AC3D, MD2, MD3, MD5, .
For the full detailled list, see the feature
page.
Welcome & enjoy this great project !
![]()
Here is the list of model loaders currently supported. All the following loaders are written with the best respect of the model for format, all advanced features of the models are supported.
3DS Support all advanced features
of the 3ds format : materials (details presented for ASE
format), mesh with per face
material, hierarchical models and animations.
Camera and light datas are skipped but they can be easily read.
AC3D Support advanced features
like material & hierarchical models.
GL_LINE_*** objects are considered as GL_TRIANGLE.
ASE Support
material such as ambient/diffuse/specular/shininess & diffuse/bump/reflection
map reading (some material properties are only enabled with shaders), hierarchical models,
mesh with per face material.
Normals seems to be store in a crazy way (sometimes inverted, sometime not
...), so I skip them for the moment ...
LWO Animation is not yet supported.
COLLADA/DAE Basic support, will improve next release
MD2 Based on GameTutorial's MD2 loader
MD3 Based on GameTutorial's MD3 loader, with some changes : process texture file name from md3 file, added the ability to select the model quality & skin.
MD5 Support animation
Need some internal changes on how to store md5 animation.
MDL [MAY BE ?]
OBJ Support advanced features of the format : material library (MTL file), polygon face ie more than 3 vertices (ie f v1/t1/n1 v2/t2/n2 v3/t3/n3 v4/t4/n4 ... with or withour /ti, /ni) & per face material.
MS3D Support all the features of the binary format, including skinning/skeleton animation.
JMF/JMA Format created for this java model loader API for easy reading and writting. All previous formats can be converted easily to these formats.
General features supported :
Hierarchy meshes hierarchy from model file.
Animation animation from the model file, if any.
Lighting per face, per vertex or per pixel normal (per pixel normal are available if the graphic card support shaders).
Material
ambient/diffuse/specular/diffuse/emission colors, specular/shininess, transparency and
diffuse map.
Reflection/Refraction are not (yet) supported.
Render accelerated
rendering via Display Lists and Vertex Buffered Objects (VBO). Space
partitioning in octree is supported via different algorithms. This technique can
be associated with a view frustum check to select meshes in visible octrees for
rendering.
All this techniques can highly speed-up the rendering.
Shader support of GLSL
shader language, they are used for implementing advanced rendering
techniques such as per pixel lighting, normal mapping and displacement mapping
related techniques (such as parallax,
steep parallax, relief mapping, iterative parallax mapping). Look at
Project 4: Shaders for more informations.
This feature requieres specific hardware, ie depends on the graphic card
capabilities. The most advanced shaders needs a graphic card with Pixel Shader
3.0.
This part will describe briefly the features
supported by the API.
Each features are introduced with some screenshots from the Model Viewer
application. All the features are available via the Model API, even all the
shader stuff.
I've written the most intuitive/simplest GUI I
can.
Model selector
Here is the GUI for importing models and choosing options (texture, animation, lighting, space partitioning ...) :

Model selector GUI

Demo GUI
Main GUI
Here is a screenshot displaying model info, the mesh tree and material list, the
bounding box and the 3D model :

Model Viewer GUI
By a double clic on an item on the tree, the
appropriate dialog opens and
displays object's properties.
Most properties are editable at realtime (ie new value take effect while
editing) !

Model properties
The model dialog show the root meshes and it associated
sub-models.

Mesh properties->Geometry
The geometry tab allow to select the vertice/texture
coordinate/normal/face and display the datas in an editable table.
Also, notice how the bounding box fit perfectly into the display area.

Mesh properties->Material
The Material tab display all material used by the
mesh. By selecting a material, the material properties dialog appears and
displays all materials properties (can be
opened directly into the tree). Those
parameters are editable in realtime.

Mesh properties->UV
The UV tab display the list of texture map used by the
mesh, textures are displayed with the associated texture coordinates of the mesh's faces.

Face/Texture coordinate selection
Texture coordinates can be modified by picking either
a face (clic on a line) or just a texture coordinate (clic on a triangle vertex,
notice the small square).
When a face is selected, it is highlighted in red. When a texture coordinate is
selected, the face and the texture coordinate are highlighted, also in red.

Face/Texture coordinate modification
By dragging the mouse, the selected item (face or texture coordinate) is moved with the mouse. The result is displayed at the same time on the model rendered in the main window.
Display menu allow to choose how the model is rendered.
The picture above show a model drawn with transparent bounding boxes outlined (a
bounding box per mesh).
An example of the whole model bounding box is shown in the jeep screenshot above
(picture
Mesh properties->UV).
When the model is animated, bounding boxes are updated with the
mesh.
Animation are supported for 3DS/MD2/MD3/MD5 model formats
(and JMF/JMA).
When an animation is found, the animation controls panel is displayed. This
panel display a slider for each model/sub-model's animation found.

Animation controls

Animation controls (2)
MD5 animation is a skelton based animation. At each frame, the
mesh is updated with the new skeleton. The skeleton and the mesh is updated
internaly, but skeleton datas is exposed and so can be rendered.
The next screenshot shows a md5 animated model blended over his skeleton.
An heightmap is a picture representation of terrain. Each
picture pixel correspond to a terrain vertice, pixel color is considered as the
terrain height.
The heightmap loaded is then converted to a model and can be displayed like previous
models.
Here is the heightmap created in project 2 displayed
with a green material :

Heightmap created in Project 2
It can be usefull to manipulate the model. Thats why I've
written a camera for this purpose.
Here are the keys for manipulating the model with the mouse :
Left button : move up/down wards to rotate the model along x axis
Left button : move left/right to rotate the model along y axis
Shift + Left button : move left/right to rotate the model along z axis
Right button : move up/down wards for zooming (move the model along z axis)
Left + Right buttons : move the model with the mouse
The View menu have shortcuts to either fit the model to the window :

View->Adjust view
Note: The adjustment is made
without taking into account the x/z rotation of the model, only rotation taking
into account for now is the y axis. In the
above picture, the model was rotated along x axis. That's why a little part of
the model bounding box is out of the window. The camera/manipulator will be improved to take the
all rotations into account when calculating
camera position.
or to move to model center (bounding box center) :

View->Move to center
Note: With the VBO renderer, the
fps goes from 8 to 76 for rendering the above scene composed of half million
vertices (max FPS is blocked to 76).
Note (2): few objects seem to be badly positionned, I've passed long time
to figure out where this come from with no good results.
For small objects, the model bounding box is sufficient to
determinate if it should be rendered or not. For large models like the scene
displayed above, using the whole model bounding box will not be performent.
A little better way is to check, for each model/mesh their bounding box
visibility and render only visible objects. This way can be sufficient for model
which already have mesh subdivisions.
For model with a huge mesh, it should be better to split it in smaller meshes.
The following example shows model partitionning in small octrees. The visibility
of each octree is easy to determined with the camera frustum (to cull vertices
outside the camera volume).

Octree partitionning of a model
for frustum culling
For model with lots of meshes, especially tiny meshes, the best
is first to reorganize all the meshes in a new hierarchy which place a mesh in
the accurate node according to its space, then to split the mesh depending on
the criteria of maximum number of faces par octree.
The following screenshot show the old mesh organization and the new mesh organization
with mesh partitioning (notice that the tree are ).
Mesh named 'Octree[x][y]...' correspond to a volume of the whole model
space. Meshes inside this node are contained in the node volume. In particular
case, the mesh can intersect two volumes. In this case, the mesh is split
(depending on max face criteria), the octree id is append at the end of the mesh
name to identify more easily which part of the mesh we reference to.

Octree hierarchy & Mesh partitioning
The picking piped rendered allow to pick easily a mesh on the model. Two kind of events are processed:
A simple click will display the mesh allong its bounding box. Do de-select it, just click somewhere there is no mesh.
A double click will select the mesh and opens the associated dialog (usefull to show its properties).

Mesh picking
To implements some advanced rendering mapping
techniques such as per-pixel based rendering techniques (normal/bump mapping
...), I've added the ability to use shaders. Shaders are 'small' program
executed directly in the GPU. With shaders, we have the possibility to program
the OpenGL pipeline with our own light model, mapping, shadowing ...
Shaders implemented here are GLSL shaders
(OpenGl Shading Language) and Cg.
In the tree, there is a new list for shaders. Its associated editor is design for :
Display vertex/fragment code
Edit vertex/fragment code
Compil the shader
Preview the result on a teapot (and on the model).
Here is a screenshot of the basic shader editor, it supports both GLSL and Cg shaders :

Shader editor
This page is quite long, so I've moved all the shader section in Project 4.
Visit this project to know more about the abilities of this API. All the shader
presented are integrated in the Model API.
There are lof of impressive screenshots !
Anyway, here are few screenshots here :)

Opacity, Normal & Reflection mapping

Iterative Parallax Mapping
Model/Mesh/Material/Shader objects can be copied or cutted and then pasted in
the current model or in a model opened in a different viewer instance.
Here is a screenshot showing a copy/paste operation for adding a
You've remarked that lot of thing are editable in this model viewer gui.
But what use if we can't save and reload the modified model ?
No problem, an importer/exporter is just added. You can now save any models,
modified or unmodified, and then reload them later.
The only format implemented for the moment is a specifical format created for
the model loader api. This format is easily readeable and writeable using the
java model loader api (which is available in download
section).
Here is what is saved :
All model structure hierarchy, including sub models
All mesh : vertice, texture coordinates, normals, faces
All animations : animation, animation frames, animation state ...
All materials informations and textures (textures are saved in their original format).
Rendering properties light lighting, back culling, ...
The uncompressed format stores the model and dependency files (textures ..) in
the same output directory. The compressed version of the format stores the model
and all dependency files (textures ..) in a zip format. The advantage of the
compressed version is that space is saved and we are sure that all dependency
files will be found at next loading.
In summary, all is saved except shader related properties. I don't know if it is
pertinant to saved them ?
This feature can be easily added, if needed.
![]()
![]()
| This page was updated on 04/08/2009 | |
| © Copyright 2004-2008 Jérôme JOUVIE (Jouvieje) - All rights reserved. | http://jerome.jouvie.free.fr/ |