OGRE-Next  2.3
Object-Oriented Graphics Rendering Engine
Ogre::CompositorShadowNode Class Reference

Shadow Nodes are special nodes (not to be confused with. More...

#include <OgreCompositorShadowNode.h>

+ Inheritance diagram for Ogre::CompositorShadowNode:

Public Types

typedef vector< bool >::type LightsBitSet
 

Public Member Functions

 CompositorShadowNode (IdType id, const CompositorShadowNodeDef *definition, CompositorWorkspace *workspace, RenderSystem *renderSys, TextureGpu *finalTarget)
 
virtual ~CompositorShadowNode ()
 
const CompositorPassVec_getPasses () const
 
void _notifyCleared ()
 Internal Use. More...
 
bool _shouldUpdateShadowMapIdx (uint32 shadowMapIdx) const
 
void _update (Camera *camera, const Camera *lodCamera, SceneManager *sceneManager)
 Renders into the shadow map, executes passes. More...
 
void _update (const Camera *lodCamera, SceneManager *sceneManager)
 Calling this function every frame will cause us to execute all our passes (ie. More...
 
bool areAllInputsConnected () const
 
void connectBufferTo (size_t outChannelA, CompositorNode *nodeB, size_t inChannelB)
 Connects this node (let's call it node 'A') to node 'B', mapping the output channel from A into the input channel from B (buffer version) More...
 
void connectExternalBuffer (UavBufferPacked *buffer, size_t inChannelA)
 Connects (injects) an external buffer into the given channel. More...
 
void connectExternalRT (TextureGpu *externalTexture, size_t inChannelA)
 Connects (injects) an external RT into the given channel. More...
 
void connectTo (size_t outChannelA, CompositorNode *nodeB, size_t inChannelB)
 Connects this node (let's call it node 'A') to node 'B', mapping the output channel from A into the input channel from B (texture version) More...
 
void createPasses ()
 Creates all passes based on our definition. More...
 
void destroyAllPasses ()
 
void finalTargetResized01 (const TextureGpu *finalTarget) override
 
virtual void finalTargetResized02 (const TextureGpu *finalTarget)
 
const LightsBitSetgetAffectedLightsBitSet () const
 
const AxisAlignedBoxgetCastersBox () const
 @See mCastersBox More...
 
const TextureGpuVecgetContiguousShadowMapTex () const
 
UavBufferPackedgetDefinedBuffer (IdString bufferName) const
 Returns the buffer pointer of a buffer based on it's name. More...
 
UavBufferPackedgetDefinedBufferNoThrow (IdString bufferName) const
 
TextureGpugetDefinedTexture (IdString textureName) const
 Returns the texture pointer of a texture based on it's name & mrt index. More...
 
const CompositorShadowNodeDefgetDefinition () const
 
bool getEnabled () const
 Returns if this instance is enabled. @See setEnabled. More...
 
IdType getId () const
 Get the unique id of this object. More...
 
uint32 getIndexToContiguousShadowMapTex (size_t shadowMapIdx) const
 
const CompositorChannelVecgetInputChannel () const
 
const LightgetLightAssociatedWith (uint32 shadowMapIdx) const
 Note: May return null if there is no such shadowMapIdx, or if there is no light that could be linked with that shadow map index. More...
 
const CompositorChannelVecgetLocalTextures () const
 
void getMinMaxDepthRange (const Frustum *shadowMapCamera, Real &outMin, Real &outMax) const
 Outputs the min & max depth range for the given camera. More...
 
void getMinMaxDepthRange (size_t shadowMapIdx, Real &outMin, Real &outMax) const
 
IdString getName () const
 
float getNormalOffsetBias (const size_t shadowMapIdx) const
 
size_t getNumActiveShadowCastingLights () const
 The return value may change in the future, which happens when the number of lights changes to or from a value lower than the supported shadow casting lights by the definition. More...
 
size_t getPassNumber (CompositorPass *pass) const
 
const vector< Real >::type * getPssmBlends (size_t shadowMapIdx) const
 Returns a list of points with the blend band boundaries of the closest N-1 PSSM split in projection space for the given shadow map index. More...
 
const RealgetPssmFade (size_t shadowMapIdx) const
 Returns the fade point of the last PSSM split in projection space for the given shadow map index. More...
 
const vector< Real >::type * getPssmSplits (size_t shadowMapIdx) const
 Returns a list of points with the limits of each PSSM split in projection space for the given shadow map index. More...
 
RenderSystemgetRenderSystem () const
 
const LightClosestArraygetShadowCastingLights () const
 
uint8 getShadowMapLightTypeMask (uint32 shadowMapIdx) const
 Do not call this if isShadowMapIdxActive == false or isShadowMapIdxInValidRange == false. More...
 
const Matrix4getViewMatrix (size_t shadowMapIdx) const
 Returns the texture view matrix for the given shadow map index. More...
 
Matrix4 getViewProjectionMatrix (size_t shadowMapIdx) const
 Returns the texture view projection matrix for the given shadow map index. More...
 
CompositorWorkspacegetWorkspace ()
 Returns our parent workspace. More...
 
const CompositorWorkspacegetWorkspace () const
 Returns our parent workspace. More...
 
bool isShadowMapIdxActive (uint32 shadowMapIdx) const
 Returns true if the shadow map index is not active. More...
 
bool isShadowMapIdxInValidRange (uint32 shadowMapIdx) const
 
void notifyDestroyed (const UavBufferPacked *buffer)
 
void notifyDestroyed (TextureGpu *channel)
 Call this function when caller has destroyed a RenderTarget in which the callee may have a reference to that pointer, so that we can clean it up. More...
 
void notifyRecreated (const UavBufferPacked *oldBuffer, UavBufferPacked *newBuffer)
 
void notifyRecreated (TextureGpu *channel)
 Call this function when you're replacing the textures from oldChannel with the ones in newChannel. More...
 
void operator delete (void *ptr)
 
void operator delete (void *ptr, const char *, int, const char *)
 
void operator delete (void *ptr, void *)
 
void operator delete[] (void *ptr)
 
void operator delete[] (void *ptr, const char *, int, const char *)
 
void * operator new (size_t sz)
 
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 *ptr)
 placement operator new More...
 
void * operator new[] (size_t sz)
 
void * operator new[] (size_t sz, const char *file, int line, const char *func)
 array operator new, with debug line info More...
 
bool operator() (const IdObject &left, const IdObject &right)
 
bool operator() (const IdObject *left, const IdObject *right)
 
void postInitializePass (CompositorPass *pass) override
 We derive so we can override the camera with ours. More...
 
void resetAllNumPassesLeft ()
 Resets the number of passes left for every pass (. More...
 
void setEnabled (bool bEnabled)
 Enables or disables all instances of this node. More...
 
void setLightFixedToShadowMap (size_t shadowMapIdx, Light *light)
 Marks a shadow map as statically updated, and ties the given light to always use that shadow map. More...
 
const LightListsetShadowMapsToPass (Renderable *rend, const Pass *pass, AutoParamDataSource *autoParamDataSource, size_t startLight)
 
void setStaticShadowMapDirty (size_t shadowMapIdx, bool includeLinked=true)
 Tags a static shadow map as dirty, causing Ogre to update it on the next time this Shadow node gets executed. More...
 

Detailed Description

Shadow Nodes are special nodes (not to be confused with.

See also
CompositorNode) that are only used for rendering shadow maps. Normal Compositor Nodes can share or own a ShadowNode. The ShadowNode will render the scene enough times to fill all shadow maps so the main scene pass can use them.
ShadowNode are very flexible compared to Ogre 1.x; as they allow mixing multiple shadow camera setups for different lights.
Shadow Nodes derive from nodes so that they can be used as regular nodes
During a render with shadow mapping enabled, we render first the Shadow Node's pass, then render the regular scene. In the past there used to be an AABB enclosing all visible objects that receive shadows that was used for calculating the shadow maps. This forced Ogre 2.x to split rendering into two stages: _cullPhase01 & _renderPhase02. This is not needed anymore.

To summarize: a normal rendering flow with shadow map looks like this: shadowNode->setupShadowCamera( normal->getVisibleBoundsInfo() ); shadowNode->_cullPhase01(); shadowNode->_renderPhase02(); normal->_cullPhase01(); normal->_renderPhase02();

On forward lighting passes, shadow mapping is handled in the following way: 1) Build a list of all lights visible by all cameras (SceneManager does this) 2) Traverse the list to get the closest lights to the current camera. These lights will cast shadows. 3) Build a list of the closest lights for each object (SceneManager does this) 4) Traverse this list and find those that are actually casting a shadow 5) Send to the GPU & engine the list in step 4, but shadow casting lights are put first, then sorted by proximity. See the comments inside the function setShadowMapsToPass for more information.
Author
Matias N. Goldberg
Version
1.0

