From Manta Wiki
Jump to: navigation, search

The Triangle Scene Viewer is a scene module accessible through bin/manta which loads a triangle mesh from a .ply or .obj file. For animation multiple key frames may be loaded from different .obj/.ply files.


First enable the SCENE_TRIANGLESCENEVIEWER option in ccmake or from the command line in your build directory:


Then rebuild the source with make. The file lib/libscene_triangleSceneViewer.{dylib,so} should be built.


Use the -scene option to select the module, be sure to use parentheses (in quotes) on the command line to specify options for the module.

bin/manta -scene "lib/libscene_triangleSceneViewer( -model file.obj )"
bin/manta -scene "lib/libscene_triangleSceneViewer( -model file.obj -DynBVH )"

Additional options:

bin/manta -scene lib/libscene_triangleSceneViewer
Make_scene args: 0
Valid options for scene meshViewer:
 -BSP      - use BSP acceleration structure
 -DynBVH   - use DynBVH acceleration structure
 -KDTree   - use KDTree acceleration structure
 -rgrid    - use single ray recursive grid acceleration structure
 -model    - Required. The file to load (obj or ply file)
             Can call this multiple times to load an animation.
 -save [filename]    - save acceleration structure to file (currently DynBVH, kdtree and bsp).
 -load [filename]    - load acceleration structure from file (currently DynBVH, kdtree and bsp).
 -animationLength    - Number of seconds animation takes
 -interpolateNormals - creates vertex normals if the data does not already contain vertex normals.
 -useFaceNormals     - force to use only face normals
 -smoothAnimation    - interpolates between keyframes.
 -triangleType       - Triangle implementation to use.
                       Wald_tri, KS_tri.
 -overrideMatl       - Force to use a material.
                       flat, eyelight, lambertian, phong, ambientocclusion
 -lightPosition      - Location of light.
 -ambient            - Type of ambient lighting to use.
                     - arc, AO {bounce} {samples N}, constant, eye.
 -addFloor           - Adds a checkered floor.

To get the best rendering performance, use the following arguments to bin/manta:

 -scene "lib/libscene_triangleSceneViewer(-DynBVH -model YOUR_MODEL.obj -triangleType Wald_tri)" -camera "pinhole(-normalizeRays -createCornerRays)"

The -createCornerRays, and Wald_tri will allow for certain frustum-based optimizations to take place, such as frustum culling in the triangle intersection. And in ccmake, set MANTA_USE_DYNBVH_APPROXIMATE to OFF. This will result in a slower to build, but higher quality BVH build.