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

This class manages multiple cascades of Voxels and each cascade can be composed of VctImageVoxelizer. More...

#include <OgreVctCascadedVoxelizer.h>

+ Inheritance diagram for Ogre::VctCascadedVoxelizer:

Public Member Functions

 VctCascadedVoxelizer ()
 
virtual ~VctCascadedVoxelizer ()
 
void addAllItems (SceneManager *sceneManager, const uint32 visibilityFlags, const bool bStatic)
 Adds all items in SceneManager that match visibilityFlags. More...
 
void addCascade (const VctCascadeSetting &cascadeSetting)
 Adds a new cascade. More...
 
void addItem (Item *item)
 Adds the given item to the voxelizer in all cascades. More...
 
virtual void allWorkspacesBeforeBeginUpdate ()
 CompositorWorkspaceListener override. More...
 
virtual void allWorkspacesBeginUpdate ()
 Called from CompositorManager2 (not CompositorWorkspace) when we're about to update all the workspaces (it's safe to update your own workspaces without calling _beginUpdate and _endUpdate) Warning: Don't add/remove listeners to CompositorManager2 inside this function. More...
 
void autoCalculateStepSizes (const Vector3 stepSize)
 Alters each cascade's step size. More...
 
const Vector3getCameraPosition () const
 
VctCascadeSettinggetCascade (size_t idx)
 
bool getConsistentCascadeSteps () const
 
VoxelizedMeshCachegetMeshCache ()
 Returns the mesh cache (shared by all cascades) in case you want to add a mesh manually with custom settings. More...
 
uint32 getNumBounces () const
 Returns number of bounces for cascade 0. More...
 
size_t getNumCascades () const
 
VctLightinggetVctLighting (size_t idx)
 
void init (RenderSystem *renderSystem, HlmsManager *hlmsManager, uint32 numBounces, bool bAnisotropic)
 Call this function after adding all cascades. More...
 
bool isAnisotropic () const
 Returns if we're using anisotropic VCT. More...
 
virtual void passEarlyPreExecute (CompositorPass *pass)
 Called early on in pass' execution. More...
 
virtual void passPosExecute (CompositorPass *pass)
 Called after a pass has been executed. More...
 
virtual void passPreExecute (CompositorPass *pass)
 Called when each pass is about to be executed. More...
 
virtual void passSceneAfterFrustumCulling (CompositorPassScene *pass)
 Called after a pass scene has performed frustum caulling but has yet to prepare and execute rendering commands. More...
 
virtual void passSceneAfterShadowMaps (CompositorPassScene *pass)
 Called after a pass scene has rendered shadow casting (it gets called even if there is no shadow node). More...
 
void removeAllItems ()
 Removes all items from all cascades. More...
 
void removeItem (Item *item)
 Removes the given item to the voxelizer in all cascades. More...
 
void reserveNumCascades (size_t numCascades)
 Tells beforehand how many cascades there will be. More...
 
void setAutoUpdate (CompositorManager2 *compositorManager, SceneManager *sceneManager)
 Register against the CompositorManager to call VctCascadedVoxelizer::update automatically when the CompositorManager is about to render (recommended) More...
 
void setCameraPosition (const Vector3 &cameraPosition)
 
void setConsistentCascadeSteps (bool bConsistentCascadeSteps)
 Selects how we determine when we need to (partially) rebuild the voxels based on camera movement. More...
 
void setNewSettings (uint32 numBounces, bool bAnisotropic)
 Sets new settings after having called init. More...
 
