User Tools

Site Tools


This is an old revision of the document!


The Modelviewer

The Cafu SDK also comes with a stand-alone Modelviewer program. The Modelviewer can load and render all models that the main engine supports, too. In fact, the Modelviewer and the Cafu engine share the same model support code.

The Modelviewer is very useful to view, test and check models, e.g. during model development. It can quickly load models and render them directly, without requiring you to start CaWE first in order embed the model into a map file.

Moreover, developing model materials or checking for material problems is easily done with the ModelViewer. Refer to the Cafu Material System documentation for more information about materials.

The command-line

The Modelviewer. The Modelviewer is a command-line driven program. If you run it without any parameters, it prints a short help message:

C:\Cafu-9.06> ModelViewer.exe

Registering archive "Games/DeathMatch/Textures/TechDemo.zip".
Registering archive "Games/DeathMatch/Textures/SkyDomes.zip".

USAGE: ModelViewer ModelName [SubModelName] [-print] [-bm] [-noS] [-noAnim]

-print    Prints model data to stdout.
-bm       Runs a benchmark (and prints results to stdout).
-noS      If dynamic lighting is enabled, this disables the shadows.
-noAnim   In interactive mode, this turns model sequence animations OFF.
          Intended for code testing only, and not very useful otherwise.

In most cases, just pass the file name of the desired model in order to run the Modelviewer. Example:

C:\Cafu-9.06> ModelViewer.exe Games\DeathMatch\Models\Players\Trinity.mdl


The Modelviewer Window

In the Modelviewer window, you see a ground plane onto which the shadow of the model is projected, an abstracted coordinate cross that indicates the position of the light source, and the model itself.

If you cannot see the model at all, that is usually an indication that the ModelViewer could not load the model, or it could load the model but not the MatSys materials for its surfaces. In this case, please check the console output carefully for warning and error messages, often they indicate the problem.

If you ever come across a model that the Modelviewer (and thus Cafu) should support but doesn't (i.e. you get unresolvable error messages or the model doesn't show at all), please let us know.

Keyboard and Mouse Controls

Use the following keys to control the Modelviewer:

Key Action
ESC Quits the program, same as ALT+F4.
x Toggles automatic rotation about the x-axis on and off.
y Toggles automatic rotation about the y-axis on and off.
z Toggles automatic rotation about the z-axis on and off.
The following keys + and - must be pressed on the numpad, not on the main keyboard:
+ Switches to the next model animation sequence.
- Switches to the previous model animation sequence.
k Toggles the drawing of the light source location on and off.
When on, a small cross is displayed where the light source is located.

The following keys can be held down to achieve an effect:

Key Action
W Decreases the distance to the model, i.e. moves the camera closer to it (zoom in).
S Opposite to W, this increases the distance to the model, i.e. moves the camera farther away from it (zoom out).
Note that you can also use the scroll wheel of the mouse in order to achieve the same effect (zoom in and out).

The followings keys must be held down and then the mouse be moved. Moving the mouse while the key is held down causes the described action.

Key Action
R Rotates the model.
M Moves the camera relative to the model.
L Moves the lightsource spherically around the model: Moving up and down changes the “elevation” of the light source, moving left and right rotates the light source around the model (“azimut”). In this mode, the mouse wheel changes the distance of the light source to the model.
The following keys 1 to 9 must all be pressed on the numpad, not on the main keyboard:
13 Changes the red, green and blue components of the light-source color, respectively, when the mouse is being moved up and down.
46 Changes the red, green and blue components of the ambient light color, respectively, when the mouse is being moved up and down.
59 Changes the red, green and blue components of the background color, respectively, when the mouse is being moved up and down.
Note that you can also press several color keys simultaneously. For example, if you want to set the ambient color to purple (same value for red and blue, zero for green), first press 4, 5, and 6 simultaneously, hold them, and move the mouse down, in order to set them all to zero (black). Then release the 5 (green), but keep 4 and 6 held down. Then move the mouse up until the desired color is reached.
modelling/modelviewer.1333529449.txt.gz · Last modified: 2013-01-07 12:07 (external edit)