# Palomino - Shadow Module

©2004,2009 Jim E. Brooks http://www.palomino3d.org

- Index
- Overview

## Overview

[2009/05]

### Shadow Scene-Graph

The class `ShadowSceneGraph` is a facade over the shadow algorithm implementation (osgShadow::MinimalShadowMap). ShadowSceneGraph is itself a private implementation of SceneGraph which encompasses the entire scene-graph. ShadowSceneGraph forms a separate graph containing objects which either cast or receive shadows.

### Scene-Graph Arrangement

NodeSort defines whether an object is a shadow caster or receiver. `SceneGraph::AttachObject(Object,NodeSort)` is the interface for attaching nodes. SceneGraph will detect thru NodeSort if a node is a shadow caster/receiver, and defer such nodes to ShadowSceneGraph.

    osgShadow::ShadowedScene -> ShadowSceneGraph::mShadowRootNode -> shadowCasters
                                                                     shadowReceivers

    The reason for this arrangement is to override
    the stock OSG shaders attached to osgShadow::ShadowedScene.

### Shadow Casters/Receivers

Disabling casting shadows for parts of a 3D model can be done by calling ShadowSceneGraph::DisableShadows(Node). An example is jet exhaust which shouldn't cast shadows.

The current implementation, osgShadow::MinimalShadowMap, will malfunction if multiple shadow casters exist. ShadowSceneGraph will ignore NodeSort=SHADOW_CASTER if one already exists.

### Shaders for Rendering Shadows

As it has the same BaseSceneGraph class as SceneGraph, ShadowSceneGraph maintains branch nodes containing shaders determined by NodeSort. The shaders will render shadows if `uni_shadowMode` is set. `uni_shadowMode` can be assigned `UNI_SHADOW_SAMPLE1` or `UNI_SHADOW_SAMPLE4` for super-sampling which produces <quote>soft shadows</quote>.

Last modified: Sat Nov 7 14:58:05 CST 2009