SoShaderPipelineSurfaceShader

InventorModule

author

MeVis Medical Solutions AG

package

MeVisLab/Standard

dll

SoShaderPipeline

definition

SoShaderPipeline.def

Purpose

The SoShaderPipelineSurfaceShader module allows for defining the properties of the surface that are used by the lighting model. The lighting itself is given via the SoShaderPipelineLightModel.

A typical use case for a surface shader is to change material properties of the surface, e.g., the diffuse and specular color, or the specularity. It can make use of texture to have per-pixel material properties, e.g., a specular map, an alpha map, a normal map.

The resulting material parameters are used by the light model for each individual light. Thus, surface shading and the lighting model can be exchanged separately.

Usage

The module is derived from the SoShaderPipelineFunction module and extends the surface shader step of the pipeline. If per-fragment shading is enabled, the surface shader is applied in the fragment shader. If per-vertex shading is used instead, the surface shader will only run per vertex, to normal and texture mapping will not work well in per-vertex shading.

The following state variables are typically modified by a surface shader:

state float surfaceShininess
state vec3  surfaceDiffuse
state float surfaceAlpha
state vec3  surfaceSpecular

You can also add your own surface properties to the state and make use of them inside of a custom light model (see SoShaderPipelineLightModel).

You can add your own uniforms and texture samplers using the GLSL shader framework of MeVisLab, e.g., SoShaderParameter3f, SoGVRShaderParameterPosition, and SoMLSampler3D.

Windows

Default Panel

../../../Modules/Inventor/SoShaderPipeline/mhelp/Images/Screenshots/SoShaderPipelineSurfaceShader._default.png

Parameter Fields

Field Index

Enabled: Bool

Replacement1: String

Function Body: String

Replacement2: String

Function Display: String

Replacement3: String

Function Name: String

Parameter Declaration: String

Replaced1: String

Replaced2: String

Replaced3: String

Visible Fields

Enabled

name: enabled, type: Bool, default: TRUE

If checked, the surface shader is enabled.

Function Name

name: functionName, type: String

Sets the name of the surface shader.

Function Body

name: functionBody, type: String

Sets the surface shader function body.

Parameter Declaration

name: parameterDeclaration, type: String

See SoShaderPipelineFunction.parameterDeclaration.

Function Display

name: functionDisplay, type: String, persistent: no

Replaced1

name: replaced1, type: String

Replacement1

name: replacement1, type: String

Replaced2

name: replaced2, type: String

Replacement2

name: replacement2, type: String

Replaced3

name: replaced3, type: String

Replacement3

name: replacement3, type: String