UnigineScript
The Language
Core Library
Engine Library
Node-Related Classes
GUI-Related Classes
Plugins Library
High-Level Systems
Samples
C++ API
API Reference
Integration Samples
Usage Examples
C++ Plugins
Content Creation
Materials
Unigine Material Library
Tutorials

MeshViewer

MeshViewer is a robust tool for fast preview of exported geometry, animation and textures. It allows for converting loaded data into Unigine static geometry format and smoothing normals. Besides that, it has a set of useful features to help artists in optimization of created models.

MeshViewer module

Usage

MeshViewer uses a simplified set of shaders to speed up the loading, so its primary purpose is a fast display and visual check of the data obtained from a 3D editor.
MeshViewer is a convenient way to perform the following operations:

  • Fast preview of models exported from a 3D editor (see supported formats).
  • Preview skinned animation (only for .smesh files).
  • Convert geometry data from external file formats into a native Unigine mesh. Export Unigine animated meshes as a simple geometry.
  • Set materials to check UV mapping and texturing of the model:
    • Click on the surface or pick it in the Surface dialog window.
    • Set an appropriate texture in the Textures window.
  • Try out tessellation and parallax mapping according to the loaded textures.
  • Quickly test the model for possible problems:
  • Manage model geometry: save a mesh without some of its surfaces. You can also save selected surfaces of the model as separate meshes.
  • Optimize your model:
  • Save the textured model as a project. After that, the set up model can be loaded in one click.
    Notice
    Please note that the project with the applied textures and surfaces cannot be exported to Unigine engine. MeshViewer is for preview purposes only.

Display Modes

MeshViewer can operate in three display modes. To switch between them, choose the mode in the drop-down list in the upper left corner of a window.

  • Mesh to display in the viewport a loaded mesh with applied textures, if any.
  • Map 0 to display the first UV set
  • Map 1 to display the second UV set

MeshViewer module in the Map 1 mode

Map 1 mode in the MeshViewer

Mesh Options

Load mesh Load an exported static object (stored in a Unigine .mesh format) or animation (in .smesh and .sanim format).
  • Flip YZ axes and invert Y axis allows to load the models with the proper orientation in Unigine coordinate system. If models were initially created in one of the following 3D packages, they require this option to be enabled:
    • Softimage (if a model was exported using an export plugin, flipping has already been done automatically)
    • ZBrush
    • Mudbox
    • Poser
    • Silo
  • Vertex cache optimization reorders an indexed triangle list for improved vertex cache utilisation. When turned on, the model may take longer time to load.
  • Animation only option allows to load animation data stored in separate .sanim file for the already loaded model in a bind pose.
The hot key is CTRL + O.
Save mesh Save a model into the same Unigine native format as the current one (to save them into a .mesh, use Export mesh option):
  • .mesh (static geometry)
  • .smesh (geometry data together with skinned animation)
  • .sanim (animation data without geometry itself)
Models in a third-party formats are saved into a .mesh format only.

If no surfaces are selected, the whole mesh (all non-hidden surfaces) will be saved. If one or several separate surfaces are selected (for multiple selection hold SHIFT or CTRL), only specified geometry will be saved into a file.

For saving, the same options as for loading are applied.
  • If Vertex cache optimization was enabled when loading a mesh, there is no need to enable it again. Remember, however, this optimization should be used on any step: either when the model is exported from 3D editor, loaded into MeshViewer or saved.
  • To save an animated model into one file (geometry together with animation data), specify .smesh format.
  • To save only the animation date, check Animation only option and specify .sanim format.
The hot key is CTRL + S.
 
Load project Load a saved MeshViewer project (.proj file), which contains a model, textures and all settings made for them.
Save project Save a mesh with all its settings as a project (into a .proj file). This file contains a path to the mesh file and settings made for mesh surfaces (textures, parameters and flags). After being saved, a mesh can be quickly loaded
Notice
Projects are supported only by the ResourceEditor. They cannot be loaded into the Unigine engine world.
 
