OpenGL 3D Data Display

Three-dimensional OpenGL display of the current data window can be invoked with the button with symbol of cube in View button row of main window.

This feature is optional, i.e. it can be disabled at compile time. It can also happen that while Gwyddion is capable of 3D data display your system does not support it. In both cases an attempt to invoke 3D view gives an error message explaining which of the two cases occured. In the former case you have to ask the producers of Gwyddion executables to build them with 3D support or build Gwyddion yourself from source code. If it is the latter case, refer to your operating system guide on how to enable OpenGL 3D capabilities.

The 3D window has two possible forms: with basic and expanded controls. It starts with basic controls only, this form is displayed on following figure. It can be switched to the expanded form (and back) with an expander button it the upper right corner. Clicking on the view with right mouse button brings a quick color gradient/GL material selector.

Three-dimensional OpenGL data display window with basic controls.

Basic Controls

Basic 3D window contains interaction mode controls at the right side of the view. By default, dragging the view with mouse rotates it horizontally and vertically. All possible modes are listed below:

  • Rotation – this is the default. Dragging the view horizontally rotates it around z-axis, vertical drag rotates it around horizontal axis parallel with the plane of view.
  • Scale – dragging the view right and down enlarges it, drag in the opposite direction makes it smaller.
  • Z-scale – dragging the view up (down) increases (decreases) the z-scale, making the hills and valleys more or less pronounced.
  • Light rotation – this possibility is available only in lighting visualization mode. Dragging the view changes position of light source similarly to rotation of data in normal rotation mode.

The basic controls also include an image export button.

When basic controls are shown it is possible to switch between the modes using keys R (rotation), S (scale), V (value scale) and L (light rotation).

Full Controls

In expanded controls the mode buttons are located in top row, however their function does not change. In addition, there are several tabs with options below them:

  • Basic – controls to set rotations and scales numerically and to switch on an off axes, axis labels, and perspective projection.
  • Light & Material – visualization settings. Gwyddion 3D view has two basic visualization modes: gradient, in which the data are simply colored with a false color scale exactly like in normal 2D view; and material, in which the data are presented as an OpenGL material rendered according to light position. This tab also contains controls to set light position numerically.
  • Labels – fine tuning of sizes, positions, and other properties of axis labels.

Saving Images

The 3D view can be saved into a bitmap image with the Save button. The output is currently always a PNG (Portable Network Graphics) image with exactly the same size and contents as displayed on the screen. Entering a different file extensions than .png still produces an image in PNG format, albeit with a confusing extension.

Note due to the peculiarities of certain operating systems, graphics drivers and windowing environments, artefacts may sometimes appear on the exported image in parts corresponding to obscured parts of the 3D view. If you encounter this problem, make sure the 3D view is not obscured by other windows during the image export.

OpenGL Material Editor

OpenGL material editor can be invoked with EditGL Materials. The controls in the material list are the same as in the color gradient editor list and the material management works identically. The actual editor is of course different. It allows to edit four quantities defining the material:

  • ambient color ka,α (where α = red, green, blue), controlling the reflection of ambient light that is assumed come uniformly from all directions,
  • diffuse color kd,α, describing the diffuse reflection which is independent on the direction of incident light and whose apparent brightness is independent of the viewing angle,
  • specular color ks,α, controlling the specular reflection with reflected light intensity dependent on the angle between the observing direction and the direction of light that would be reflected by an ideal mirror with the same normal, and
  • shininess s, a numeric exponent determining how much the specular reflection resembles an ideal mirror, smaller values mean rougher surfaces, higher values mean smoother surfaces.

If we denote L the normal vector pointing from the observed surface point to the light source, V the normal vector to the observer, N the normal vector to the surface R the normal vector in the direction of ideal mirror reflection, the observed light intensity in OpenGL lighting model can be expressed as

where Ia,α, Id,α and Is,α are the ambient, diffuse and specular light source intensities, respectively.