Project 3 : Java Model Viewer &
Java Model Loader/Renderer/Exporter API
for JOGL, LWJGL and GL4JAVA

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.

General features supported :

 

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.
 

Here is the GUI for importing models and choosing options (texture, animation, lighting, space partitioning ...) :


Model selector GUI


Demo 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.


Rendering properties

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.


Skeleton animation

 

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 :

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:


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 :

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 :

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.
 

 

Back

Features

This page was updated on 04/08/2009
© Copyright 2004-2008 Jérôme JOUVIE (Jouvieje) - All rights reserved. http://jerome.jouvie.free.fr/