SoShadowDirectionalLight(3)

NAME
SoShadowDirectionalLight - The SoShadowDirectionalLight class is a node for setting up a directional light which casts shadows.

SYNOPSIS

#include <Inventor/annex/FXViz/nodes/SoShadowDirectionalLight.h>

Inherits SoDirectionalLight.

  Public Member Functions
virtual SoType getTypeId (void) const
SoShadowDirectionalLight (void)
virtual void GLRender (SoGLRenderAction *action)

  Static Public Member Functions
static SoType getClassTypeId (void)
static void initClass (void)

  Public Attributes
SoSFNode shadowMapScene
SoSFFloat maxShadowDistance
SoSFVec3f bboxCenter
SoSFVec3f bboxSize

  Protected Member Functions
virtual const SoFieldData * getFieldData (void) const
virtual ~SoShadowDirectionalLight ()

  Static Protected Member Functions
static const SoFieldData ** getFieldDataPtr (void)

  Additional Inherited Members

Detailed Description

The SoShadowDirectionalLight class is a node for setting up a directional light which casts shadows. Directional lights usually affect everything, but since it is not always feasible to use one shadow map for the entire scene graph. This node has some extra features to work around this.

It calculates the intersection between the current view volume and either the scene bounding box, or the bounding box provided in this node. The shadows are only calculated for this volume. This means that you'll get more detailed shadows as you zoom in on items in the scene graph.

In addition, you can set the maximum distance from the camera which will be shaded with shadows. Think of this a new far plane for the camera which only affects shadows.

As with SoShadowSpotLight, it's possible to optimize further by setting your own shadow caster scene graph in the shadowMapScene field.

The example scene graph below demonstrates how you can use this node to create shadows on a large number of objects, and still get decent precision when zooming in. To further reduce the volume covered by the shadow map, you can set maxShadowDistance to some number > 0. This is the distance from the camera where shadows will be visible.

DirectionalLight {
   direction 0 0 -1
   intensity 0.2
}
ShadowGroup {
  quality 1 # to get per pixel lighting
  precision 1
  ShadowDirectionalLight {
    direction 1 1 -1
    intensity 0.8
    # enable this to reduce the shadow view distance
    # maxShadowDistance 200
  }
  # 900 cubes spaced out over a fairly large area
  Array {
    origin CENTER
    numElements1 30
    numElements2 30
    numElements3 1
    separation1 20 0 0
    separation2 0 20 0
    separation3 0 0 0
    Material { diffuseColor 1 0 0 specularColor 1 1 1 }
    Cube { width 4 height 4 depth 4 }
  }
  # a chess board
  Coordinate3 { point [ -400 -400 -3, 400 -400 -3, 400 400 -3, -400 400 -3 ] }
  Material { specularColor 1 1 1 shininess 0.9 }
  Complexity { textureQuality 0.1 }
  Texture2 { image 2 2 3 0xffffff 0x225588 0x225588 0xffffff }
  Texture2Transform { scaleFactor 20 20 }
  FaceSet { numVertices 4 }
}

Since
    Coin 3.0

Constructor & Destructor Documentation

  SoShadowDirectionalLight::SoShadowDirectionalLight (void)
Constructor.

  SoShadowDirectionalLight::~SoShadowDirectionalLight () [protected], [virtual]
Destructor.

Member Function Documentation

  SoType SoShadowDirectionalLight::getClassTypeId (void) [static]
This static method returns the SoType object associated with objects of this class.

  SoType SoShadowDirectionalLight::getTypeId (void) const [virtual]
Returns the type identification of an object derived from a class inheriting SoBase. This is used for runtime type checking and 'downward' casting.

Reimplemented from SoDirectionalLight.

  const SoFieldData ** SoShadowDirectionalLight::getFieldDataPtr (void) [static], [protected]
This API member is considered internal to the library, as it is not likely to be of interest to the application programmer.
 Returns the SoFieldData class which holds information about fields in this node.

  const SoFieldData * SoShadowDirectionalLight::getFieldData (void) const [protected], [virtual]
Returns a pointer to the class-wide field data storage object for this instance. If no fields are present, returns NULL.

Reimplemented from SoDirectionalLight.

  void SoShadowDirectionalLight::initClass (void) [static]

  void SoShadowDirectionalLight::GLRender (SoGLRenderAction * action) [virtual]
Action method for the SoGLRenderAction.

This is called during rendering traversals. Nodes influencing the rendering state in any way or want to throw geometry primitives at OpenGL override this method.

Reimplemented from SoDirectionalLight.

Member Data Documentation

  SoSFNode SoShadowDirectionalLight::shadowMapScene
The shadow map scene graph. If this is NULL (the default), the node will behave as a normal SoDirectionalLight node.

  SoSFFloat SoShadowDirectionalLight::maxShadowDistance
The maximum distance (from the camera) that we'll see shadows from this light source.

  SoSFVec3f SoShadowDirectionalLight::bboxCenter
Can be used to specify the volume that should be used for calculating the resulting shadow volume.

  SoSFVec3f SoShadowDirectionalLight::bboxSize
Can be used to specify the volume that should be used for calculating the resulting shadow volume.

Author

Generated automatically by Doxygen for Coin from the source code.