cmodview: 3D mesh file utility for Celestia
Posted: 24.02.2010, 08:43
Cmodview is a graphical utility designed to help out Celestia add-on creators
who are working with 3D meshes. It can be used to inspect, optimize, and convert
meshes. Cmodview has basic material editing capabilities which can be used to change
textures and colors of mesh elements.
Prebuilt versions are available for Mac OS X and Windows:
Mac Disk Image: http://www.celestiaproject.net/~claurel/celest ... odview.dmg
Zip archive for Windows: http://www.celestiaproject.net/~claurel/celest ... -win32.zip
The code for cmodview is already committed to the Celestia SVN repository, so you can build it
yourself for any system capable of running Celestia. Currently, cmodview requires Qt 4.6 to build,
but this requirement will be relaxed so that cmodview can work with Qt 4.5.
Motivation
3D mesh files are an important component of many Celestia add-ons, but it's
difficult work getting meshes from modeling software into a form that's ideal
for Celestia.
Celestia supports two 3D file formats: 3D Studio (3ds) and
cmod. While most 3D modeling apps can export 3DS files, the format is a very
old one with many limitations: a 65535 triangle limit per submesh, 8.3
character texture file names, and no support for storing surface normals or
tangents. The cmod format is a better match for the capabilities of modern
graphics hardware, but the tools support for cmod has been fairly poor. Using
advanced features like emissive maps and normal maps required hand editing,
Features
The biggest benefit of cmodview is simply the ability to interactively
preview 3D models without having to launch Celestia. You can make changes to a
model inside of cmodview and instantly see the effects. Or, if you're
using some other program to modify a model, you can reload it in cmodview
with a couple keystrokes.
Usage
General Tips
Material Editor Tips
Limitations
(Centaur stage model from the LCROSS add-on by BrianJ)
who are working with 3D meshes. It can be used to inspect, optimize, and convert
meshes. Cmodview has basic material editing capabilities which can be used to change
textures and colors of mesh elements.
Prebuilt versions are available for Mac OS X and Windows:
Mac Disk Image: http://www.celestiaproject.net/~claurel/celest ... odview.dmg
Zip archive for Windows: http://www.celestiaproject.net/~claurel/celest ... -win32.zip
The code for cmodview is already committed to the Celestia SVN repository, so you can build it
yourself for any system capable of running Celestia. Currently, cmodview requires Qt 4.6 to build,
but this requirement will be relaxed so that cmodview can work with Qt 4.5.
Motivation
3D mesh files are an important component of many Celestia add-ons, but it's
difficult work getting meshes from modeling software into a form that's ideal
for Celestia.
Celestia supports two 3D file formats: 3D Studio (3ds) and
cmod. While most 3D modeling apps can export 3DS files, the format is a very
old one with many limitations: a 65535 triangle limit per submesh, 8.3
character texture file names, and no support for storing surface normals or
tangents. The cmod format is a better match for the capabilities of modern
graphics hardware, but the tools support for cmod has been fairly poor. Using
advanced features like emissive maps and normal maps required hand editing,
Features
The biggest benefit of cmodview is simply the ability to interactively
preview 3D models without having to launch Celestia. You can make changes to a
model inside of cmodview and instantly see the effects. Or, if you're
using some other program to modify a model, you can reload it in cmodview
with a couple keystrokes.
- Load cmod, 3DS, and Wavefront obj format files; save as binary cmod.
- Generate surface normals
- Generate tangents for normal maps
- Optimize models by eliminating duplicate vertices and aggregating meshes
- Apply normal maps, specular maps, and emissive maps to models
- View in OpenGL 2.0 mode or fixed function mode (fixed function is equivalent to
Celestia's basic render path.) This is useful for checking out how a model will appear
on both old and new graphics hardware. - Show model statistics: number of triangles, vertices, materials, and submeshes
- Designed for Celestia: automatically looks for textures in textures/medres
folder, loads dxt5nm compressed normal maps, etc.
Usage
- Select Open from the File menu to load a 3ds, cmod, or Wavefront OBJ file
- Left drag the mouse to rotate the model
- Right drag (or Alt+Left drag) the mouse to rotate the light sources
- Click on a mesh to select a primitive group. A primitive group is a
set of triangles, lines, or points with a single material applied.
The selected mesh is shown highlighted with a green wireframe. - The material editor on the right shows the properties of the material
assigned to the currently selected group. Changes to the material are
reflected instantly in the model view window.
General Tips
- If the model doesn't appear to have any shading, it's probably because
it doesn't contain any surface normals. Use 'Generate Normals' in the
Operations menu to recover surface normals from the mesh geometry. - Not all models have texture coordinates. If you add a texture in
the material editor and nothing changes on the model, it's probably
because of missing texture coordinates. This is something that has to
be fixed in a 3D modeling program, as it is outside the scope of
cmodview. - Use 'Generate Tangents' (in the Operations menu) when you want to
use a normal map. Texture coordinates are required to generate surface
tangents. Don't generate tangents unless you're planning to add a
normal map to a mesh, as they do increase the size of the model file. - Generating normals produces lots of duplicate vertices. After
generating normals, try using Uniquify Vertices (also in the
Operations menu) to clear out the unneeded data. - The Wavefront OBJ format has two big advantages over 3DS:
it can store surface normals, and it doesn't suffer from the 64K
triangle limit. (NOTE: material libraries for obj files aren't
supported yet, so you need to add textures and colors yourself.)
Material Editor Tips
- For non-shiny surfaces like paper and chalk, disable specular lighting
by setting the specular color to black. - Create shiny, plastic like surfaces by setting the specular color to
white and using a shininess of 60 or higher. - Create metallic looking surface by setting the specular color to be
the same as the diffuse color. For duller metal, use a low shininess
around 5 - 15; for polished metal, choose a higher value. - To make textured surfaces look metallic, set the specular map to be
the same as the diffuse map and set the specular color to white. - Emissive maps can be used to make some regions of a model appear self-illuminating.
Limitations
- Material libraries for Wavefront obj files are not supported yet.
- No way to export cmod ASCII files (just binary for now)
- Wildcard extensions (e.g. marsmap.*) for texture maps aren't supported yet.
- No way to to select lines and points yet
(Centaur stage model from the LCROSS add-on by BrianJ)