Export mesh Save the model geometry into a Unigine native .mesh format in two clicks. Animation and bones, if any, will be ignored.
  • If one or several separate surfaces are selected (by holding SHIFT or CTRL), only they will be saved rather than the whole model.
  • Animated model will be exported as a simple static geometry as it is displayed in the current animation frame.
Smooth mesh Smooth all curving parts of mesh. This option does not affect the geometry, but only how the mesh is shaded.
Smoothing can be applied to static geometry (in .mesh file) and animated models (in .smesh file). If one or several separate surfaces are selected (by holding SHIFT or CTRL), only they will be smoothed rather than the whole model.
  • Smoothing merges normals of adjacent polygons into one producing the appearance of a smooth, curved surface. The Angle option specifies a threshold angle for smoothing. If an angle between two polygons is smaller than the set threshold angle, they are smoothed.
  • If Angle option is unchecked, normals of all polygons are merged. The mesh will have no sharp edges — it will be all smooth. Unckecking Angle option is the same as setting threshold angle to 180 degrees.
  • If the Angle is set to 0 degrees, no polygons are smoothed. Each polygon face will be shaded independently, resulting in a sharp and edgy appearance.
  • The higher the angle (up to the maximum of 180 degrees), the more polygons are smoothed, as the angle between their faces is smaller then the threshold one.

Smoothed mesh (Angle option unchecked) Non-smoothed mesh (Angle = 0)
Smoothed mesh. Angle unchecked.
Non-smoothed mesh. Angle = 0.
Reduce mesh Cull invisible polygons. Each polygon is tested whether it is visible by tracing rays to it from all directions. Invisible polygons are automatically removed, thus decreasing the number of triangles the graphics card will have to process at rendering time. This optimization is very useful, for example, if a mesh was created from several overlapping models.

Non-reduced mesh Reduced mesh
Non-reduced mesh. (Transparency is enabled for both surfaces).
Reduced mesh.
Reload all Reload all resources: a mesh and its textures. This option does not affect set up parameters for surfaces and textures. The hot key is CTRL + R.

Visualization Options

Export node settings

Bone hierarchy in the MeshViewer

Info Display information about the mesh and one selected surface in the upper left corner of the viewport. Such data is shown as:
  • Number of vertices and triangles in the whole mesh and in the surface
  • Coordinates of the minimum and maximum points of the axis-aligned bounding box. (These are the points which X, Y, and Z components represent the minimum or the maximum value in each dimension).
  • Bounding sphere radius and its center coordinates etc.
The hot key is I.
Compass Toggle a XYZ compass in the upper right corner of the viewport. The hot key is C.
Triangles Toggles showing the base grid plane, as well as triangles of the mesh (its selected surfaces) or a wireframe (if enabled). The hot key is T.
 
Seams Show texture seams for the mesh (or its selected surfaces) in green.
Tangent Show the tangent space at polygon vertices of the mesh (or its selected surfaces). It represents texturing coordinates for face of each polygon with the triple of vectors: U, V and normal vector that is always perpendicular to the face itself.
This option is useful for detecting tangent space discontinuities, which may cause lighting artifacts. In areas where adjacent polygons have a different tangent space, there will be an noticeable edge; in areas where tangent space is the same, there will be a smoothly curved surface.

Tangent space

Tangent space: U, V and normal
Overlaps Show overlaps in UV coordinates in different shades of red. The more saturated is the color, the more overlaps there are in the given point.

Overlaps in UV coordinates

Overlaps in UV coordinates
Bones Show bones of the skinned mesh.
Names Show names of the bones of the skinned mesh.
Dual Quat Use dual quaternions for the skinned mesh. When quaternions are used instead of simple matrices to describe rotation and position of vertices, it allows to reduce a twisting artifact between two bones, which is often seen at shoulder joints of characters. With dual quaternions character joints do not look deformed like a candy wrapper. (In the Unigine-based application dual quaternions can be enabled with Use dual quat option).

Disabled dual quaternions Enabled dual quaternions
Disabled dual quaternions
Enabled dual quaternions
Surfaces Show a dialog window with a list of surfaces and their visualization parameters.