Member Typedef Documentation

◆ LightsBitSet

typedef vector<bool>::type Ogre::CompositorShadowNode::LightsBitSet

Constructor & Destructor Documentation

◆ CompositorShadowNode()

Ogre::CompositorShadowNode::CompositorShadowNode ( IdType  id,
const CompositorShadowNodeDef definition,
CompositorWorkspace workspace,
RenderSystem renderSys,
TextureGpu finalTarget 
)

◆ ~CompositorShadowNode()

virtual Ogre::CompositorShadowNode::~CompositorShadowNode ( )
virtual

Member Function Documentation

◆ _getPasses()

const CompositorPassVec& Ogre::CompositorNode::_getPasses ( ) const
inlineinherited

◆ _notifyCleared()

void Ogre::CompositorNode::_notifyCleared ( )
inherited

Internal Use.

Called when connections are all being zero'ed. We rely our caller is doing this to all nodes, hence we do not notify our @mConnectedNodes nodes. Failing to clear them too may leave dangling pointers or graphical glitches

Remarks
Destroys all of our passes.

◆ _shouldUpdateShadowMapIdx()

bool Ogre::CompositorShadowNode::_shouldUpdateShadowMapIdx ( uint32  shadowMapIdx) const

◆ _update() [1/2]

void Ogre::CompositorShadowNode::_update ( Camera camera,
const Camera lodCamera,
SceneManager sceneManager 
)