void update (SceneManager *sceneManager)
 You can call this directly with sceneManager, but we assume all objects are already updated (i.e. More...
 
virtual void workspacePosUpdate (CompositorWorkspace *workspace)
 Called after all nodes has been updated. More...
 
virtual void workspacePreUpdate (CompositorWorkspace *workspace)
 Called before all nodes are going to be updated. More...
 

Detailed Description

This class manages multiple cascades of Voxels and each cascade can be composed of VctImageVoxelizer.

Constructor & Destructor Documentation

◆ VctCascadedVoxelizer()

Ogre::VctCascadedVoxelizer::VctCascadedVoxelizer ( )

◆ ~VctCascadedVoxelizer()

virtual Ogre::VctCascadedVoxelizer::~VctCascadedVoxelizer ( )
virtual

Member Function Documentation

◆ addAllItems()

void Ogre::VctCascadedVoxelizer::addAllItems ( SceneManager sceneManager,
const uint32  visibilityFlags,
const bool  bStatic 
)

Adds all items in SceneManager that match visibilityFlags.

Parameters
sceneManagerSceneManager ptr
visibilityFlagsVisibility Mask to exclude Items
bStaticTrue to add only static Items False to add only dynamic Items

◆ addCascade()

void Ogre::VctCascadedVoxelizer::addCascade ( const VctCascadeSetting cascadeSetting)

Adds a new cascade.

VctCascadeSetting::voxelizer must be nullptr Cannot be called after VctCascadedVoxelizer::init

◆ addItem()

void Ogre::VctCascadedVoxelizer::addItem ( Item item)

Adds the given item to the voxelizer in all cascades.

◆ allWorkspacesBeforeBeginUpdate()

virtual void Ogre::VctCascadedVoxelizer::allWorkspacesBeforeBeginUpdate ( )
virtual

◆ allWorkspacesBeginUpdate()

virtual void Ogre::CompositorWorkspaceListener::allWorkspacesBeginUpdate ( )
inlinevirtualinherited

Called from CompositorManager2 (not CompositorWorkspace) when we're about to update all the workspaces (it's safe to update your own workspaces without calling _beginUpdate and _endUpdate) Warning: Don't add/remove listeners to CompositorManager2 inside this function.

Reimplemented in Ogre::ParallaxCorrectedCubemapAuto, and Ogre::ParallaxCorrectedCubemap.

◆ autoCalculateStepSizes()

void Ogre::VctCascadedVoxelizer::autoCalculateStepSizes ( const Vector3  stepSize)

Alters each cascade's step size.

The last cascade is set to stepSize.

The rest of the cascades are set to step sizes that are >= stepSize automatically

◆ getCameraPosition()

const Vector3& Ogre::VctCascadedVoxelizer::getCameraPosition ( ) const
inline

◆ getCascade()

VctCascadeSetting& Ogre::VctCascadedVoxelizer::getCascade ( size_t  idx)
inline

◆ getConsistentCascadeSteps()

bool Ogre::VctCascadedVoxelizer::getConsistentCascadeSteps ( ) const
inline

◆ getMeshCache()

VoxelizedMeshCache* Ogre::VctCascadedVoxelizer::getMeshCache ( )
inline

Returns the mesh cache (shared by all cascades) in case you want to add a mesh manually with custom settings.

◆ getNumBounces()

uint32 Ogre::VctCascadedVoxelizer::getNumBounces ( ) const
inline

Returns number of bounces for cascade 0.

The others are calculated automatically See VctCascadedVoxelizer::init

◆ getNumCascades()

size_t Ogre::VctCascadedVoxelizer::getNumCascades ( ) const
inline

◆ getVctLighting()

VctLighting* Ogre::VctCascadedVoxelizer::getVctLighting ( size_t  idx)
inline

◆ init()

void Ogre::VctCascadedVoxelizer::init ( RenderSystem renderSystem,
HlmsManager hlmsManager,
uint32  numBounces,
bool  bAnisotropic 
)

Call this function after adding all cascades.

You can no longer add cascades after this

Parameters
numBouncesNumber of bounces for cascade 0. The rest of the cascades are autocalculated to maintain even brightness levels.

Range is [0; inf) but a value of 0 is strongly discouraged if you have more than 1 cascade as you can end up with very uneven brightness levels between cascades

See VctLighting::update

Parameters
bAnisotropicWhether we should use anisotropic VCT

◆ isAnisotropic()

bool Ogre::VctCascadedVoxelizer::isAnisotropic ( ) const
inline

Returns if we're using anisotropic VCT.

◆ passEarlyPreExecute()

virtual void Ogre::CompositorWorkspaceListener::passEarlyPreExecute ( CompositorPass pass)
inlinevirtualinherited

Called early on in pass' execution.

Happens before passPreExecute, before the pass has set anything. Warning: calling pass->execute can result in recursive calls.

◆ passPosExecute()

virtual void Ogre::CompositorWorkspaceListener::passPosExecute ( CompositorPass pass)
inlinevirtualinherited

Called after a pass has been executed.

Warning: calling pass->execute can result in recursive calls.

◆ passPreExecute()

virtual void Ogre::CompositorWorkspaceListener::passPreExecute ( CompositorPass pass)
inlinevirtualinherited

Called when each pass is about to be executed.

Warning: calling pass->execute can result in recursive calls.

