Parallel Split Shadow Map (PSSM) shadow camera setup. More...
#include <OgreShadowCameraSetupPSSM.h>
Public Types | |
typedef vector< Real >::type | OptimalAdjustFactorList |
typedef vector< Real >::type | SplitPointList |
Public Member Functions | |
PSSMShadowCameraSetup () | |
Constructor, defaults to 3 splits. More... | |
~PSSMShadowCameraSetup () | |
void | calculateSplitPoints (uint splitCount, Real nearDist, Real farDist, Real lambda=0.95) |
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 SplitPointList & | getSplitPoints () 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... | |
void | operator delete (void *ptr) |
void | operator delete (void *ptr, void *) |
void | operator delete (void *ptr, const char *, int, const char *) |
void | operator delete[] (void *ptr) |
void | operator delete[] (void *ptr, const char *, int, const char *) |
void * | operator new (size_t sz, const char *file, int line, const char *func) |
operator new, with debug line info More... | |
void * | operator new (size_t sz) |
void * | operator new (size_t sz, void *ptr) |
placement operator new More... | |
void * | operator new[] (size_t sz, const char *file, int line, const char *func) |
array operator new, with debug line info More... | |
void * | operator new[] (size_t sz) |
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... | |
Protected Member Functions | |
Matrix4 | buildFrustumProjection (Real left, Real right, Real bottom, Real top, Real near, Real far) const |
Builds a frustum matrix. More... | |
Matrix4 | buildViewMatrix (const Vector3 &pos, const Vector3 &dir, const Vector3 &up) const |
Builds a view matrix. More... | |
void | calculateB (const SceneManager &sm, const Camera &cam, const Light &light, const AxisAlignedBox &sceneBB, const AxisAlignedBox &receiverBB, PointListBody *out_bodyB) const |
Calculates the intersection bodyB. More... | |
Matrix4 | calculateLiSPSM (const Matrix4 &lightSpace, const PointListBody &bodyB, const PointListBody &bodyLVS, const SceneManager &sm, const Camera &cam, const Light &light) const |
Calculates the LiSPSM projection matrix P. More... | |
void | calculateLVS (const SceneManager &sm, const Camera &cam, const Light &light, const AxisAlignedBox &sceneBB, PointListBody *out_LVS) const |
Calculates the bodyLVS. More... | |
Real | calculateNOpt (const Matrix4 &lightSpace, const AxisAlignedBox &bodyBABB_ls, const PointListBody &bodyLVS, const Camera &cam) const |
Calculates the distance between camera position and near clipping plane. More... | |
Real | calculateNOptSimple (const PointListBody &bodyLVS, const Camera &cam) const |
Calculates a simpler version than the one above. More... | |
void | calculateShadowMappingMatrix (const SceneManager &sm, const Camera &cam, const Light &light, Matrix4 *out_view, Matrix4 *out_proj, Camera *out_cam) const |
Calculates the standard shadow mapping matrix. More... | |
Vector3 | calculateZ0_ls (const Matrix4 &lightSpace, const Vector3 &e, Real bodyB_zMax_ls, const Camera &cam) const |
Calculates the visible point on the near plane for the n_opt calculation. More... | |
Vector3 | getLSProjViewDir (const Matrix4 &lightSpace, const Camera &cam, const PointListBody &bodyLVS) const |
Returns the projection view direction. More... | |
Vector3 | getNearCameraPoint_ws (const Matrix4 &viewMatrix, const PointListBody &bodyLVS) const |
Returns a valid near-point seen by the camera. More... | |
Matrix4 | transformToUnitCube (const Matrix4 &m, const PointListBody &body) const |
Transforms a given body to the unit cube (-1,-1,-1) / (+1,+1,+1) with a specific shadow matrix enabled. More... | |
Protected Attributes | |
ConvexBody | mBodyB |
Real | mCosCamLightDirThreshold |
Threshold (cos angle) within which to start increasing the opt adjust as camera direction approaches light direction. More... | |
size_t | mCurrentIteration |
Camera * | mLightFrustumCamera |
Temporary preallocated camera to set up a light frustum for clipping in FocusedShadowCameraSetup::calculateB. More... | |
bool | mLightFrustumCameraCalculated |
Real | mOptAdjustFactor |
Warp factor adjustment. More... | |
Real | mOptAdjustFactorTweak |
Extra calculated warp factor. More... | |
OptimalAdjustFactorList | mOptimalAdjustFactors |
PointListBody | mPointListBodyB |
PointListBody | mPointListBodyLVS |
uint | mSplitCount |
Real | mSplitPadding |
SplitPointList | mSplitPoints |
Frustum * | mTempFrustum |
Temporary preallocated frustum to set up a projection matrix in calculateShadowMappingMatrix(). More... | |
bool | mUseAggressiveRegion |
Use tighter focus region? More... | |
bool | mUseSimpleNOpt |
Use simple nopt derivation? More... | |
Static Protected Attributes | |
static const Matrix4 | msLightSpaceToNormal |
static const Matrix4 | msNormalToLightSpace |
Transform to or from light space as defined by Wimmer et al. More... | |
Parallel Split Shadow Map (PSSM) shadow camera setup.
Definition at line 56 of file OgreShadowCameraSetupPSSM.h.
typedef vector<Real>::type Ogre::PSSMShadowCameraSetup::OptimalAdjustFactorList |
Definition at line 60 of file OgreShadowCameraSetupPSSM.h.
typedef vector<Real>::type Ogre::PSSMShadowCameraSetup::SplitPointList |
Definition at line 59 of file OgreShadowCameraSetupPSSM.h.
Ogre::PSSMShadowCameraSetup::PSSMShadowCameraSetup | ( | ) |
Constructor, defaults to 3 splits.
Ogre::PSSMShadowCameraSetup::~PSSMShadowCameraSetup | ( | ) |
|
protectedinherited |
Builds a frustum matrix.
|
protectedinherited |
Builds a view matrix.
|
protectedinherited |
Calculates the intersection bodyB.
sm | Scene manager. |
cam | Currently active camera. |
light | Currently active light. |
sceneBB | Scene bounding box for clipping operations. |
receiverBB | Bounding information for just the receivers. |
out_bodyB | Final intersection bodyB point list. |
|
protectedinherited |
Calculates the LiSPSM projection matrix P.
lightSpace | Matrix of the light space transformation |
bodyB | Intersection body B |
bodyLVS | Intersection body LVS (relevant space in front of the camera) |
sm | Scene manager |
cam | Currently active camera |
light | Currently active light |
|
protectedinherited |
Calculates the bodyLVS.
cam | Current viewer camera. |
light | Current light. |
sceneBB | Holds all potential occluders / receivers as one single bounding box of the currently active scene node. |
out_LVS | Intersection body LVS (world coordinates). |
|
protectedinherited |
Calculates the distance between camera position and near clipping plane.
Formula: d n_opt = ------------— sqrt(z1/z0) - 1
Parameters: d: distance between the near and the far clipping plane z0: located on the near clipping plane of the intersection body b z1: located on the far clipping plane with the same x/y values as z0
lightSpace | Matrix of the light space transformation |
bodyBABB_ls | Bounding box of the transformed (light space) bodyB |
bodyLVS | Point list of the bodyLVS which describes the scene space which is in front of the light and the camera |
cam | Currently active camera |
|
protectedinherited |
Calculates a simpler version than the one above.
|
protectedinherited |
Calculates the standard shadow mapping matrix.
sm | Scene manager. |
cam | Currently active camera. |
light | Currently active light. |
out_view | Calculated uniform view shadow mapping matrix (may be NULL ). |
out_proj | Calculated uniform projection shadow mapping matrix (may be NULL ). |
out_cam | Calculated uniform shadow camera (may be NULL ). |
void Ogre::PSSMShadowCameraSetup::calculateSplitPoints | ( | uint | splitCount, |
Real | nearDist, | ||
Real | farDist, | ||
Real | lambda = 0.95 |
||
) |
Calculate a new splitting scheme.
splitCount | The number of splits to use |
nearDist | The near plane to use for the first split |
farDist | The far plane to use for the last split |
lambda | Factor to use to reduce the split size |
|
protectedinherited |
Calculates the visible point on the near plane for the n_opt calculation.
lightSpace | Matrix of the light space transformation |
e | The LiSPSM parameter e is located near or on the near clipping plane of the LiSPSM frustum C |
bodyB_zMax_ls | Maximum z-value of the light space bodyB bounding box |
cam | Currently active camera |
|
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.
|
protectedinherited |
Returns the projection view direction.
lightSpace | Matrix of the light space transformation. |
cam | Current viewer camera. |
bodyLVS | Intersection body LVS (relevant space in front of the camera). |
|
protectedinherited |
Returns a valid near-point seen by the camera.
viewMatrix | View matrix of the current camera. |
bodyLVS | Intersection body LVS (relevant space in front of the camera). |
|
inline |
Returns the optimal adjust factor for a given split.
Definition at line 117 of file OgreShadowCameraSetupPSSM.h.
|
virtual |
Overridden, recommended internal use only since depends on current iteration.
Reimplemented from Ogre::LiSPSMShadowCameraSetup.
|
virtual |
Returns a LiSPSM shadow camera with PSSM splits base on iteration.
Reimplemented from Ogre::LiSPSMShadowCameraSetup.
|
inline |
Get the number of splits.
Definition at line 106 of file OgreShadowCameraSetupPSSM.h.
|
inline |
Get the padding factor to apply to the near & far distances when matching up splits to one another, to avoid 'cracks'.
Definition at line 104 of file OgreShadowCameraSetupPSSM.h.
|
inline |
Returns the calculated split points.
Definition at line 113 of file OgreShadowCameraSetupPSSM.h.
|
inlineinherited |
Definition at line 305 of file OgreShadowCameraSetupFocused.h.
|
inlinevirtualinherited |
Gets whether or not to use a slightly simpler version of the camera near point derivation (default is true)
Definition at line 228 of file OgreShadowCameraSetupLiSPSM.h.
|
inlineinherited |
Definition at line 96 of file OgreMemoryAllocatedObject.h.
|
inlineinherited |
Definition at line 102 of file OgreMemoryAllocatedObject.h.
|
inlineinherited |
Definition at line 108 of file OgreMemoryAllocatedObject.h.
|
inlineinherited |
Definition at line 113 of file OgreMemoryAllocatedObject.h.
|
inlineinherited |
Definition at line 119 of file OgreMemoryAllocatedObject.h.
|
inlineinherited |
operator new, with debug line info
Definition at line 68 of file OgreMemoryAllocatedObject.h.
|
inlineinherited |
Definition at line 73 of file OgreMemoryAllocatedObject.h.
|
inlineinherited |
placement operator new
Definition at line 79 of file OgreMemoryAllocatedObject.h.
|
inlineinherited |
array operator new, with debug line info
Definition at line 86 of file OgreMemoryAllocatedObject.h.
|
inlineinherited |
Definition at line 91 of file OgreMemoryAllocatedObject.h.
|
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.
void Ogre::PSSMShadowCameraSetup::setOptimalAdjustFactor | ( | size_t | splitIndex, |
Real | factor | ||
) |
Set the LiSPSM optimal adjust factor for a given split (call after configuring splits).
|
inlinevirtualinherited |
Adjusts the parameter n to produce optimal shadows.
n | The adjustment factor - default is 0.1f. |
Definition at line 216 of file OgreShadowCameraSetupLiSPSM.h.
|
inline |
Set the padding factor to apply to the near & far distances when matching up splits to one another, to avoid 'cracks'.
Definition at line 99 of file OgreShadowCameraSetupPSSM.h.
void Ogre::PSSMShadowCameraSetup::setSplitPoints | ( | const SplitPointList & | newSplitPoints | ) |
Manually configure a new splitting scheme.
newSplitPoints | A 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. |
|
inlineinherited |
Sets whether or not to use the more aggressive approach to deciding on the focus region or not.
aggressive | True to use the more aggressive approach, false otherwise. |
Definition at line 303 of file OgreShadowCameraSetupFocused.h.
|
inlinevirtualinherited |
Sets whether or not to use a slightly simpler version of the camera near point derivation (default is true)
Definition at line 224 of file OgreShadowCameraSetupLiSPSM.h.
|
protectedinherited |
Transforms a given body to the unit cube (-1,-1,-1) / (+1,+1,+1) with a specific shadow matrix enabled.
m | Transformation matrix applied on the point list body. |
body | Contains the points of the extends of all valid scene elements which are mapped to the unit cube. |
|
mutableprotectedinherited |
Definition at line 145 of file OgreShadowCameraSetupFocused.h.
|
protectedinherited |
Threshold (cos angle) within which to start increasing the opt adjust as camera direction approaches light direction.
Definition at line 108 of file OgreShadowCameraSetupLiSPSM.h.
|
mutableprotected |
Definition at line 68 of file OgreShadowCameraSetupPSSM.h.
|
protectedinherited |
Temporary preallocated camera to set up a light frustum for clipping in FocusedShadowCameraSetup::calculateB.
Definition at line 78 of file OgreShadowCameraSetupFocused.h.
|
mutableprotectedinherited |
Definition at line 79 of file OgreShadowCameraSetupFocused.h.
|
protectedinherited |
Warp factor adjustment.
Definition at line 102 of file OgreShadowCameraSetupLiSPSM.h.
|
mutableprotectedinherited |
Extra calculated warp factor.
Definition at line 106 of file OgreShadowCameraSetupLiSPSM.h.
|
protected |
Definition at line 65 of file OgreShadowCameraSetupPSSM.h.
|
mutableprotectedinherited |
Definition at line 146 of file OgreShadowCameraSetupFocused.h.
|
mutableprotectedinherited |
Definition at line 147 of file OgreShadowCameraSetupFocused.h.
|
staticprotectedinherited |
Definition at line 69 of file OgreShadowCameraSetupFocused.h.
|
staticprotectedinherited |
Transform to or from light space as defined by Wimmer et al.
Definition at line 68 of file OgreShadowCameraSetupFocused.h.
|
protected |
Definition at line 63 of file OgreShadowCameraSetupPSSM.h.
|
protected |
Definition at line 66 of file OgreShadowCameraSetupPSSM.h.
|
protected |
Definition at line 64 of file OgreShadowCameraSetupPSSM.h.
|
protectedinherited |
Temporary preallocated frustum to set up a projection matrix in calculateShadowMappingMatrix().
Definition at line 74 of file OgreShadowCameraSetupFocused.h.
|
protectedinherited |
Use tighter focus region?
Definition at line 82 of file OgreShadowCameraSetupFocused.h.
|
protectedinherited |
Use simple nopt derivation?
Definition at line 104 of file OgreShadowCameraSetupLiSPSM.h.