OGRE-Next  4.0.0unstable
Object-Oriented Graphics Rendering Engine
Ogre::InstantRadiosity Class Reference

#include <OgreInstantRadiosity.h>

Classes

struct  AreaOfInterest
 Areas of Interest are defined by both AABB and distance (can be 0). More...
 

Public Types

typedef vector< AreaOfInterest >::type AreaOfInterestVec
 Areas of interest. More...
 

Public Member Functions

 InstantRadiosity (SceneManager *sceneManager, HlmsManager *hlmsManager)
 
 ~InstantRadiosity ()
 
void build ()
 
void clear ()
 Clears everything, removing our VPLs. More...
 
void fillIrradianceVolume (IrradianceVolume *volume, Vector3 cellSize, Vector3 volumeOrigin, Real lightMaxPower, bool fadeAttenuationOverDistance)
 
void freeMemory ()
 "build" will download meshes for raycasting. More...
 
bool getEnableDebugMarkers () const
 
bool getUseIrradianceVolume () const
 
bool getUseTextures () const
 
void setEnableDebugMarkers (bool bEnable)
 
void setUseIrradianceVolume (bool bUseIrradianceVolume)
 Whether to use Irradiance Volume instead of VPLs. More...
 
void setUseTextures (bool bUseTextures)
 Whether to evaluate diffuse & detail map textures. More...
 
void suggestIrradianceVolumeParameters (const Vector3 &inCellSize, Vector3 &outVolumeOrigin, Real &outLightMaxPower, uint32 &outNumBlocksX, uint32 &outNumBlocksY, uint32 &outNumBlocksZ)
 Outputs suggested parameters for a volumetric texture that will encompass all VPLs. More...
 
void updateExistingVpls ()
 Does nothing if build hasn't been called yet. More...
 

Public Attributes

AreaOfInterestVec mAoI
 
Real mBias
 Value ideally in range (0; 1] When 1, the VPL is placed at exactly the location where the light ray hits the triangle. More...
 
Real mCellSize
 Controls how we cluster multiple VPLs into one averaged VPL. More...
 
uint8 mFirstRq
 
uint8 mLastRq
 
uint32 mLightMask
 
uint8 mMipmapBias
 
size_t mNumRayBounces
 In range [0; inf). More...
 
size_t mNumRays
 Number of rays to trace. More...
 
uint32 mNumSpreadIterations
 
Real mSpreadThreshold
 
Real mSurvivingRayFraction
 In range (0; 1]; how many rays that fired in the previous bounce should survive for a next round of bounces. More...
 
uint32 mVisibilityMask
 
Real mVplConstAtten
 
double mVplIntensityRangeMultiplier
 
Real mVplLinearAtten
 
Real mVplMaxRange
 ANY CHANGE TO A mVpl* variable will take effect after calling updateExistingVpls (or calling build) How big each VPL should be. More...
 
Real mVplPowerBoost
 Tweaks how strong VPL lights should be. More...
 
Real mVplQuadAtten
 
Real mVplThreshold
 If all three components of the diffuse colour of a VPL light is below this threshold, the VPL is removed (useful for improving performance for VPLs that barely contribute to the scene). More...
 
