OGRE  1.11.6
Object-Oriented Graphics Rendering Engine
Ogre::PSSMShadowCameraSetup Class Reference

Parallel Split Shadow Map (PSSM) shadow camera setup. More...

#include <OgreShadowCameraSetupPSSM.h>

+ Inheritance diagram for Ogre::PSSMShadowCameraSetup:

Public Types

typedef std::vector< RealOptimalAdjustFactorList
 
typedef std::vector< RealSplitPointList
 

Public Member Functions

 PSSMShadowCameraSetup ()
 
virtual ~PSSMShadowCameraSetup ()
 
void calculateSplitPoints (uint splitCount, Real nearDist, Real farDist, Real lambda=0.95f)
 Calculate a new splitting scheme. More...
 
virtual Degree getCameraLightDirectionThreshold () const
 Sets the threshold between the camera and the light direction below which the LiSPSM projection is 'flattened', since coincident light and camera projections cause problems with the perspective skew. More...
 
Real getOptimalAdjustFactor (size_t splitIndex) const
 Returns the optimal adjust factor for a given split. More...
 
Real getOptimalAdjustFactor () const
 Overridden, recommended internal use only since depends on current iteration. More...
 
virtual void getShadowCamera (const Ogre::SceneManager *sm, const Ogre::Camera *cam, const Ogre::Viewport *vp, const Ogre::Light *light, Ogre::Camera *texCam, size_t iteration) const
 Returns a LiSPSM shadow camera with PSSM splits base on iteration. More...
 
uint getSplitCount () const
 Get the number of splits. More...
 
Real getSplitPadding () const
 Get the padding factor to apply to the near & far distances when matching up splits to one another, to avoid 'cracks'. More...
 
const SplitPointListgetSplitPoints () const
 Returns the calculated split points. More...
 
bool getUseAggressiveFocusRegion () const
 
virtual bool getUseSimpleOptimalAdjust () const
 Gets whether or not to use a slightly simpler version of the camera near point derivation (default is true) More...
 
virtual void setCameraLightDirectionThreshold (Degree angle)
 Sets the threshold between the camera and the light direction below which the LiSPSM projection is 'flattened', since coincident light and camera projections cause problems with the perspective skew. More...
 
void setOptimalAdjustFactor (size_t splitIndex, Real factor)
 Set the LiSPSM optimal adjust factor for a given split (call after configuring splits). More...
 
virtual void setOptimalAdjustFactor (Real n)
 Adjusts the parameter n to produce optimal shadows. More...
 
void setSplitPadding (Real pad)
 Set the padding factor to apply to the near & far distances when matching up splits to one another, to avoid 'cracks'. More...
 
void setSplitPoints (const SplitPointList &newSplitPoints)
 Manually configure a new splitting scheme. More...
 
void setUseAggressiveFocusRegion (bool aggressive)
 Sets whether or not to use the more aggressive approach to deciding on the focus region or not. More...
 
virtual void setUseSimpleOptimalAdjust (bool s)
 Sets whether or not to use a slightly simpler version of the camera near point derivation (default is true) More...
 

Static Public Member Functions

static ShadowCameraSetupPtr create ()
 Constructor, defaults to 3 splits. More...
 
static ShadowCameraSetupPtr create (Real n=0.1f, bool useSimpleNOpt=true, Degree angle=Radian(0.451))
 
static ShadowCameraSetupPtr create (bool useAggressiveRegion=true)
 Create an instance. More...
 

Detailed Description

Parallel Split Shadow Map (PSSM) shadow camera setup.

Remarks
A PSSM shadow system uses multiple shadow maps per light and maps each texture into a region of space, progressing away from the camera. As such it is most appropriate for directional light setups. This particular version also uses LiSPSM projection for each split to maximise the quality.
Note
Because PSSM uses multiple shadow maps per light, you will need to increase the number of shadow textures available (via SceneManager) to match the number of shadow maps required (default is 3 per light).

Member Typedef Documentation

◆ SplitPointList

◆ OptimalAdjustFactorList

Constructor & Destructor Documentation

◆ PSSMShadowCameraSetup()

Ogre::PSSMShadowCameraSetup::PSSMShadowCameraSetup ( )

◆ ~PSSMShadowCameraSetup()

virtual Ogre::PSSMShadowCameraSetup::~PSSMShadowCameraSetup ( )
virtual

Member Function Documentation

◆ create() [1/3]

static ShadowCameraSetupPtr Ogre::PSSMShadowCameraSetup::create ( )
inlinestatic

Constructor, defaults to 3 splits.

◆ calculateSplitPoints()

void Ogre::PSSMShadowCameraSetup::calculateSplitPoints ( uint  splitCount,
Real  nearDist,
Real  farDist,
Real  lambda = 0.95f 
)

Calculate a new splitting scheme.

Parameters
splitCountThe number of splits to use
nearDistThe near plane to use for the first split
farDistThe far plane to use for the last split
lambdaFactor to use to reduce the split size

◆ setSplitPoints()

void Ogre::PSSMShadowCameraSetup::setSplitPoints ( const SplitPointList newSplitPoints)

Manually configure a new splitting scheme.

Parameters
newSplitPointsA list which is splitCount + 1 entries long, containing the split points. The first value is the near point, the last value is the far point, and each value in between is both a far point of the previous split, and a near point for the next one.

◆ setOptimalAdjustFactor() [1/2]

void Ogre::PSSMShadowCameraSetup::setOptimalAdjustFactor ( size_t  splitIndex,
Real  factor 
)