Renders into the shadow map, executes passes.

Parameters
cameraCamera used to calculate our shadow camera (in case of directional lights).

◆ _update() [2/2]

void Ogre::CompositorNode::_update ( const Camera lodCamera,
SceneManager sceneManager 
)
inherited

Calling this function every frame will cause us to execute all our passes (ie.

render)

Parameters
lodCameraLOD Camera to be used by our passes. Pointer can be null, and note however passes can ignore this hint and use their own camera pointer for LOD (this parameter is mostly used for syncing shadow mapping).

◆ areAllInputsConnected()

bool Ogre::CompositorNode::areAllInputsConnected ( ) const
inherited

◆ connectBufferTo()

void Ogre::CompositorNode::connectBufferTo ( size_t  outChannelA,
CompositorNode nodeB,
size_t  inChannelB 
)
inherited

Connects this node (let's call it node 'A') to node 'B', mapping the output channel from A into the input channel from B (buffer version)

Parameters
outChannelAOutput to use from node A.
inChannelBInput to connect the output from A.

◆ connectExternalBuffer()

void Ogre::CompositorNode::connectExternalBuffer ( UavBufferPacked buffer,
size_t  inChannelA 
)
inherited

Connects (injects) an external buffer into the given channel.

Usually used for the 'connect_buffer_external' directive.

Parameters
bufferThe buffer.
inChannelAIn which channel number to inject to.

◆ connectExternalRT()

void Ogre::CompositorNode::connectExternalRT ( TextureGpu externalTexture,
size_t  inChannelA 
)
inherited

Connects (injects) an external RT into the given channel.

Usually used for the "connect_output" / "connect_external" directive for the RenderWindow.

Parameters
rtThe RenderTarget.
texturesThe Textures associated with the RT. Can be empty (eg. RenderWindow) but could cause crashes/exceptions if tried to use in PASS_QUAD passes.
inChannelAIn which channel number to inject to.

◆ connectTo()

void Ogre::CompositorNode::connectTo ( size_t  outChannelA,
CompositorNode nodeB,
size_t  inChannelB 
)
inherited

Connects this node (let's call it node 'A') to node 'B', mapping the output channel from A into the input channel from B (texture version)

Parameters
outChannelAOutput to use from node A.
inChannelBInput to connect the output from A.

◆ createPasses()

void Ogre::CompositorNode::createPasses ( )
inherited

Creates all passes based on our definition.

Remarks
Call this function after connecting all channels (at least our input) otherwise we may bind null pointer RTs to the passes (and then crash) @See connectTo and
See also
connectFinalRT

◆ destroyAllPasses()

void Ogre::CompositorNode::destroyAllPasses ( )
inherited

◆ finalTargetResized01()

void Ogre::CompositorShadowNode::finalTargetResized01 ( const TextureGpu finalTarget)
overridevirtual

Reimplemented from Ogre::CompositorNode.

◆ finalTargetResized02()

virtual void Ogre::CompositorNode::finalTargetResized02 ( const TextureGpu finalTarget)
virtualinherited

◆ getAffectedLightsBitSet()

const LightsBitSet& Ogre::CompositorShadowNode::getAffectedLightsBitSet ( ) const
inline

◆ getCastersBox()

const AxisAlignedBox& Ogre::CompositorShadowNode::getCastersBox ( ) const
inline

@See mCastersBox

◆ getContiguousShadowMapTex()

const TextureGpuVec& Ogre::CompositorShadowNode::getContiguousShadowMapTex ( ) const
inline

◆ getDefinedBuffer()

UavBufferPacked* Ogre::CompositorNode::getDefinedBuffer ( IdString  bufferName) const
inherited

Returns the buffer pointer of a buffer based on it's name.

Remarks
The buffer may come from a local buffer, an input buffer, or global (workspace).
Parameters
bufferNameThe name of the buffer. This name may only be valid at node scope. It can refer to an input buffer, a local buffer, or a global one. If a local or input buffer has the same name as a global one, the global one is ignored.
Returns
Regular: The buffer. Throws if buffer wasn't found. No throw version: Null if not found. The buffer otherwise

◆ getDefinedBufferNoThrow()

UavBufferPacked* Ogre::CompositorNode::getDefinedBufferNoThrow ( IdString  bufferName) const
inherited

◆ getDefinedTexture()

TextureGpu* Ogre::CompositorNode::getDefinedTexture ( IdString  textureName) const
inherited

Returns the texture pointer of a texture based on it's name & mrt index.

Remarks
The texture name must have been registered with CompositorNodeDef::addTextureSourceName
Parameters
textureNameThe name of the texture. This name may only be valid at node scope. It can refer to an input texture, a local texture, or a global one. If the global texture wasn't registered with addTextureSourceName, it will fail.
Returns
Null if not found (or global texture not registered). The texture otherwise

◆ getDefinition()

const CompositorShadowNodeDef* Ogre::CompositorShadowNode::getDefinition ( ) const
inline

◆ getEnabled()

bool Ogre::CompositorNode::getEnabled ( ) const
inlineinherited

Returns if this instance is enabled. @See setEnabled.

◆ getId()

IdType Ogre::IdObject::getId ( ) const
inlineinherited

Get the unique id of this object.

◆ getIndexToContiguousShadowMapTex()

uint32 Ogre::CompositorShadowNode::getIndexToContiguousShadowMapTex ( size_t  shadowMapIdx) const

◆ getInputChannel()

const CompositorChannelVec& Ogre::CompositorNode::getInputChannel ( ) const
inlineinherited

◆ getLightAssociatedWith()

const Light* Ogre::CompositorShadowNode::getLightAssociatedWith ( uint32  shadowMapIdx) const

Note: May return null if there is no such shadowMapIdx, or if there is no light that could be linked with that shadow map index.

i.e. if isShadowMapIdxActive( shadowMapIdx ) is true, then we'll return a valid pointer.

◆ getLocalTextures()

const CompositorChannelVec& Ogre::CompositorNode::getLocalTextures ( ) const
inlineinherited

◆ getMinMaxDepthRange() [1/2]

void Ogre::CompositorShadowNode::getMinMaxDepthRange ( const Frustum shadowMapCamera,
Real outMin,
Real outMax 
) const

Outputs the min & max depth range for the given camera.

0 & 100000 if camera not found

Remarks
Performs linear search O(N), except the overload that provides a shadowMapIdx

◆ getMinMaxDepthRange() [2/2]

void Ogre::CompositorShadowNode::getMinMaxDepthRange ( size_t  shadowMapIdx,
Real outMin,
Real outMax 
) const

◆ getName()

IdString Ogre::CompositorNode::getName ( ) const
inlineinherited

◆ getNormalOffsetBias()

float Ogre::CompositorShadowNode::getNormalOffsetBias ( const size_t  shadowMapIdx) const

◆ getNumActiveShadowCastingLights()

size_t Ogre::CompositorShadowNode::getNumActiveShadowCastingLights ( ) const
inline

The return value may change in the future, which happens when the number of lights changes to or from a value lower than the supported shadow casting lights by the definition.

◆ getPassNumber()

size_t Ogre::CompositorNode::getPassNumber ( CompositorPass pass) const
inherited

◆ getPssmBlends()

const vector<Real>::type* Ogre::CompositorShadowNode::getPssmBlends ( size_t  shadowMapIdx) const

Returns a list of points with the blend band boundaries of the closest N-1 PSSM split in projection space for the given shadow map index.

Remarks
See also
getPssmSplits
Returns
An array with the blend points. The number of elements is N-1 where N is the number of splits for that shadow map. Returns null if shadowMapIdx is out of bounds, or is not a PSSM technique.

◆ getPssmFade()

const Real* Ogre::CompositorShadowNode::getPssmFade ( size_t  shadowMapIdx) const

Returns the fade point of the last PSSM split in projection space for the given shadow map index.

Remarks
See also
getPssmSplits
Returns
The fade point. Returns null if shadowMapIdx is out of bounds, or is not a PSSM technique.

◆ getPssmSplits()

const vector<Real>::type* Ogre::CompositorShadowNode::getPssmSplits ( size_t  shadowMapIdx) const

Returns a list of points with the limits of each PSSM split in projection space for the given shadow map index.

Remarks
If shadow map 0, 1 & 2 use light 0 with different splits, the return value should be the same for all of them.
Returns
An array with the split points. The number of elements is N+1 where N is the number of splits for that shadow map. Returns null if shadowMapIdx is out of bounds, or is not a PSSM technique.

◆ getRenderSystem()

RenderSystem* Ogre::CompositorNode::getRenderSystem ( ) const
inlineinherited

◆ getShadowCastingLights()

const LightClosestArray& Ogre::CompositorShadowNode::getShadowCastingLights ( ) const
inline

◆ getShadowMapLightTypeMask()

uint8 Ogre::CompositorShadowNode::getShadowMapLightTypeMask ( uint32  shadowMapIdx) const

Do not call this if isShadowMapIdxActive == false or isShadowMapIdxInValidRange == false.

◆ getViewMatrix()

const Matrix4& Ogre::CompositorShadowNode::getViewMatrix ( size_t  shadowMapIdx) const

Returns the texture view matrix for the given shadow map index.

◆ getViewProjectionMatrix()

Matrix4 Ogre::CompositorShadowNode::getViewProjectionMatrix ( size_t  shadowMapIdx) const

Returns the texture view projection matrix for the given shadow map index.

◆ getWorkspace() [1/2]

CompositorWorkspace* Ogre::CompositorNode::getWorkspace ( )
inlineinherited

Returns our parent workspace.

◆ getWorkspace() [2/2]

const CompositorWorkspace* Ogre::CompositorNode::getWorkspace ( ) const
inlineinherited

Returns our parent workspace.

◆ isShadowMapIdxActive()

bool Ogre::CompositorShadowNode::isShadowMapIdxActive ( uint32  shadowMapIdx) const

Returns true if the shadow map index is not active.

For example:

  • There are 3 shadow maps, but only 2 shadow casting lights
  • There are 3 directional maps for directional PSSM, but no directional light.

◆ isShadowMapIdxInValidRange()

bool Ogre::CompositorShadowNode::isShadowMapIdxInValidRange ( uint32  shadowMapIdx) const

◆ notifyDestroyed() [1/2]

void Ogre::CompositorNode::notifyDestroyed ( const UavBufferPacked buffer)
inherited

◆ notifyDestroyed() [2/2]

void Ogre::CompositorNode::notifyDestroyed ( TextureGpu channel)
inherited

Call this function when caller has destroyed a RenderTarget in which the callee may have a reference to that pointer, so that we can clean it up.

Parameters
channelChannel containing the pointer about to be destroyed (must still be valid)

◆ notifyRecreated() [1/2]

void Ogre::CompositorNode::notifyRecreated ( const UavBufferPacked oldBuffer,
UavBufferPacked newBuffer 
)
inherited

◆ notifyRecreated() [2/2]

void Ogre::CompositorNode::notifyRecreated ( TextureGpu channel)
inherited

Call this function when you're replacing the textures from oldChannel with the ones in newChannel.

Useful when recreating textures (i.e. resolution changed)

Parameters
oldChannelThe old textures that are going to be removed. Pointers in it must be still valid
newChannelThe new replacement textures

◆ operator delete() [1/3]

template<class Alloc >
void Ogre::AllocatedObject< Alloc >::operator delete ( void *  ptr)
inlineinherited

◆ operator delete() [2/3]

template<class Alloc >
void Ogre::AllocatedObject< Alloc >::operator delete ( void *  ptr,
const char *  ,
int  ,
const char *   
)
inlineinherited

◆ operator delete() [3/3]

template<class Alloc >
void Ogre::AllocatedObject< Alloc >::operator delete ( void *  ptr,
void *   
)
inlineinherited

◆ operator delete[]() [1/2]

template<class Alloc >
void Ogre::AllocatedObject< Alloc >::operator delete[] ( void *  ptr)
inlineinherited

◆ operator delete[]() [2/2]

template<class Alloc >
void Ogre::AllocatedObject< Alloc >::operator delete[] ( void *  ptr,
const char *  ,
int  ,
const char *   
)
inlineinherited

◆ operator new() [1/3]

template<class Alloc >
void* Ogre::AllocatedObject< Alloc >::operator new ( size_t  sz)
inlineinherited

◆ operator new() [2/3]

template<class Alloc >
void* Ogre::AllocatedObject< Alloc >::operator new ( size_t  sz,
const char *  file,
int  line,
const char *  func 
)
inlineinherited

operator new, with debug line info

◆ operator new() [3/3]

template<class Alloc >
void* Ogre::AllocatedObject< Alloc >::operator new ( size_t  sz,
void *  ptr 
)
inlineinherited

placement operator new

◆ operator new[]() [1/2]

template<class Alloc >
void* Ogre::AllocatedObject< Alloc >::operator new[] ( size_t  sz)
inlineinherited

◆ operator new[]() [2/2]

template<class Alloc >
void* Ogre::AllocatedObject< Alloc >::operator new[] ( size_t  sz,
const char *  file,
int  line,
const char *  func 
)
inlineinherited

array operator new, with debug line info

◆ operator()() [1/2]

bool Ogre::IdObject::operator() ( const IdObject left,
const IdObject right 
)
inlineinherited

◆ operator()() [2/2]

bool Ogre::IdObject::operator() ( const IdObject left,
const IdObject right 
)
inlineinherited

◆ postInitializePass()

void Ogre::CompositorShadowNode::postInitializePass ( CompositorPass pass)
overridevirtual

We derive so we can override the camera with ours.

Reimplemented from Ogre::CompositorNode.

◆ resetAllNumPassesLeft()

void Ogre::CompositorNode::resetAllNumPassesLeft ( )
inherited

Resets the number of passes left for every pass (.

See also
CompositorPassDef::mNumInitialPasses) Useful when you have a few starting 'initialization' passes and you want to reset them.

◆ setEnabled()

void Ogre::CompositorNode::setEnabled ( bool  bEnabled)
inherited

Enables or disables all instances of this node.

Remarks
Note that we just won't execute our passes. It's your job to change the channel connections accordingly if you have to. A disabled node won't complain when its connections are incomplete in a workspace.
This function is useful frequently toggling a compositor effect without having to recreate any API resource (which often would involve stalls).

◆ setLightFixedToShadowMap()

void Ogre::CompositorShadowNode::setLightFixedToShadowMap ( size_t  shadowMapIdx,
Light light 
)

Marks a shadow map as statically updated, and ties the given light to always use that shadow map.

Remarks
By default Ogre recalculates the shadow maps every single frame (even if nothing has changed). However if you know that whatever a light is illuminating is not changing at all (or barely changing), with static shadow maps you are the one who tells Ogre when to update it (e.g. you may only need to update it three times during the whole level); hence the framerate goes up. Perceived quality may also go up because by default Ogre applies shadow mapping on the closest lights; so shadows flip on and off as you move the camera (because lights that had no shadows get closer while lights that were using shadows get farther away). While often this is desirable, there are cases where the artist may want a particular light to always have shadows (regardless of distance); with static shadow maps you can force that; hence the perceived quality may go up (but that's up to the talent of the artist and the scene in particular).
Note that for point & spot lights, you have to consider if the light changed (e.g. moved, rotated) or if anything that is or could be lit by the light has moved Directional lights are harder because they depend on the camera placement as well.
Use setStaticShadowMapDirty to tell Ogre to update the shadow map in the next render.
Ogre may call light->setCastShadows( true ); on the light.
IMPORTANT: Do not put static and dynamic shadow maps in the same UV atlas. It's asking for trouble and will probably not work. Keep the atlas separate.
VERY IMPORTANT: You must respect lights are set in the following order:
  1. Directional
  2. Point
  3. Spot If you have shadow maps defined that support both point & spotlight, and you want to mix both static lights with dynamic ones; set fixed point lights in the first shadow map indices and spotlight in the last indices, to avoid Ogre automatically (e.g.) placing a point light after your static spot light.
Parameters
shadowMapIdxShadow map index to tie this light to. If this shadow map index is part of a PSSM split, all PSSM splits will be affected (thus you only need to call it once for any of the split that belong to the same set)
lightLight to tie to the given shadow map. Null pointer disables it.

◆ setShadowMapsToPass()

const LightList* Ogre::CompositorShadowNode::setShadowMapsToPass ( Renderable rend,
const Pass pass,
AutoParamDataSource autoParamDataSource,
size_t  startLight 
)

◆ setStaticShadowMapDirty()

void Ogre::CompositorShadowNode::setStaticShadowMapDirty ( size_t  shadowMapIdx,
bool  includeLinked = true 
)

Tags a static shadow map as dirty, causing Ogre to update it on the next time this Shadow node gets executed.

If drawing to a texture atlas, multiple shadow maps may be sharing the same texture, thus if you're doing a clear on the whole atlas, you will need to update all of the shadow maps, not just this one. Use includeLinked=true to mark as dirty all static shadow maps that share the same atlas. Set it to false if that's explicitly what you want, or if you're already going to call it for every shadow map (otherwise you will trigger a O(N^2) behavior).


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