SoRenderSurfaceIntersection

InventorModule
author MeVis Medical Solutions AG
package MeVisLab/Standard
dll SoRenderers
definition SoRenderers.def
keywords filled, overlay, contour, mask, geometry, SoView2D

Purpose

The SoRenderSurfaceIntersection allows to render the intersection of 3D triangle meshes with a given world plane. The intersection is rendered using anti-aliased lines. The module has a GPU implementation that requires OpenGL 2.0 and geometry shaders. It also has a CPU fallback implementation if no hardware support is available. The CPU fallback will be used on Mesa and Intel hardware by default.

The module support filling of the intersection but only if the objects are closed. If supported by the hardware, the GPU will be used for the filling. If filling is not supported on the GPU, the software intersection calculation is used for the filling. The software implementation is especially picky about the closedness, which causes SoSphere to not always be filled correctly because Open Inventor has (albeit very small) holes in its spheres. An alternative to SoSphere is to use WEMInitialize to generate a sphere instead. The CPU filling implementation behaves differently regarding objects inside other objects, it uses the color from the last contour it entered from left to right and fills scan-line by scan-line. The GPU implementation adds up the colors in 3D and will show the sum of the colors of all objects that lie inside each other.

Stippling is not supported by the GPU implementation, the module will automatically use the software intersection renderer when stippling is enabled.

Note: Only triangle meshes are supported, that means points, lines, quads and polygons are not supported. If you are using a WEM rendering, make sure that it consists of triangles only. You can use WEMModify to triangulate any WEM mesh. On NVidia hardware quads seem to work as well, but quads definitely do not work on ATI graphics cards. Make sure to convert quads to triangles when using them with this module to get working cross platform results.

Example usage:

../../../Modules/Inventor/SoRenderers/mhelp/Images/SoRenderSurfaceIntersection.png

Usage

The module can be used to draw the intersections both in 3D or onto a SoView2D using SoView2DScene. In the case of the SoView2DScene, the module automatically uses the current SoView2D slice as intersection plane, if SoView2DScene.useSlabRenderingPlane is enabled.

Tips

Make sure to enable double sided rendering (e.g. in the SoWEMRenderer), or to add a SoShapeHint module to force double sided rendering, otherwise back faces are not handled correctly.

Input Fields

child

name: child, type: SoNode

The Inventor scene that should be intersected. Make sure that the scene only contains triangle meshes!

Output Fields

self

name: self, type: SoNode

Parameter Fields

Visible Fields

Color

name: color, type: Color, default: 1 1 1

The color of the intersection.

Alpha

name: alpha, type: Float, default: 1, minimum: 0, maximum: 1

The alpha blending value of the intersection.

Line Width

name: lineWidth, type: Float, default: 2, minimum: 0.1, maximum: 10

The line width.

Albedo Mix

name: albedoMix, type: Float, default: 1, minimum: 0, maximum: 1

Defines how much of the geometry color is mixed in (0 = color field only, 1 = color * geometry color).

Line Style

name: lineStyle, type: Enum, default: SOLID

Selects the line style (stipple pattern). Please note that only the SOLID style is supported by the geometry shader implementation, so any other pattern will cause the module to fall back to the CPU implementation.

Values:

Title Name Description
Solid SOLID SOLID
Dashed DASHED DASHED
Short Dashed SHORT_DASHED SHORT DASHED
Dotted DOTTED DOTTED

Plane Offset

name: planeOffset, type: Float, default: 0

Allows to offset the intersection plane.

Plane Position

name: planePosition, type: Enum, default: SlabCenter

Allows to select the position of the plane on the slab.

Values:

Title Name
Start SlabStart
Center SlabCenter
End SlabEnd

Line Style Scale

name: lineStyleScale, type: Integer, default: 1, minimum: 1, maximum: 16

If a stipple pattern is selected, this scales the pattern.

Fill Inside

name: fillInside, type: Bool, default: TRUE

Enables filling of the inside. This requires another rendering pass.

Inside Color

name: insideColor, type: Color, default: 1 1 1

Defines the color to use for the inside.

Inside Alpha

name: insideAlpha, type: Float, default: 0.5, minimum: 0, maximum: 1

Defines the alpha factor for the inside.

Inside Albedo Mix

name: insideAlbedoMix, type: Float, default: 1, minimum: 0, maximum: 1

Defines how much of the inside geometry color is mixed in (0 = insideColor field only, 1 = insideColor * geometry color).

Use GPU filling

name: useGPUFilling, type: Bool, default: TRUE

If enabled, the GPU is used for filling the intersection of closed objects. When the geometry shader is used for rendering the intersection, the filling is always done with the GPU, regardless of this setting. The GPU filling usually works on AMD/NVidia/Mesa and Intel.

Use Geometry Shader

name: useGeometryShader, type: Bool, default: TRUE

If enabled, the module makes use of the geometry shader to calculate the intersection and filling on the GPU. This will only be used if the hardware supports it, see Geometry Shader Supported.

Geometry Shader Supported

name: geometryShaderSupported, type: Bool, persistent: no

Indicates if the current hardware supports geometry shaders. This is off by default on MESA and Intel cards.

Gpu Filling Supported

name: gpuFillingSupported, type: Bool, persistent: no

Shows if filling with the GPU is supported.

Hidden Fields

renderCaching

name: renderCaching, type: Enum, default: AUTO

Values:

Title Name
On ON
Off OFF
Auto AUTO

boundingBoxCaching

name: boundingBoxCaching, type: Enum, default: AUTO

Values:

Title Name
On ON
Off OFF
Auto AUTO

renderCulling

name: renderCulling, type: Enum, default: AUTO

Values:

Title Name
On ON
Off OFF
Auto AUTO

pickCulling

name: pickCulling, type: Enum, default: AUTO

Values:

Title Name
On ON
Off OFF
Auto AUTO