bool mVplUseIntensityForMaxRange
 When true, mVplIntensityRangeMultiplier will be used and each VPL will have a dynamic max range (can't exceed mVplMaxRange though), based on its intensity (smaller VPLs = shorter ranges, powerful VPLs = larger ranges) More...
 

Member Typedef Documentation

◆ AreaOfInterestVec

Areas of interest.

Only used for directional lights. Normally you don't want to use Instant Radiosity for empty landscapes because a regular environment map and simple math can take care of that. You want to focus on a particular building, or in different cities; but not everything. If left unfilled, the system will auto-calculate one (not recommended). See AreaOfInterest

Constructor & Destructor Documentation

◆ InstantRadiosity()

Ogre::InstantRadiosity::InstantRadiosity ( SceneManager sceneManager,
HlmsManager hlmsManager 
)

◆ ~InstantRadiosity()

Ogre::InstantRadiosity::~InstantRadiosity ( )

Member Function Documentation

◆ build()

void Ogre::InstantRadiosity::build ( )

◆ clear()

void Ogre::InstantRadiosity::clear ( )

Clears everything, removing our VPLs.

Does not freeMemory. You will have to call build again to get VPLs again.

◆ fillIrradianceVolume()

void Ogre::InstantRadiosity::fillIrradianceVolume ( IrradianceVolume volume,
Vector3  cellSize,
Vector3  volumeOrigin,
Real  lightMaxPower,
bool  fadeAttenuationOverDistance 
)
Parameters
volume
cellSize
volumeOrigin
lightMaxPower
fadeAttenuationOverDistanceWhether to fade the attenuation with distance (not physically based). See ForwardPlusBase::setFadeAttenuationRange

◆ freeMemory()

void Ogre::InstantRadiosity::freeMemory ( )

"build" will download meshes for raycasting.

We will not free them after build (in case you want to build again). If you wish to free that memory, call this function.

◆ getEnableDebugMarkers()

bool Ogre::InstantRadiosity::getEnableDebugMarkers ( ) const
inline

◆ getUseIrradianceVolume()

bool Ogre::InstantRadiosity::getUseIrradianceVolume ( ) const
inline

◆ getUseTextures()

bool Ogre::InstantRadiosity::getUseTextures ( ) const
inline

◆ setEnableDebugMarkers()

void Ogre::InstantRadiosity::setEnableDebugMarkers ( bool  bEnable)

◆ setUseIrradianceVolume()

void Ogre::InstantRadiosity::setUseIrradianceVolume ( bool  bUseIrradianceVolume)

Whether to use Irradiance Volume instead of VPLs.

Parameters
bUseIrradianceVolumeWhether to use Irradiance Volume.

◆ setUseTextures()

void Ogre::InstantRadiosity::setUseTextures ( bool  bUseTextures)

Whether to evaluate diffuse & detail map textures.

Disabling textures can speed up build() time and significantly reduce memory consumption, at the expense of more innacurate results (only material diffuse colour will be considered)

Remarks
Changing this setting implies calling freeMemory!
Parameters
bUseTexturesWhether to enable or disable using diffuse textures (and detail maps).

◆ suggestIrradianceVolumeParameters()

void Ogre::InstantRadiosity::suggestIrradianceVolumeParameters ( const Vector3 inCellSize,
Vector3 outVolumeOrigin,
Real outLightMaxPower,
uint32 outNumBlocksX,
uint32 outNumBlocksY,
uint32 outNumBlocksZ 
)

Outputs suggested parameters for a volumetric texture that will encompass all VPLs.

They are suggestions, you don't have to follow them.

Parameters
inCellSizeThe size of the voxel size. Doesn't have to match mCellSize. The suggested output parameters will be based on this input parameter.
outVolumeOriginWhere the volume should start. This value will be in the same unit of measure you are working with (your Items/Entities, mCellSize). If your Items and mCellSize are in centimeters, this value will be in cm. If you've been working in meters, it will be in meters. This value will be quantized to increments of mCellSize, and that's the only requirement (we'll quantize it for you if you change it later).
outLightMaxPowerThe maximum light power of the brightest VPL. Useful to maximize the quality of the 10-bits we use for the 3D texture.
outNumBlocksXThe suggested with for the volume texture. Volume's width in units will be: outVolumeOrigin.x + mCellSize * outNumBlocksX;
outNumBlocksYThe suggested with for the volume texture times 6. Volume's height in units will be: outVolumeOrigin.y + mCellSize * outNumBlocksY;
outNumBlocksZThe suggested depth for the volume texture times. Volume's depth in units will be: outVolumeOrigin.z + mCellSize * outNumBlocksZ;

◆ updateExistingVpls()

void Ogre::InstantRadiosity::updateExistingVpls ( )

Does nothing if build hasn't been called yet.

Updates VPLs with the latest changes made to all mVpl* variables. May create/remove VPL lights because of mVplThreshold

Member Data Documentation

◆ mAoI

AreaOfInterestVec Ogre::InstantRadiosity::mAoI

◆ mBias

Real Ogre::InstantRadiosity::mBias

Value ideally in range (0; 1] When 1, the VPL is placed at exactly the location where the light ray hits the triangle.

At 0.99 it will be placed at 99% the distance from light to the location (i.e. moves away from the triangle). Using Bias can help with light bleeding, and also allows reducing mVplMaxRange (thus increasing performance) at the cost of lower accuracy but still "looking good".

◆ mCellSize

Real Ogre::InstantRadiosity::mCellSize

Controls how we cluster multiple VPLs into one averaged VPL.

Smaller values generate more VPLs (reducing performance but improving quality). Bigger values result in less VPLs (higher performance, less quality)

◆ mFirstRq

uint8 Ogre::InstantRadiosity::mFirstRq

◆ mLastRq

uint8 Ogre::InstantRadiosity::mLastRq

◆ mLightMask

uint32 Ogre::InstantRadiosity::mLightMask

◆ mMipmapBias

uint8 Ogre::InstantRadiosity::mMipmapBias

◆ mNumRayBounces

size_t Ogre::InstantRadiosity::mNumRayBounces

In range [0; inf).

Controls how many bounces we'll generate. Increases the total number of rays (i.e. more than mNumRays).

◆ mNumRays

size_t Ogre::InstantRadiosity::mNumRays

Number of rays to trace.

More usually results in more accuracy. Sometimes really low values (e.g. 32 rays) may achieve convincing results with high performance, while high large values (e.g. 10000) achieve more accurate results.

◆ mNumSpreadIterations

uint32 Ogre::InstantRadiosity::mNumSpreadIterations

◆ mSpreadThreshold

Real Ogre::InstantRadiosity::mSpreadThreshold

◆ mSurvivingRayFraction

Real Ogre::InstantRadiosity::mSurvivingRayFraction

In range (0; 1]; how many rays that fired in the previous bounce should survive for a next round of bounces.

◆ mVisibilityMask

uint32 Ogre::InstantRadiosity::mVisibilityMask

◆ mVplConstAtten

Real Ogre::InstantRadiosity::mVplConstAtten

◆ mVplIntensityRangeMultiplier

double Ogre::InstantRadiosity::mVplIntensityRangeMultiplier

◆ mVplLinearAtten

Real Ogre::InstantRadiosity::mVplLinearAtten

◆ mVplMaxRange

Real Ogre::InstantRadiosity::mVplMaxRange

ANY CHANGE TO A mVpl* variable will take effect after calling updateExistingVpls (or calling build) How big each VPL should be.

Larger ranges leak light more but also are more accurate in the sections they lit correctly, but they are also get more expensive.

◆ mVplPowerBoost

Real Ogre::InstantRadiosity::mVplPowerBoost

Tweaks how strong VPL lights should be.

In range (0; inf)

◆ mVplQuadAtten

Real Ogre::InstantRadiosity::mVplQuadAtten

◆ mVplThreshold

Real Ogre::InstantRadiosity::mVplThreshold

If all three components of the diffuse colour of a VPL light is below this threshold, the VPL is removed (useful for improving performance for VPLs that barely contribute to the scene).

◆ mVplUseIntensityForMaxRange

bool Ogre::InstantRadiosity::mVplUseIntensityForMaxRange

When true, mVplIntensityRangeMultiplier will be used and each VPL will have a dynamic max range (can't exceed mVplMaxRange though), based on its intensity (smaller VPLs = shorter ranges, powerful VPLs = larger ranges)


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