This is the documentation for Enlighten.
class Enlighten ProbeSetManagerVoxel
class Enlighten::ProbeSetManagerVoxel
Probe Set Manager Voxel class Implementation of the IProbeSetManager interface class This implementation is based on a voxel grid acceleration data structure.
The scene is being voxelised, for each voxel we store an array of probe sets that intersect that voxel. Then at run time for a given point we can retrieve the voxel this point is in, and therefore all the probe sets that may be needed for interpolation.
To assign probe sets to voxels we do not need any run time data for the probe sets. Only their geometrical properties are needed (bounding box, resolution). At run time ProbeSetManagerVoxel keeps track (via MarkProbeSetAsLoaded and MarkProbeSetAsUnLoaded methods) of which probe sets have their run time data loaded, and uses only those ones for interpolation.
During interpolation each probe sets gets a weight (based on where it is in relation to the query point), that maximum weight that a given probe set can get is limited by the MaxWeight that can be set using SetMaxWeightForProbeSet method. This mechanism allows for LOD switching (given probe set can has its maximum weight gradually decreased to 0 and when it reaches 0 it can be unloaded and a different LOD probe set loaded)
Classes
Name | Description |
|---|---|
a utility struct to be used with std::sort, order based on probes density | |
Helper struct describing a probe set properties. | |
Helper struct describing a voxel. |
Variables
Name | Description |
|---|---|
void * m_InternalMemory | internal memory used by the class - needs to be provided by the user. Has to be at least 4-bytes aligned. |
bool m_IsInitialised | is the manager in an initialised state |
float m_MaxVolumeForVoxelisationInVoxelVolumes | if a volume of given probe set divided by the voxel volume is greater than this threshold, then that probe set will not be voxelised |
Geo::u16 * m_NotVoxelisedProbeSetPropsIndices | pointer to an array that holds indices to (m_ProbeSetProps) of ProbeSets that were too big to be voxelised |
Geo::u16 m_NumNotVoxalisedProbeSets | number of not voxelised Probe Sets |
Geo::u16 m_NumProbeSets | total number of Probe Sets under management (both voxelised and not) |
ProbeSetProps * m_ProbeSetProps | pointer to an array of ProbeSetProps objects, after Initialise() this is sorted by the Guids of the ProbeSets Indices in Voxel::m_ProbeSetPropsIndices are indices into this array. |
size_t m_SizeOfInternalMemory | size of the external memory provided by the user. |
Geo::u32 m_TotalNumOfOccupiedVoxels | Number of occupied voxels. |
Voxel * m_Voxels | pointer to an array that holds all the voxels (sorted by their coordinates) |
Geo::v128 m_VoxelSize | Voxel size. |
Functions
Name | Description |
|---|---|
CalculateInternalMemoryRequirement(Geo::v128, float, RadProbeSetMetaData const *const *, Geo::u16) | Method to calculate the upper limit on memory needed by the Probe Set Manager. |
ConstructExpandedNonAABBVolume(Enlighten::RadProbeSetMetaData const &) | Return an expanded bounding volume constructed from given meta data. |
For a given Probe Set guid, find an index into m_ProbeSetProps array. | |
Get the internal memory storage. | |
Get an interpolation set that corresponds to given index - this index needs to be comaptible with ProbeInterpolant::m_ProbeSetIndex filled by the GetProbeInterpolants(...) method. | |
Get an interpolation set that corresponds to given index. | |
Get an interpolation set that corresponds to given guid. | |
Get the maximum weight for a given Probe Set. | |
Set a maximum interpolation weight for the given Probe Set. | |
Get the ProbeSetProps for a given not voxelised Probe Set. | |
Some of the Probe Sets may be too big to undergo full voxelisation (i.e. | |
Return the total (both voxelised and not voxelised) probe sets that are under management. | |
Get the total number of Probe Sets under management. | |
Get the total number of occupied voxels. | |
GetProbeInterpolants(Geo::v128 const &, ProbeInterpolant *, Geo::s32, Geo::s32 &) | Retrieves the probes interpolants for a given point. |
GetProbeInterpolants(Geo::v128 const &, ProbeInterpolant *, Geo::s32, Geo::s32 &, Geo::u32) | Retrieves the probes interpolants for a given point and specified LOD. |
GetProbeInterpolants(Geo::v128 const &, ProbeInterpolant *, Geo::s32, Geo::s32 &) | Retrieves the probes interpolants for a given point. |
GetProbeInterpolants(Geo::v128 const &, ProbeInterpolant *, Geo::s32, Geo::s32 &, Geo::u32) | Retrieves the probes interpolants for a given point and specified LOD. |
Return Probe Set Interpolators. | |
Get the ProbeSetProps for a given index. | |
Get the voxel for a given index. | |
Get voxel size used by the Probe Set Manager. | |
Initialise(Geo::v128, float, RadProbeSetMetaData const *const *, Geo::u16, size_t &) | Initialise the class, construct the internal acceleration data structure. |
Return true if Probe Set at index1 has smaller probe density than the one at index2. | |
Return an true if manager was successfully initialised. | |
Marks all Interpolation Input Sets as unloaded. | |
Mark all Interpolation Set as unloaded. | |
MarkProbeSetAsLoaded(Enlighten::InterpolationInputSet const &) | Mark given Interpolation Set as loaded, and provide run time data for it. |
MarkProbeSetAsLoaded(Enlighten::InterpolationInputSet const &) | Marks given Interpolation Input Set as loaded. |
Mark given Interpolation Set as unloaded. | |
Marks given Interpolation Input Set as unloaded. | |
OnAllLoadedProbeSetsArrayChanged(Enlighten::InterpolationInputSet const *, Geo::s32) | Allows the probe set manager a chance to observe the contiguous memory block in which the runtime stores all loaded input sets. |
Set the internal memory storage to an externally allocated mem pool. | |
Set the maximum weight for a given Probe Set. | |
Set a maximum interpolation weight for the given Probe Set. | |
Return true if given volume is too big to be voxelised. |
std::size_t Enlighten::ProbeSetManagerVoxel::CalculateInternalMemoryRequirement
public: std::size_t CalculateInternalMemoryRequirement
(
Geo::v128 voxelSize,
float maxVolumeThreshold,
RadProbeSetMetaData const *const * probeSets,
Geo::u16 numProbeSets
)
Method to calculate the upper limit on memory needed by the Probe Set Manager.
Parameters
[in] | voxelSize | The size of the voxel (the smaller the voxel to more memory will be needed) |
[in] | maxVolumeThreshold | Maximum ratio of probe set volume to voxel volume for a probe set to be voxelised. |
[in] | probeSets | Array of geometrical descriptions of all the probe sets that will be under the management. |
[in] | numProbeSets | Number of entries in probeSets array. |
Returns
The upper limit on memory needed to initialise the Probe Set Manager.
Geo::GeoNonAABoundingBox Enlighten::ProbeSetManagerVoxel::ConstructExpandedNonAABBVolume
public: Geo::GeoNonAABoundingBox ConstructExpandedNonAABBVolume
(
Enlighten::RadProbeSetMetaData const & volumeMetaData
) const
Return an expanded bounding volume constructed from given meta data.
Returns
expanded bounding volume of the probe set
bool Enlighten::ProbeSetManagerVoxel::FindIndexIntoProbeSetPropsArray
protected: bool FindIndexIntoProbeSetPropsArray
(
Geo::GeoGuid guid,
Geo::u16 & index
) const
For a given Probe Set guid, find an index into m_ProbeSetProps array.
Since m_ProbeSetProbs is sorted by the Probe Set guids, so this is a OLog(n) operation.
Parameters
[in] | guid | Guid of the Probe Set. |
[out] | index | Index of that Probe Set into the m_ProbeSetProps array. |
Returns
TRUE if the Probe Set Manager is initialised and the Probe Set with guid is under its management, FALSE otherwise.
void* Enlighten::ProbeSetManagerVoxel::GetInternalMemory
public: void * GetInternalMemory() const
Get the internal memory storage.
Returns
the internal memory storage.
virtual Enlighten::InterpolationInputSet const* Enlighten::IProbeSetManager::GetInterpolationInputSet
public: Enlighten::InterpolationInputSet const * GetInterpolationInputSet
(
Geo::u32 index
) const
Get an interpolation set that corresponds to given index - this index needs to be comaptible with ProbeInterpolant::m_ProbeSetIndex filled by the GetProbeInterpolants(...) method.
May return NULL is Probe Set that corresponds to index is unloaded. Note, however that none of the ProbeInterpolant::m_ProbeSetIndex indices returned from GetProbeInterpolants(...) should correspond to an unloaded Probe Sets.
Returns
The InterpolationI Input Set for a given index or NULL if that Probe Set in unloaded.
virtual Enlighten::InterpolationInputSet const* Enlighten::ProbeSetManagerVoxel::GetInterpolationInputSet
public: virtual Enlighten::InterpolationInputSet const * GetInterpolationInputSet
(
Geo::u32 index
) const
Get an interpolation set that corresponds to given index.
This index is comaptible with ProbeInterpolant::m_ProbeSetIndex
Returns
InterpolationInputSet that corresponds to the given index. Can be NULL if the probe set for that index is not loaded. Note that none of the probe set indices returned from GetProbeInterpolants will correspond to unloaded probe sets.
Enlighten::InterpolationInputSet const* Enlighten::ProbeSetManagerVoxel::GetInterpolationInputSet
public: Enlighten::InterpolationInputSet const * GetInterpolationInputSet
(
Geo::GeoGuid guid
) const
Get an interpolation set that corresponds to given guid.
Needs to perform a search. Scales as Log(N) [N - num of probe sets)
Returns
InterpolationInputSet that corresponds to the given guid. Can be NULL if the probe set for that guid is not loaded.
virtual bool Enlighten::ProbeSetManagerVoxel::GetMaxWeightForProbeSet
public: virtual bool GetMaxWeightForProbeSet
(
Geo::GeoGuid const & probeSet,
float & maxWeight
) const
Get the maximum weight for a given Probe Set.
Parameters
[in] | probeSet | GUID of the Probe Set to retrieve the maximum weight for. |
[out] | maxWeight | The retrieved maximum weight. |
Returns
TRUE if the input to this function is valid, Probe Set Manager is initialised and the probeSet probe set is under Probe Set Manager management, otherwise FALSE.
virtual bool Enlighten::IProbeSetManager::GetMaxWeightForProbeSet
public: bool GetMaxWeightForProbeSet
(
Geo::GeoGuid const & probeSet,
float & maxWeight
) const
Set a maximum interpolation weight for the given Probe Set.
. Needs to perform a search OLog(N). Where N is number of probe sets under management.
Parameters
[in] | probeSet | The GUID of the Probe Set. |
[out] | maxWeight | New maximum interpolation weight. |
Returns
TRUE if the Probe Set is under ProbeSetManager management, otherwise FALSE.
ProbeSetProps const& Enlighten::ProbeSetManagerVoxel::GetNotVoxelisedProbeSetProps
public: ProbeSetProps const & GetNotVoxelisedProbeSetProps
(
Geo::s32 index
) const
Get the ProbeSetProps for a given not voxelised Probe Set.
The index used here is an index to m_NotVoxelisedProbeSetPropsIndices array which in turn holds indices to m_ProbeSetProps. This index is NOT compatible with what is being returned from GetProbeInterpolants in ProbeInterpolant::m_ProbeSetIndex.
Returns
ProbeSetProps for the requested not voxelised Probe Set index.
Geo::u16 Enlighten::ProbeSetManagerVoxel::GetNumNotVoxelisedProbeSets
public: Geo::u16 GetNumNotVoxelisedProbeSets() const
Some of the Probe Sets may be too big to undergo full voxelisation (i.e.
voxelising them would produce too many voxels. Those probe sets are stored in an additional array. This method returns the number of those not voxelised volumes. If for a given point in space no voxel in the m_Voxels can be found, then not voxelised probe sets should be used for interpolation. If however a voxel is found, then there is no need to check the not voxelised sets as the Voxel::m_ProbeSetPropsIndices contains not voxelised volumes too.
Returns
Number of not voxelised Probe Sets.
virtual Geo::s32 Enlighten::ProbeSetManagerVoxel::GetNumProbeSets
public: virtual Geo::s32 GetNumProbeSets() const
Return the total (both voxelised and not voxelised) probe sets that are under management.
Returns
total number of probe sets under management.
virtual Geo::s32 Enlighten::IProbeSetManager::GetNumProbeSets
public: Geo::s32 GetNumProbeSets() const
Get the total number of Probe Sets under management.
Returns
the total number of Probe Sets under management.
Geo::s32 Enlighten::ProbeSetManagerVoxel::GetNumVoxels
public: Geo::s32 GetNumVoxels() const
Get the total number of occupied voxels.
Returns
Number of occupied voxels.
virtual bool Enlighten::ProbeSetManagerVoxel::GetProbeInterpolants
public: virtual bool GetProbeInterpolants
(
Geo::v128 const & point,
ProbeInterpolant * interpolants,
Geo::s32 numMaxInterpolants,
Geo::s32 & numUsedInterpolants
) const
Retrieves the probes interpolants for a given point.
Parameters
[in] | point | Location used for the interpolation. |
[out] | interpolants | Output probe interpolants. |
[in] | numMaxInterpolants | Size of the output interpolants array. |