CustomPSSMShadowCameraSetup Class Reference

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

#include <CustomPSSMShadowCameraSetup.hh>

Inherits PSSMShadowCameraSetup.

Public Member Functions

 CustomPSSMShadowCameraSetup ()
 Constructor, defaults to 3 splits. More...
 
 ~CustomPSSMShadowCameraSetup ()
 Destructor. More...
 
Ogre::Matrix4 buildViewMatrix (const Ogre::Vector3 &_pos, const Ogre::Vector3 &_dir, const Ogre::Vector3 &_up) const
 The same as FocusedShadowCameraSetup::buildViewMatrix() except resulting matrices are z-up instead of y-up. More...
 
void calculateShadowMappingMatrix (const Ogre::SceneManager &_sm, const Ogre::Camera &_cam, const Ogre::Light &_light, Ogre::Matrix4 *_out_view, Ogre::Matrix4 *_outProj, Ogre::Camera *_outCam) const
 lightly modified FocusedShadowCameraSetup::calculateShadowMappingMatrix(). 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 override
 Returns a shadow camera with PSSM splits based on iteration. More...
 
virtual void getZUpFocusedShadowCamera (const Ogre::SceneManager *_sm, const Ogre::Camera *_cam, const Ogre::Viewport *_vp, const Ogre::Light *_light, Ogre::Camera *_texCam, size_t _iteration) const
 The same as FocusedShadowCameraSetup::ShadowCameraSetup() except resulting light frusta are z-up instead of y-up. More...
 

Detailed Description

Parallel Split Shadow Map (PSSM) shadow camera setup.

Ogre's LiSPSM algorithm makes buggy shadow frusta that often put high resolution areas in the wrong places. To fix this we subclass a new ShadowCameraSetup class that does not use LiSPSM. The solution to this problem in Ogre 2.1 was to derive from FocusedShadowCameraSetup instead of LiSPSMShadowCameraSetup. Instead, we are using a modified version of Focused shadow maps. Modified because we want the light's shadow frusta to always be z-up just like gazebo. The original Focused shadows in Ogre are y-up. Aligning shadow map frusta with the up direction tends to minimize shadow map stretching artifacts by letting stretched shadow texels form long rectangles instead of sawtooth patterns on most surfaces such as terrain and man-made objects.

Because we are deriving from LiSPSM but not using all its functionality, th efollowing member functions will have no effect: setOptimalAdjustFactor(), setUseSimpleOptimalAdjust(), setCameraLightDirectionThreshold().

Constructor & Destructor Documentation

◆ CustomPSSMShadowCameraSetup()

Constructor, defaults to 3 splits.

◆ ~CustomPSSMShadowCameraSetup()

Destructor.

Member Function Documentation

◆ buildViewMatrix()

Ogre::Matrix4 buildViewMatrix ( const Ogre::Vector3 &  _pos,
const Ogre::Vector3 &  _dir,
const Ogre::Vector3 &  _up 
) const

The same as FocusedShadowCameraSetup::buildViewMatrix() except resulting matrices are z-up instead of y-up.

See also
FocusedShadowCameraSetup::buildViewMatrix()

◆ calculateShadowMappingMatrix()

void calculateShadowMappingMatrix ( const Ogre::SceneManager &  _sm,
const Ogre::Camera &  _cam,
const Ogre::Light &  _light,
Ogre::Matrix4 *  _out_view,
Ogre::Matrix4 *  _outProj,
Ogre::Camera *  _outCam 
) const

lightly modified FocusedShadowCameraSetup::calculateShadowMappingMatrix().

◆ getShadowCamera()

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
overridevirtual

Returns a shadow camera with PSSM splits based on iteration.

See also
FocusedShadowCameraSetup::getShadowCamera()

◆ getZUpFocusedShadowCamera()

virtual void getZUpFocusedShadowCamera ( const Ogre::SceneManager *  _sm,
const Ogre::Camera *  _cam,
const Ogre::Viewport *  _vp,
const Ogre::Light *  _light,
Ogre::Camera *  _texCam,
size_t  _iteration 
) const
virtual

The same as FocusedShadowCameraSetup::ShadowCameraSetup() except resulting light frusta are z-up instead of y-up.

See also
FocusedShadowCameraSetup::ShadowCameraSetup()

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