Palomino - Shadows

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


Contents

Shadows


Overview

[2009/05]

The class ShadowGraph is a facade over the shadow algorithm implementation (osgShadow::MinimalShadowMap). ShadowGraph forms a separate graph containing objects which either cast or receive shadows.

NodeSort defines whether an object is a shadow caster or receiver. SceneGraph::AttachObject(Object,NodeSort) ordinarily attaches nodes to its branch nodes, but for a shadow caster/receiver, SceneGraph routes it to ShadowGraph instead. SceneGraph would attach it under a special branch node having the appropriate shader. But rather ShadowGraph has to attach the shader to the node directly because ShadowGraph doesn't have any branch nodes.

The shaders were modified to apply shadows if uni_shadowMode is set. uni_shadowMode can be assigned UNI_SHADOW_SAMPLE1 or UNI_SHADOW_SAMPLE4 for super-sampling which produces soft shadows.

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

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


Last modified: Fri May 15 14:05:56 CDT 2009