SoShadowMapping

InventorModule
author Florian Link
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 currently does not allow to extend the used shader with own GLSL code, if you have needs for this, contact florian@mevis.de.

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

Visible Fields

Enabled

name: enabled, 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.

Light Polar Rho

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

The polar coordinate rho.

Light Polar Phi

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.

Ambient Color

name: lightAmbientColor, type: Color, default: 0.200000002980232 0.200000002980232 0.200000002980232

Defines the ambient light color.

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
Single SINGLE A single shadow fetch is done. (Very sharp edges and aliasing).
Pcf PCF Percent closer filtering done by the hardware (smoother edges).
Pcf 4tap PCF_4TAP Four PCF samples are bilinear interpolated.
Pcf 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.

Enable Texture Mapping

name: enableTextureMapping, type: Bool, default: FALSE

Enables the default Open Inventor texture mapping on the rendered geometry. Only enable this if the geometry in the scene uses texture mapping, otherwise the rendering will be black.

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