Reimplemented in Ogre::ParallaxCorrectedCubemapBase, Ogre::ParallaxCorrectedCubemapAuto, and Ogre::ParallaxCorrectedCubemap.

◆ passSceneAfterFrustumCulling()

virtual void Ogre::CompositorWorkspaceListener::passSceneAfterFrustumCulling ( CompositorPassScene pass)
inlinevirtualinherited

Called after a pass scene has performed frustum caulling but has yet to prepare and execute rendering commands.

Gets called after passSceneAfterFrustumCulling and before passPosExecute

Warning: calling pass->execute can result in recursive calls.

◆ passSceneAfterShadowMaps()

virtual void Ogre::CompositorWorkspaceListener::passSceneAfterShadowMaps ( CompositorPassScene pass)
inlinevirtualinherited

Called after a pass scene has rendered shadow casting (it gets called even if there is no shadow node).

Gets called after passPreExecute and before passSceneAfterFrustumCulling

Warning: calling pass->execute can result in recursive calls.

◆ removeAllItems()

void Ogre::VctCascadedVoxelizer::removeAllItems ( )

Removes all items from all cascades.

◆ removeItem()

void Ogre::VctCascadedVoxelizer::removeItem ( Item item)

Removes the given item to the voxelizer in all cascades.

◆ reserveNumCascades()

void Ogre::VctCascadedVoxelizer::reserveNumCascades ( size_t  numCascades)

Tells beforehand how many cascades there will be.

It's not necessary to call this, but recommended

◆ setAutoUpdate()

void Ogre::VctCascadedVoxelizer::setAutoUpdate ( CompositorManager2 compositorManager,
SceneManager sceneManager 
)

Register against the CompositorManager to call VctCascadedVoxelizer::update automatically when the CompositorManager is about to render (recommended)

You still must call setCameraPosition every frame though (or whenever the camera changes)

Set to nullptr to disable auto update

◆ setCameraPosition()

void Ogre::VctCascadedVoxelizer::setCameraPosition ( const Vector3 cameraPosition)

◆ setConsistentCascadeSteps()

void Ogre::VctCascadedVoxelizer::setConsistentCascadeSteps ( bool  bConsistentCascadeSteps)

Selects how we determine when we need to (partially) rebuild the voxels based on camera movement.

Remarks
If camera movement is deterministic, output is always deterministic regardless of this setting

This value can be changed at any point and switch back and forth

Parameters
bConsistentCascadeStepsTrue: Results can feel very determnistic because it is predictable.

Camera position is quantized in voxelCellSize * cascade.cameraStepSize. This means the camera position is in a 'cell' or 'grid'.

When the camera position moves onto another grid, we partially revoxelize results.

Advantage: A camera at pos XYZ will always have the same results

Disadvantage: if the camera jumps back and forth between voxels, revoxelizations will trigger frequently causing obvious frequent jumps in brightness

False: Revoxelization happens after the camera has travelled cascade.cameraStepSize cells away from the last point of voxelization.

Advantage: Infrequent revoxelizations. If camera movement is restricted around the last voxelization point, we will never revoxelize.

Disadvantage: Taking a picture at pos XYZ, then going away, and taking another picture at same pos XYZ may not result in the same brightness / image; which can make it feel unpredictable or non-deterministic. This can be workarounded by temporarily setting setConsistentCascadeSteps( true ) then back false after taking the picture

◆ setNewSettings()

void Ogre::VctCascadedVoxelizer::setNewSettings ( uint32  numBounces,
bool  bAnisotropic 
)

Sets new settings after having called init.

◆ update()

void Ogre::VctCascadedVoxelizer::update ( SceneManager sceneManager)

You can call this directly with sceneManager, but we assume all objects are already updated (i.e.

SceneManager::updateSceneGraph already called)

See VctCascadedVoxelizer::setAutoUpdate

◆ workspacePosUpdate()

virtual void Ogre::CompositorWorkspaceListener::workspacePosUpdate ( CompositorWorkspace workspace)
inlinevirtualinherited

Called after all nodes has been updated.

◆ workspacePreUpdate()

virtual void Ogre::CompositorWorkspaceListener::workspacePreUpdate ( CompositorWorkspace workspace)
inlinevirtualinherited

Called before all nodes are going to be updated.

Use this place to update your own, manually updated Workspaces without having to call @CompositorWorkspace::_beginUpdate( forceBeginFrame=true )


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