#include <MRenderShadowData.h>
Access Rendering Shadow Map Data.
The shadow map can be changed by instanciating a MRenderCallback and overriding shadowCastCallback(). When this is invoked, a MRenderShadowData is passed as an argument; the depthMaps and midDistMaps members can then be changed by this API. Methods and data are provided to assist in transforming back and forth from world space to z buffer space. Paint Effects and Fur are two examples which use this mechanism to change the shadow map.
To prevent self shadowing, Maya uses a mid distance map to resolve the ambiguity. Details of this technique can be obtained from Graphics Gems III, "The Shadow Depth Map Revisited".
Public Types | |
enum | LightType { kInvalid, kPoint, kDirectional, kSpot } |
Light Types. More... | |
Public Member Functions | |
MRenderShadowData () | |
Default Constructor. | |
void | worldToZbuffer (const MFloatPoint &worldPoint, MFloatPoint &screenPoint) const |
Converts world space point to shadow map. More... | |
void | zbufferToWorld (const MFloatPoint &screenPoint, MFloatPoint &worldPoint) const |
Converts shadow map point to world space. More... | |
Public Attributes | |
bool | perspective |
set if the light has a perspective projection | |
bool | useMidDistMap |
set if the light generates a depth and midDist map | |
LightType | lightType |
the type of light the shadow map is generated for | |
unsigned short | shadowResX |
the x resolution of shadow map | |
unsigned short | shadowResY |
the y resolution of the shadow map | |
MFloatPoint | lightPosition |
position of the light in world space | |
MFloatMatrix | projectionMatrix |
projection matrix for the light | |
MFloatMatrix | perspectiveMatrix |
perspective matrix for the light | |
float * | depthMaps |
the output depth map | |
float * | midDistMaps |
the output mid distance map | |
enum LightType |
void worldToZbuffer | ( | const MFloatPoint & | inPoint, |
MFloatPoint & | outPoint | ||
) | const |
Converts world space point to shadow map.
Shadow depth is stored in inPoint.z
[in] | inPoint | The original point in world space |
[out] | outPoint | The converted point in shadow map |
void zbufferToWorld | ( | const MFloatPoint & | inPoint, |
MFloatPoint & | outPoint | ||
) | const |
Converts shadow map point to world space.
Shadow depth is stored in inPoint.z.
[in] | inPoint | The original point in shadow map |
[out] | outPoint | The converted point in world space |