Data Type: View Base ()
This module is the base class for several other modules displaying a set of triangles, like Isosurface, Surface View, Tetra Grid View, and others. View Base is not useful on its own but provides special features common to all derived modules. In particular, these features comprise the following:
- A dedicated port allowing the user to modify the draw style of a triangular surface in an easy and consistent way. All modules derived from View Base thus have a similar GUI. Among the supported draw styles is a physically correct transparency mode.
- A generic buffer concept allowing the user to select triangles by means of a tab-box dragger. Only triangles added to the internal buffer will be displayed. Thus, complex surfaces may be decomposed into smaller pieces.
- An arbitrary 3D scalar field may be visualized on top of the triangular surface by means of pseudo-coloring. Pseudo-coloring may be achieved via Gouraud shading (mapped vertex colors will be interpolated) or, more accurately, via texture mapping (vertex values will be interpolated linearly and mapped to color afterwards).
- The set of triangles currently being visible can be converted automatically into a Surface object. This is useful, for example, in order to post-process isosurfaces or to extract parts from a bigger surface.
- Common Tcl commands allow control of many parameters of modules derived from View Base. This includes line width, outline color, highlight color, specular color, shininess, alpha mode, normal binding, and more.
ColorField Scalar field to be visualized via pseudo-coloring. The field will be evaluated at the vertex positions of the surface and a color will be mapped onto the surface using the colormap connected port Colormap. The field may be either of type HxScalarField3 or of type HxSurfaceScalarField. In addition to scalar surface fields also 3- and 4-component surface fields are supported. In this case, the field components are directly interpreted as RGB or RGBA values. The values should range from 0 to 1.Colormap Colormap used for pseudo-coloring (see Color Field). To change the colormap right-click the colormap window or reconnect (drag) the blue connection line with another colormap data object. To change the port's default color double- (left-)click the colormap window and select a color from the Color Dialog. See also Colormap.
Texture [optional]
This port allows connection of a 2D image that will be mapped onto the surface as a texture. The image must be a single slice of type ColorField. A transformation can be applied to the texture image in order to change the texture projection axis and texture coordinates scale. Note that texture projection overrides pseudo-color mode.
Draw Style
This port determines the draw style of the surface. Five major styles may be selected from an option menu:
- Outlined: Opaque shaded display with edges superimposed.
- Shaded: Opaque shaded display without visible edges.
- Lines: Shaded wireframe display.
- Points: Triangle vertices only.
- Transparent: Semi-transparent display.
More options: Pressing this button opens a pull-down menu that may be used to fine-tune draw style. This menu contains 4 groups of items:
The first group deals with surface shading and pseudo-color mapping.
- Specular: Enables or disables specular highlights. Specular color and shininess may be changed via the Tcl command interface.
- Gouraud: Indicates that if a color field is connected pseudo-coloring is performed via Gouraud shading. First, colors are looked up at the triangles' vertices, then interpolated colors are drawn inside the triangles. See also ->Texture.
- Texture: Indicates that if a color field is connected pseudo-coloring is performed via texture mapping. The color field's values are interpolated linearly before color lookup is performed. In this mode no specular colors can be used. See also ->Gouraud.
The second group of items refers to transparency. Transparent mode implies physically correct transparencies, i.e., triangles appear more opaque if they are viewed under a small angle. It also implies approximate depth-sorting (except for Sorted Layers and Sorted Layers Delayed transparency types), i.e., triangles are roughly rendered from back to front in order to obtain correct blending results. Note that in some cases visual artifacts may occur for long and thin triangles, for self-intersecting surfaces, or for multiple semi-transparent surfaces being displayed simultaneously.
- Opaque: All triangles will be rendered opaque.
- Const alpha: Opacity values of a triangle, will be taken as is. Usually, if no pseudo-coloring is done, all parts of the surface will have equal opacity.
- Fancy alpha: Enables physically correct transparencies. The opacity values of the triangles will be modified according to their orientation with respect to the viewing direction. Causes the silhouette of the surface to be fully opaque, thus enhancing perception for very transparent surfaces.
- Depth sorting: Enables approximate depth sorting. The centers of the triangles are presorted along the major coordinates axes. With Sorted Layers and Sorted Layers Delayed transparencies, this option has no effect.
The third group of items control which side of a triangle is rendered. With Culling enabled either the front or the back face of a triangle is rendered. This may be used to improve rendering performance on some older graphics boards. Note that with modern graphics boards the difference is usually negligible. Three modes can be selected:
- Both faces: Both faces are rendered.
- Front face: Only front faces are rendered.
- Back face: Only back faces are rendered.
The following group of items is available for Surface View only. The settings here affect the computation of the surface normals used for shading.
- Triangle normals: Enables per-triangle normals. Shading will be discontinuous at the triangles' edges so that faces appear flat.
- Vertex normals: Enables per-vertex normals. An average is computed from neighboring normals for all triangle vertices. This gives the surface a smooth, continuous appearance.
- Direct normals: An average is computed from neighboring normals for all triangle vertices. No averaging is performed if two neighboring triangles form an angle greater than the crease angle. The default for this angle is 1.0472 radians (= 60 degrees) and can be changed using the command setCreaseAngle in the console.
All View Base derived display modules allow export of a surface object.
- Create surface: Creates a Surface object containing the set of currently visible triangles.
With the Line width and the Outline color options you can modify the line width and the outline color of the surface. The Line width option is enabled if the Outlined or the Lines draw style is selected, otherwise it is disabled. The Outline color option is enabled only if the Outlined draw style is selected.
Buffer
This port can be used to modify the list of currently visible triangles. All visible triangles are stored in an internal buffer. To modify the contents of this buffer you need to first select triangles (selected triangles are drawn in red wireframe) and then add or remove them using the buttons described below. Triangles can be selected either by manipulating a tab-box dragger, by using the Materials (Patch or Boundary id) ports, or by drawing a contour in the viewer.
- Add: Adds highlighted triangles to the buffer. If the Shift key is held down while the button is pressed, the buffer will be cleared before adding. The Shift key is especially useful in conjunction with the Draw selection.
- Remove: Removes highlighted triangles from the buffer.
- Clear: Removes all triangles from the buffer.
- Show/Hide: Shows or hides the tab-box dragger without modifying the internal buffer.
- Draw: Activates a lasso style selection mechanism. Using the mouse you can draw a contour in the viewer. All triangles within this contour will be highlighted. If CTRL is pressed while drawing, the triangles within the curve will be deselected.
TextureWrap
Wrap mode used for the texture projection on the surface when a texture is applied to the surface. This port is hidden if no texture data is connected to the Texture connection port. There are two wrap modes:
- Repeat: The texture is repeated outside its 0-1 texture coordinate range.
- Clamp: Clamps texture coordinates to lie within the 0-1 range.
createSurface [name]
Converts the set of visible triangles into a Surface object.setAlphaMode {opaque|constant|fancy}
Triangles may be drawn either opaque or transparent. Two transparent modes are possible: with a constant alpha value (constant) or an alpha value varying according to triangle normal (fancy). See also the description of port Draw Style.setNormalBinding {perTriangle|perVertex}
Normals can be bound either per triangle or per vertex. In the first mode the triangles appear flat.setPointSize size
Sets the size of points when points are selected in port Draw Style.setPolygonOffsetMode {auto|on|off}
If lines are to be drawn on top of a surface, the surface must be rendered with an offset to avoid artifacts. This can be done automatically (auto), always (on), or never (off).setOutlineColor <color> | <r><g><b>
Sets the line color in outlined Draw style.setLineWidth <width>
Sets the width of the lines in outlined and lines Draw Style.setHighlightColor <color> | <r> <g> <b>
Sets the wireframe color of selected triangles.setEmissiveColor <color> | <r> <g> <b>
Sets the emissive color of the surface.setSpecularColor <color> | <r> <g> <b>
Sets the specular color of the surface. This will only take effect if specular lighting has been enabled in port Draw Style.setShininess <shininess>
Sets the size and distinctness of the specular highlight in Specular surface rendering. The parameter <shininess> can take values between 0 and 1, 0.2 being the default.showBox
Shows the box that is used for selecting triangles. See also the description of port Buffer.hideBox
Hides the box that is used for selecting triangles. See also the description of port Buffer.