The Surfaces window has the following options:
  • List of the available surfaces. Multiple selection by holding SHIFT or CTRL is supported.
  • Name field that allows editing of the surface name.
  • Transform fields that specify the texture coordinates transformation:
    • The first two fields set the scale factors on X and Y axes respectively.
    • The third and the fourth fields set the offset factor on X and Y axes. The values should be non-integer to produce a visible offset.
  • Enabled option that enables the chosen surface.
  • Bound box option that displays the bounding box enclosing the surface.
  • Wireframe option for wireframe view of the surface. This option is in effect only when Triangles are enabled as well.
  • Transparent option that enables surface transparency.
  • Alpha test option that enables alpha testing for applied material.
  • Two sided option for double-sided surface.
Textures Show a dialog window with texture settings for the selected surface.

On the texture tab you can load the texture, view or clear the loaded texture. If multiple surfaces are selected, these operations will performed for all the textures.
The texture window has the following tabs:
  • Diffuse tab for a diffuse texture.
  • Normal tab for a normal map.
  • Specular tab for a specular map.
    • Power controls the size of the specular highlight:
      • Low values for wider highlights
      • High values for pinpoint highlights
    • Scale to control the brightness of specular reflections:
      • Low values for matt surface
      • High values for glossy surface
  • Parallax tab for a parallax map. This map can be created in the NormalMapper.
    • Scale controls the distance to displace pixels:
      • The higher the value, the further the pixels will appear to be pressed into the surface.
  • Height tab for a tessellation height map. This map can be created in the NormalMapper.
    • Scale controls the height to displace vertex positions to (according to the provided height map):
      • The higher the value, the farther vertices are displaced and the more protruded the tessellated surface is.
    • Factor controls how much the polygons of the control mesh are subdivided:
      • The higher the value, the more refined the contour of the tessellated surface will be.

Animation Options

Preview skinned animation is supported only for .smesh files.

  • Simply click Play if animation is stored in one .smesh file together with a mesh in a bind pose.
  • If a bind pose and animation are stored in a separate files, perform the following steps:
    1. Click Load mesh and select .smesh file with a bind pose.
    2. Click Load mesh again and select .sanim file with animation data.
    3. Check Animation only at the bottom of the dialog window.
    4. Play the animation applied to the skinned mesh.

Animation options

  • From — the first frame to start animation playback from
  • To — the last frame to animation playback with
  • Fps — the speed of animation playback
  • Play — play the animation in a loop

Supported File Formats

MeshViewer can export data from several external formats.

Supported formats of geometry/animation data are as follows. Previewing animation data is supported only for Unigine skinned meshes (SMESH format).

  • Unigine mesh (MESH)
  • Unigine skinned mesh (SMESH)
  • Unigine animation for skinned mesh (SANIM)
  • 3ds Max (3DS)
  • LightWave Objects (LWO)
  • Wavefront (OBJ)
  • ASCII Scene Export (ASE)
  • COLLADA (DAE)
  • Quake 3 level model (BSP)
  • Doom 3 level model (MAP)
  • Quake 2 level model (MD2)
  • Doom 3 skinned model (MD5MESH)
  • Doom 3 animation (MD5ANIM)
  • QuakeWars skinned model (MD5B)
  • QuakeWars animation (ANIMB)

Supported formats of textures:

  • Targa (TGA)
  • Portable Network Graphics (PNG)
  • JPEG (JPG)
  • Photoshop Document (PSD)
  • Direct Draw Surface (DDS)
PSD and DDS textures can be either of an 8-bit or 16-bit precision.

Controls

Selection

  • CTRL + left mouse button / double click — select a surface or deselect a previously selected surface. Hold SHIFT to select/deselect more surfaces.

Hot Keys

  • CTRL + O — load mesh.
  • CTRL + S — save mesh.
  • CTRL + R — reload all files.
  • I — toggle mesh info.
  • C — toggle a XYZ compass.
  • T — toggle base grid, surface triangles or a wireframe (if enabled).
  • G — reset pivot from the mesh to the camera.
  • F — focus on the selected surface. It sets the pivot on the focused surface. To reset it, use G hotkey.
  • SPACE — deselect the selected surface.
Last update: 2017-07-03