Support Forum G3D Web Page |
A volume of space within which irradiance queries at arbitrary points are supported using a grid of DDGI probes. More...
Inherits G3D::ReferenceCountedObject.
Public Types | |
enum | ProbeStates { OFF = 0, ASLEEP = 1, JUST_WOKE = 2, AWAKE = 3, JUST_VIGILANT = 4, VIGILANT = 5, UNINITIALIZED = 6 } |
Public Member Functions | |
bool | cameraLocked () |
void | computeProbeOffsetsAndFlags (RenderDevice *rd, const shared_ptr< Texture > &rayHitLocations, const int offset, const int raysPerProbe, bool adjustOffsets=true) |
void | debugDrawProbeLabels (float probeVisualizationRadius) const |
void | debugRenderProbeVisualization (RenderDevice *rd, const shared_ptr< Camera > &camera, const bool visualizeDepth, const float probeVisualizationRadius) |
bool | encloseScene () |
Should the bounds of the probes go around the geo or to the edge of the geo? More... | |
void | gatherTracingProbes (const Array< ProbeStates > &states) |
int | guiIrradianceFormatIndex () |
int | guiVisibilityFormatIndex () |
bool | hasTracingProbes () |
void | init (const String &name, const DDGIVolumeSpecification &spec, const Point3 &cameraPos=Point3(0, 0, 0)) |
const ImageFormat * | irradianceFormat () |
const int | irradianceOctSideLength () |
const shared_ptr< Texture > & | irradianceTexture () |
Vector4int8 * | mapSleepingProbesBuffer (bool forWriting=false) |
bool | notifyOfCameraPosition (const Point3 &cameraWSPosition) |
void | notifyOfDynamicObjects (const Array< AABox > ¤tBoxArray, const Array< Vector3 > &velocityArray) |
void | onGlobalLightChange () |
Switch to low hysteresis for a few frames. More... | |
void | onLargeObjectChange () |
void | onSmallLightChange () |
int | probeCount () const |
const Vector3int32 & | probeCounts () const |
const shared_ptr< Texture > & | probeOffsetTexture () |
bool | probeSleeping () |
virtual const Matrix3 & | randomOrientation () |
const shared_ptr< GLPixelTransferBuffer > & | rayBlockIndexOffsetBuffer () |
virtual void | resizeIfNeeded () |
void | setCameraLocked (bool b) |
void | setDepthOctSideLength (int sideLengthSize, RenderDevice *rd) |
void | setEncloseScene (bool b) |
void | setFirstFrame (bool b) |
void | setGuiIrradianceFormatIndex (int index) |
void | setGuiVisibilityFormatIndex (int index) |
void | setIrradianceOctSideLength (int sideLengthSize, RenderDevice *rd) |
void | setProbeSleeping (bool b) |
void | setRandomOrientation (const Matrix3 &orientation) |
void | setShaderArgs (UniformTable &args, const String &prefix) |
int | skippedProbes () |
DDGIVolumeSpecification & | specification () |
void | unmapSleepingProbesBuffer () |
virtual void | updateAllProbeTypes (RenderDevice *rd, const Array< shared_ptr< Surface >> &surfaceArray, const shared_ptr< Texture > &rayHitLocations, const shared_ptr< Texture > &rayHitRadiance, const int offset, const int raysPerProbe) |
Update both irradiance and depth using newly sampled rays. More... | |
void | updateIrradianceTexture (const shared_ptr< Texture > &newTexture) |
void | updateIrradianceTexture (const shared_ptr< GLPixelTransferBuffer > &pbo) |
void | updateProbeOffsetTexture (const shared_ptr< Texture > &newTexture) |
void | updateProbeOffsetTexture (const shared_ptr< GLPixelTransferBuffer > &pbo) |
void | updateVisibilityTexture (const shared_ptr< Texture > &newTexture) |
void | updateVisibilityTexture (const shared_ptr< GLPixelTransferBuffer > &pbo) |
const int | visibilityOctSideLength () |
const shared_ptr< Texture > & | visibilityTexture () |
Static Public Member Functions | |
static shared_ptr< DDGIVolume > | create (const String &name, const DDGIVolumeSpecification &spec, const Point3 &cameraPos) |
static void | loadGeometry (const String &filename, float scale, Color3 faceColor, AttributeArray &vertexArray, IndexStream &indexStream) |
static const Texture::Encoding & | normalEncoding () |
static void | setVisualizeDebugColors (bool b) |
static const bool | visualizeDebugColors () |
Protected Member Functions | |
Point3int32 | probeIndexToGridIndex (int index) const |
Point3 | probeIndexToPosition (int index) const |
void | setProbeStatesToUninitialized () |
Static Protected Member Functions | |
template<class T , class ... ArgTypes> | |
static shared_ptr< T > | createShared (ArgTypes &&... args) |
Like std::make_shared, but works for protected constructors. More... | |
Protected Attributes | |
shared_ptr< GLPixelTransferBuffer > | m_conservativeAABoundsPBO |
int | m_debugProbeVisualizationColorsIndex |
bool | m_firstFrame = true |
If true, set hysteresis to zero and force all probes to re-render. More... | |
int | m_guiIrradianceFormatIndex = 3 |
bool | m_guiProbeFormatChanged |
int | m_guiVisibilityFormatIndex = 2 |
shared_ptr< Texture > | m_irradianceTexture |
Irradiance encoded with a high gamma curve. More... | |
int | m_lowIrradianceHysteresisFrames = 0 |
When lighting changes dramatically, we drop the hysteresis to 50% of the typical value for a few frames. More... | |
int | m_lowVisibilityHysteresisFrames = 0 |
float | m_maxDistance = 4.0f |
Maximum distance that can be written to a probe. More... | |
String | m_name |
Vector3int32 | m_phaseOffset = Vector3int32(0, 0, 0) |
Point3 | m_probeGridOrigin |
shared_ptr< Texture > | m_probeOffsetTexture |
bool | m_probeSleeping |
Vector3 | m_probeSpacing |
Matrix3 | m_randomOrientation |
Stored so that we can use the same random orientation for each of many calls that recompute the ray direction. More... | |
shared_ptr< GLPixelTransferBuffer > | m_rayBlockIndexOffset |
1D mapping from probe indices to ray block indices in the compressed ray buffers. More... | |
int | m_reducedIrradianceHysteresisFrames = 0 |
int | m_skippedProbes = 0 |
shared_ptr< GLPixelTransferBuffer > | m_sleepingProbesBuffer |
DDGIVolumeSpecification | m_specification |
Vector3int32 | m_uninitializedPlane = Vector3int32(0, 0, 0) |
shared_ptr< Texture > | m_visibilityTexture |
R = mean distance, G = mean distance^2. More... | |
Static Protected Attributes | |
static const Array< Color3 > | s_debugProbeVisualizationColors |
static int | s_debugProbeVisualizationColorsIndex |
static IndexStream | s_debugProbeVisualizationIndexStream |
static AttributeArray | s_debugProbeVisualizationVertexArray |
static const Array< const ImageFormat * > | s_guiDepthFormats |
static const Array< const ImageFormat * > | s_guiIrradianceFormats |
static shared_ptr< GFont > | s_guiLabelFont |
static bool | s_visualizeDebugColors |
A volume of space within which irradiance queries at arbitrary points are supported using a grid of DDGI probes.
A single DDGIVolume may cover the entire scene and use multiple update cascades within it.
If there are parts of your scene with very different geometric density or dimensions, you can have multiple DDGIVolumes.
|
inline |
void G3D::DDGIVolume::computeProbeOffsetsAndFlags | ( | RenderDevice * | rd, |
const shared_ptr< Texture > & | rayHitLocations, | ||
const int | offset, | ||
const int | raysPerProbe, | ||
bool | adjustOffsets = true |
||
) |
|
static |
|
inlinestaticprotectedinherited |
Like std::make_shared, but works for protected constructors.
Call as createShared<myclass>.
void G3D::DDGIVolume::debugDrawProbeLabels | ( | float | probeVisualizationRadius | ) | const |
void G3D::DDGIVolume::debugRenderProbeVisualization | ( | RenderDevice * | rd, |
const shared_ptr< Camera > & | camera, | ||
const bool | visualizeDepth, | ||
const float | probeVisualizationRadius | ||
) |
|
inline |
Should the bounds of the probes go around the geo or to the edge of the geo?
void G3D::DDGIVolume::gatherTracingProbes | ( | const Array< ProbeStates > & | states | ) |
|
inline |
|
inline |
|
inline |
void G3D::DDGIVolume::init | ( | const String & | name, |
const DDGIVolumeSpecification & | spec, | ||
const Point3 & | cameraPos = Point3(0, 0, 0) |
||
) |
|
inline |
|
inline |
|
inline |
|
static |
Vector4int8* G3D::DDGIVolume::mapSleepingProbesBuffer | ( | bool | forWriting = false | ) |
|
inlinestatic |
bool G3D::DDGIVolume::notifyOfCameraPosition | ( | const Point3 & | cameraWSPosition | ) |
void G3D::DDGIVolume::notifyOfDynamicObjects | ( | const Array< AABox > & | currentBoxArray, |
const Array< Vector3 > & | velocityArray | ||
) |
|
inline |
Switch to low hysteresis for a few frames.
Referenced by onLargeObjectChange().
|
inline |
|
inline |
|
inline |
Referenced by hasTracingProbes().
|
inline |
|
protected |
|
protected |
|
inline |
|
inline |
|
inlinevirtual |
|
inline |
|
virtual |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
protected |
|
inline |
void G3D::DDGIVolume::setShaderArgs | ( | UniformTable & | args, |
const String & | prefix | ||
) |
|
inlinestatic |
|
inline |
|
inline |
void G3D::DDGIVolume::unmapSleepingProbesBuffer | ( | ) |
|
virtual |
Update both irradiance and depth using newly sampled rays.
Optional offset within the ray textures for multiple volumes. For now, this offset is equal to the number of probes in the first volume: the texture dimensions are:
w = max(ddgiVolumePrimary.raysPerProbe, ddgiVolumeSecondary.raysPerProbe); h = ddgiVolumePrimary.numProbes + ddgiVolumeSecondary.numProbes;
Lot's of unused texture space in the common case where both volumes cast a different number of rays/probe. However, we'll clean this up by compacting the smaller buffer to have multiple probes on one row.
void G3D::DDGIVolume::updateIrradianceTexture | ( | const shared_ptr< Texture > & | newTexture | ) |
void G3D::DDGIVolume::updateIrradianceTexture | ( | const shared_ptr< GLPixelTransferBuffer > & | pbo | ) |
void G3D::DDGIVolume::updateProbeOffsetTexture | ( | const shared_ptr< Texture > & | newTexture | ) |
void G3D::DDGIVolume::updateProbeOffsetTexture | ( | const shared_ptr< GLPixelTransferBuffer > & | pbo | ) |
void G3D::DDGIVolume::updateVisibilityTexture | ( | const shared_ptr< Texture > & | newTexture | ) |
void G3D::DDGIVolume::updateVisibilityTexture | ( | const shared_ptr< GLPixelTransferBuffer > & | pbo | ) |
|
inline |
|
inline |
|
inlinestatic |
|
protected |
|
protected |
|
protected |
If true, set hysteresis to zero and force all probes to re-render.
Used for when parameters change.
Referenced by setFirstFrame().
|
protected |
Referenced by guiIrradianceFormatIndex(), irradianceFormat(), and setGuiIrradianceFormatIndex().
|
protected |
|
protected |
Referenced by guiVisibilityFormatIndex(), and setGuiVisibilityFormatIndex().
|
protected |
Irradiance encoded with a high gamma curve.
Referenced by irradianceTexture().
|
protected |
When lighting changes dramatically, we drop the hysteresis to 50% of the typical value for a few frames.
Referenced by onGlobalLightChange().
|
protected |
Referenced by onLargeObjectChange().
|
protected |
Maximum distance that can be written to a probe.
|
protected |
|
protected |
|
protected |
|
protected |
Referenced by probeOffsetTexture().
|
protected |
Referenced by probeSleeping(), and setProbeSleeping().
|
protected |
|
protected |
Stored so that we can use the same random orientation for each of many calls that recompute the ray direction.
Referenced by randomOrientation(), and setRandomOrientation().
|
protected |
1D mapping from probe indices to ray block indices in the compressed ray buffers.
Referenced by rayBlockIndexOffsetBuffer().
|
protected |
Referenced by onSmallLightChange().
|
protected |
Referenced by hasTracingProbes(), and skippedProbes().
|
protected |
|
protected |
|
protected |
|
protected |
R = mean distance, G = mean distance^2.
Referenced by visibilityTexture().
|
staticprotected |
|
staticprotected |
|
staticprotected |
|
staticprotected |
|
staticprotected |
Referenced by irradianceFormat().
|
staticprotected |
|
staticprotected |
Referenced by setVisualizeDebugColors(), and visualizeDebugColors().