SoShaderPipeline

InventorModule
author MeVis Medical Solutions AG
package MeVisLab/Standard
dll SoShaderPipeline
definition SoShaderPipeline.def
keywords GLSL

Purpose

The SoShaderPipeline module creates and enables a GLSL shader that represents the current Open Inventor fixed function state and all shader extensions that are located before this module.

For more details on the shader pipeline, have a look at the GLSL Shader Pipeline.

The default shader pipeline generates shader code for the Open Inventor fixed function state: - all Open Inventor lights (SoDirectionalLight, SoPointLight, SoPointLight) - texturing (SoTexture2, SoMLTexture2) - fog (SoEnvironment) - material properties (SoMaterial, SoVertexProperty)

By default, high quality per-fragment shading is used. This can be switched to per-vertex shading, which is the default in the legacy OpenGL fixed function functionality.

NOTE: Automatic texture coordinate generation (as provided by fixed function state set by Open Inventor) is not supported, you need to write your own SoShaderPipelineFunction to implement texture coordinate generation.

Usage

Place the module anywhere in the scene graph and it will create and enable the generated GLSL shader.

For performance reasons, the generated shader will be cached. As long as neither the Open Inventor state nor the extensions in the state changes, the shader will not be regenerated.

To debug the generated shader, place a SoShaderPipelineDiagnosis module in front of the SoShaderPipeline.

Parameter Fields

Visible Fields

Lighting

name: lighting, type: Enum, default: LIGHTING_PER_FRAGMENT, deprecated name: fixedFunctionLighting

Enable lighting for the Open Inventor lights.

Values:

Title Name Description
Per Fragment LIGHTING_PER_FRAGMENT Per-fragment lighting provides the highest rendering quality and offers nice specular highlights. It is enabled by default and should only be disabled if the fragment shader is a performance bottleneck.
Per Vertex LIGHTING_PER_VERTEX Lighting is calculated per-vertex and the interpolated result is written in the fragment shader. This only provides low-quality specular highlights and many rendering techniques, (shadow mapping, normal mapping, point sprite lighting, …) are not supported.
Off LIGHTING_OFF Turns the lighting off, the vertex color will be written as result color.

Texturing

name: texturing, type: Enum, default: TEXTURING_AUTO, deprecated name: fixedFunctionTexturing

Enables texturing via Open Inventor texturing modules (SoTexture2 and SoMLTexture2).

Values:

Title Name Description
Auto TEXTURING_AUTO Detect texturing using the Open Inventor state BEFORE the module.
On TEXTURING_ON Forces fixed function texturing. Make sure that you always place a texture into the scene.
Off TEXTURING_OFF Turns fixed function texturing off.

Double Sided Lighting

name: doubleSidedLighting, type: Bool, default: FALSE

Enables double sided lighting, which calculates the Lambertian dot product using abs(NdotL) instead of max(0, NdotL).