SoShadowMapping

InventorModule
author MeVis Medical Solutions AG
package MeVisLab/Standard
dll SoShadowMapping
definition SoShadowMapping.def
see also SoShadowCast
keywords cascaded, hardware, soft, PCF, percentage, closer, depth, perception

Purpose

The SoShadowMapping renders the scene that is located below itself using Cascaded Shadow Mapping. The module renders shadows for a single directional light source.

It is based on the NVidia SDK sample at http://developer.download.nvidia.com/SDK/10/opengl/samples.html#cascaded_shadow_maps and has been ported to work inside Open Inventor.

Example screenshot:

../../../Modules/Inventor/SoShadowMapping/mhelp/Images/SoShadowMappingExample.png

Usage

Just add Open Inventor geometry below the node and the will be rendered with shadows.

Details

This module requires OpenGL 2.0, GLSL 1.20 and texture arrays.

It makes use of the GLSL Shader Pipeline and extends the pipeline with a shadowed light. Currently only a single directional light is supported.

The “Percentage Closer Soft Shadow” (PCSS) mode uses code provided by NVidia which was ported to from HLSL to GLSL. This software contains source code provided by NVIDIA Corporation.

Windows

Default Panel

../../../Modules/Inventor/SoShadowMapping/mhelp/Images/Screenshots/SoShadowMapping._default.png

Input Fields

child

name: child, type: SoNode

Output Fields

self

name: self, type: SoNode

Parameter Fields

Field Index

Altitude: Float Shadow Darkness: Float
Attach Light To Camera: Bool Shadow Map Size: Integer
Azimuth: Float Shadow Map Splits: Integer
Debug Depth Textures: Bool Shadow Mode: Enum
Diffuse Color: Color supported: Bool
Enabled: Bool  
Penumbra Angle: Float  
Replace Lighting: Bool  

Visible Fields

Enabled

name: enabled, type: Bool, default: TRUE

Replace Lighting

name: replaceLighting, type: Bool, default: TRUE

Shadow Map Size

name: shadowMapSize, type: Integer, default: 2048

Defines the size of the shadow map (should be a power of two for better performance)

Shadow Map Splits

name: shadowMapSplits, type: Integer, default: 3, minimum: 1, maximum: 4

Defines the number of frustum splits (and thus the number of shadow maps that are generated), setting this to 1 results in standard shadow mapping. Using 4 splits takes most resources but allows scenes with very near and very far objects, while still rendering high detail shadows on the near objects.

Attach Light To Camera

name: attachLightToCamera, type: Bool, default: TRUE

If enabled, the light angles are relative to the viewing direction of the camera.

Altitude

name: lightPolarRho, type: Float, default: -45

The polar coordinate rho.

Azimuth

name: lightPolarPhi, type: Float, default: 45

The polar coordinate phi.

Diffuse Color

name: lightDiffuseColor, type: Color, default: 1 1 1

Defines the diffuse color of the directional light.

Shadow Darkness

name: shadowDarkness, type: Float, default: 0.80000001, minimum: 0, maximum: 1

Defines how dark the shadow is (1. means black, 0. means fully transparent)

Penumbra Angle

name: penumbraAngle, type: Float, default: 1, minimum: 0.1, maximum: 3

Defines the penumbra angle in degrees for the PCSS soft shadow mode.

Shadow Mode

name: shadowMode, type: Enum, default: PCF_GAUSSIAN_3X3

Defines how the shadow is rendered.

Values:

Title Name Description
Hard Shadows SINGLE A single shadow fetch is done. (Very sharp edges and aliasing).
Hard Shadows - PCF PCF Percent closer filtering done by the hardware (smoother edges).
Hard Shadows - PCF 4 Tap PCF_4TAP Four PCF samples are bilinear interpolated.
Hard Shadows - Gaussian 3x3 PCF_GAUSSIAN_3X3 A 3x3 Gaussian filter is used (using 9 PCF samples). This results in the smoothest shadow edges.
Percentage Closer Soft Shadows PCSS Percentage Closer Soft Shadow mapping as described in http://developer.download.nvidia.com/whitepapers/2008/PCSS_Integration.pdf The implementation uses a directional light which has a fixed penumbra slope angle.

Debug Depth Textures

name: debugDepthTextures, type: Bool, default: FALSE

If enabled, the cascaded shadow maps are rendered to the screen.

Hidden Fields

supported

name: supported, type: Bool, default: TRUE