Set the LiSPSM optimal adjust factor for a given split (call after configuring splits).

◆ setSplitPadding()

void Ogre::PSSMShadowCameraSetup::setSplitPadding ( Real  pad)
inline

Set the padding factor to apply to the near & far distances when matching up splits to one another, to avoid 'cracks'.

◆ getSplitPadding()

Real Ogre::PSSMShadowCameraSetup::getSplitPadding ( ) const
inline

Get the padding factor to apply to the near & far distances when matching up splits to one another, to avoid 'cracks'.

◆ getSplitCount()

uint Ogre::PSSMShadowCameraSetup::getSplitCount ( ) const
inline

Get the number of splits.

◆ getShadowCamera()

virtual void Ogre::PSSMShadowCameraSetup::getShadowCamera ( const Ogre::SceneManager sm,
const Ogre::Camera cam,
const Ogre::Viewport vp,
const Ogre::Light light,
Ogre::Camera texCam,
size_t  iteration 
) const
virtual

Returns a LiSPSM shadow camera with PSSM splits base on iteration.

Reimplemented from Ogre::LiSPSMShadowCameraSetup.

◆ getSplitPoints()

const SplitPointList& Ogre::PSSMShadowCameraSetup::getSplitPoints ( ) const
inline

Returns the calculated split points.

◆ getOptimalAdjustFactor() [1/2]

Real Ogre::PSSMShadowCameraSetup::getOptimalAdjustFactor ( size_t  splitIndex) const
inline

Returns the optimal adjust factor for a given split.

◆ getOptimalAdjustFactor() [2/2]

Real Ogre::PSSMShadowCameraSetup::getOptimalAdjustFactor ( ) const
virtual

Overridden, recommended internal use only since depends on current iteration.

Reimplemented from Ogre::LiSPSMShadowCameraSetup.

◆ create() [2/3]

static ShadowCameraSetupPtr Ogre::LiSPSMShadowCameraSetup::create ( Real  n = 0.1f,
bool  useSimpleNOpt = true,
Degree  angle = Radian(0.451) 
)
inlinestaticinherited
Parameters
nThe adjustment factor
useSimpleNOpt
anglecamera Light Direction Threshold

◆ create() [3/3]

static ShadowCameraSetupPtr Ogre::FocusedShadowCameraSetup::create ( bool  useAggressiveRegion = true)
inlinestaticinherited

Create an instance.

There are 2 approaches that can be used to define the focus region, the more aggressive way introduced by Wimmer et al, or the original way as described in Stamminger et al. Wimmer et al's way tends to come up with a tighter focus region but in rare cases (mostly highly glancing angles) can cause some shadow casters to be clipped incorrectly. By default the more aggressive approach is used since it leads to significantly better results in most cases, but if you experience clipping issues, you can use the less aggressive version.

Parameters
aggressiveTrue to use the more aggressive approach, false otherwise.

◆ setOptimalAdjustFactor() [2/2]

virtual void Ogre::LiSPSMShadowCameraSetup::setOptimalAdjustFactor ( Real  n)
inlinevirtualinherited

Adjusts the parameter n to produce optimal shadows.

Remarks
The smaller the parameter n, the stronger the perspective warping effect. The consequence of a stronger warping is that the near shadows will gain quality while the far ones will lose it. Depending on your scene and light types you may want to tweak this value - for example directional lights tend to benefit from higher values of n than other types of light, especially if you expect to see more distant shadows (say if the viewpoint is higher above the ground plane). Remember that you can supply separate ShadowCameraSetup instances configured differently per light if you wish.
Parameters
nThe adjustment factor - default is 0.1f.

◆ setUseSimpleOptimalAdjust()

virtual void Ogre::LiSPSMShadowCameraSetup::setUseSimpleOptimalAdjust ( bool  s)
inlinevirtualinherited

Sets whether or not to use a slightly simpler version of the camera near point derivation (default is true)

◆ getUseSimpleOptimalAdjust()

virtual bool Ogre::LiSPSMShadowCameraSetup::getUseSimpleOptimalAdjust ( ) const
inlinevirtualinherited

Gets whether or not to use a slightly simpler version of the camera near point derivation (default is true)

◆ setCameraLightDirectionThreshold()

virtual void Ogre::LiSPSMShadowCameraSetup::setCameraLightDirectionThreshold ( Degree  angle)
virtualinherited

Sets the threshold between the camera and the light direction below which the LiSPSM projection is 'flattened', since coincident light and camera projections cause problems with the perspective skew.

Remarks
For example, setting this to 20 degrees will mean that as the difference between the light and camera direction reduces from 20 degrees to 0 degrees, the perspective skew will be proportionately removed.

◆ getCameraLightDirectionThreshold()

virtual Degree Ogre::LiSPSMShadowCameraSetup::getCameraLightDirectionThreshold ( ) const
virtualinherited

Sets the threshold between the camera and the light direction below which the LiSPSM projection is 'flattened', since coincident light and camera projections cause problems with the perspective skew.

◆ setUseAggressiveFocusRegion()

void Ogre::FocusedShadowCameraSetup::setUseAggressiveFocusRegion ( bool  aggressive)
inlineinherited

Sets whether or not to use the more aggressive approach to deciding on the focus region or not.

◆ getUseAggressiveFocusRegion()

bool Ogre::FocusedShadowCameraSetup::getUseAggressiveFocusRegion ( ) const
inlineinherited

The documentation for this class was generated from the following file: