Implements Global Illumination using CIVCT (Cascaded Image Voxel Cone Tracing) More...
#include <GlobalIlluminationCiVct.hh>
Public Types | |
enum | DebugVisualizationMode { DVM_Albedo , DVM_Normal , DVM_Emissive , DVM_Lighting , DVM_None } |
Debug visualization modes for GlobalIlluminationCiVct::SetDebugVisualization. More... | |
Public Types inherited from GlobalIlluminationBase | |
enum | ParticipatingVisualsFlags { DYNAMIC_VISUALS = 1u << 0u , STATIC_VISUALS = 1u << 1u } |
Bitmask of which objects are considered by GI bounces. Note that all objects can receive indirect illumination. More... | |
Public Member Functions | |
GlobalIlluminationCiVct () | |
Constructor. | |
virtual | ~GlobalIlluminationCiVct () |
Destructor. | |
virtual CiVctCascadePtr | AddCascade (const CiVctCascade *_ref)=0 |
Adds a new cascade. | |
virtual bool | Anisotropic () const =0 |
Whether anisotropic setting is on. | |
virtual void | AutoCalculateStepSizes (const gz::math::Vector3d &_stepSize)=0 |
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. Should be called after adding all cascades. | |
virtual void | Bind (const CameraPtr &_camera)=0 |
CIVCT relies on having multiple cascades around a central position, typically a camera. This function binds a camera for us to monitor and will act as the center of those cascades. | |
virtual bool | ConsistentCascadeSteps () const =0 |
Retrieve current setting. See SetConsistentCascadeSteps. | |
virtual DebugVisualizationMode | DebugVisualization () const =0 |
Returns current visualization mode. | |
virtual bool | HighQuality () const =0 |
Whether we're using 6 (true) or 4 (false) cones. | |
virtual void | LightingChanged ()=0 |
Called by Scene when lighting changes so that GI can be updated. | |
virtual void | NewSettings (uint32_t _bounceCount, bool _anisotropic)=0 |
Sets new settings after having called Init. | |
virtual void | PopCascade ()=0 |
Removes the last added cascade. | |
virtual void | Reset ()=0 |
Disables this GI and undoes the internal work performed by Start(). This makes it possible to edit cascades again. | |
virtual void | SetConsistentCascadeSteps (bool _consistentCascadeSteps)=0 |
Selects how we determine when we need to (partially) rebuild the voxels based on camera movement. | |
virtual void | SetDebugVisualization (DebugVisualizationMode _dvm)=0 |
Draws the voxels on screen for inspection and understand what is going on with GI. You should be looking at a minecraft-like world. | |
virtual void | SetHighQuality (bool _highQuality)=0 |
True for high quality (slower). VRAM consumption stays the same. Ogre2 will use 6 cones instead of 4. | |
virtual void | SetMaxCascades (const uint32_t _maxCascades)=0 |
Tells how many times AddCascade will be called. You can call it fewer times (i.e. some kb of RAM will be wasted) but not more. | |
virtual void | Start (uint32_t _bounceCount, bool _anisotropic)=0 |
Call this function after adding all cascades. You can no longer add cascades after this. | |
virtual bool | Started () const =0 |
Returns true if Start() has already been called. Will return false again if Reset() is called. | |
Public Member Functions inherited from GlobalIlluminationBase | |
GlobalIlluminationBase () | |
Constructor. | |
virtual | ~GlobalIlluminationBase () |
Destructor. | |
virtual uint32_t | BounceCount () const =0 |
Get number of bounces. | |
virtual void | Build ()=0 |
Build the internal structures required for producing GI This function may take significant time. | |
virtual bool | Enabled () const =0 |
Returns true if this GI configuration is currently enabled. | |
virtual uint32_t | ParticipatingVisuals () const =0 |
Visuals that can bounce GI. | |
virtual void | SetBounceCount (uint32_t _bounceCount)=0 |
Set the number of GI bounces. Very high number can cause a large performance impact. | |
virtual void | SetParticipatingVisuals (uint32_t _mask)=0 |
Set which visuals can bounce GI. | |
virtual void | UpdateCamera ()=0 |
Called by Scene on an active GlobalIlluminationBase whenever first rendering happens for a new frame. This implies Build has been called already. | |
virtual void | UpdateLighting ()=0 |
Called by Scene on an active GlobalIlluminationBase whenever lighting changes. This implies Build has been called already. | |
Additional Inherited Members | |
Protected Member Functions inherited from GlobalIlluminationBase | |
virtual void | Destroy ()=0 |
Destroy the class. | |
virtual void | Init ()=0 |
Initialize the class. | |
virtual void | SetEnabled (bool _enabled)=0 |
Sets this GI solution as enabled. | |
Detailed Description
Implements Global Illumination using CIVCT (Cascaded Image Voxel Cone Tracing)
Member Enumeration Documentation
◆ DebugVisualizationMode
Debug visualization modes for GlobalIlluminationCiVct::SetDebugVisualization.
Constructor & Destructor Documentation
◆ GlobalIlluminationCiVct()
Constructor.
◆ ~GlobalIlluminationCiVct()
|
virtual |
Destructor.
Member Function Documentation
◆ AddCascade()
|
pure virtual |
Adds a new cascade.
- Remarks
- Cannot be called anymore after Start() has been called
- Parameters
-
[in] _ref Can be nullptr. If you already have a cascade, we will clone its settings.
- Returns
- New Cascade to control its settings.
Implemented in Ogre2GlobalIlluminationCiVct.
◆ Anisotropic()
|
pure virtual |
Whether anisotropic setting is on.
- Returns
- Anisotropy setting
Implemented in Ogre2GlobalIlluminationCiVct.
◆ AutoCalculateStepSizes()
|
pure virtual |
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. Should be called after adding all cascades.
- Parameters
-
[in] _stepSize See CiVctCascade::SetCameraStepSize
Implemented in Ogre2GlobalIlluminationCiVct.
◆ Bind()
|
pure virtual |
CIVCT relies on having multiple cascades around a central position, typically a camera. This function binds a camera for us to monitor and will act as the center of those cascades.
- Remarks
- If no camera is bound, the active camera will be used, which can cause performance problems if multiple sensors are present
- Parameters
-
[in] _camera Camera to bind. Nullptr to unbind.
Implemented in Ogre2GlobalIlluminationCiVct.
◆ ConsistentCascadeSteps()
|
pure virtual |
Retrieve current setting. See SetConsistentCascadeSteps.
- Returns
- True if the feature is enabled
Implemented in Ogre2GlobalIlluminationCiVct.
◆ DebugVisualization()
|
pure virtual |
Returns current visualization mode.
- Returns
- Visualization mode
Implemented in Ogre2GlobalIlluminationCiVct.
◆ HighQuality()
|
pure virtual |
Whether we're using 6 (true) or 4 (false) cones.
- Returns
- High Quality setting
Implemented in Ogre2GlobalIlluminationCiVct.
◆ LightingChanged()
|
pure virtual |
Called by Scene when lighting changes so that GI can be updated.
Implemented in Ogre2GlobalIlluminationCiVct.
◆ NewSettings()
|
pure virtual |
Sets new settings after having called Init.
- Parameters
-
[in] _bounceCount See Start [in] _anisotropic See Start
Implemented in Ogre2GlobalIlluminationCiVct.
◆ PopCascade()
|
pure virtual |
Removes the last added cascade.
- Remarks
- Do NOT try to call any of the functions of the CiVctCascadePtr returned by AddCascade after this call.
- Cannot be called anymore after Start() has been called
Implemented in Ogre2GlobalIlluminationCiVct.
◆ Reset()
|
pure virtual |
Disables this GI and undoes the internal work performed by Start(). This makes it possible to edit cascades again.
Implemented in Ogre2GlobalIlluminationCiVct.
◆ SetConsistentCascadeSteps()
|
pure virtual |
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
- Parameters
-
[in] _consistentCascadeSteps True: 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
Implemented in Ogre2GlobalIlluminationCiVct.
◆ SetDebugVisualization()
|
pure virtual |
Draws the voxels on screen for inspection and understand what is going on with GI. You should be looking at a minecraft-like world.
- Parameters
-
[in] _dvm What component to visualize
Implemented in Ogre2GlobalIlluminationCiVct.
◆ SetHighQuality()
|
pure virtual |
True for high quality (slower). VRAM consumption stays the same. Ogre2 will use 6 cones instead of 4.
- Parameters
-
[in] _highQuality Quality setting
Implemented in Ogre2GlobalIlluminationCiVct.
◆ SetMaxCascades()
|
pure virtual |
Tells how many times AddCascade will be called. You can call it fewer times (i.e. some kb of RAM will be wasted) but not more.
- Remarks
- You can't call this function after adding cascades The semantics are similar to std::vector::reserve
- Parameters
-
[in] _maxCascades Number of times AddCascade will be called
Implemented in Ogre2GlobalIlluminationCiVct.
◆ Start()
|
pure virtual |
Call this function after adding all cascades. You can no longer add cascades after this.
- Parameters
-
[in] _bounceCount Number 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 For more info see Ogre's VctLighting::update
- Parameters
-
[in] _anisotropic Whether we should use anisotropic VCT (higher quality, but consumes more VRAM). See GlobalIlluminationVct::SetAnisotropic
Implemented in Ogre2GlobalIlluminationCiVct.
◆ Started()
|
pure virtual |
Returns true if Start() has already been called. Will return false again if Reset() is called.
- Returns
- true if Start() has already been called
Implemented in Ogre2GlobalIlluminationCiVct.
The documentation for this class was generated from the following file: