Support Forum       G3D Web Page     
Classes | Public Member Functions | Public Attributes | List of all members
G3D::AmbientOcclusionSettings Class Reference

For use with AmbientOcclusion. More...

Classes

class  ZStorage
 What encoding scheme to pack CSZ values into when computing the heirarchy for raw AO sampling. More...
 

Public Member Functions

 AmbientOcclusionSettings ()
 
 AmbientOcclusionSettings (const Any &a)
 
void extendGBufferSpecification (GBuffer::Specification &spec) const
 Ensures the GBuffer specification has all the fields needed to render this effect. More...
 
int numSpiralTurns () const
 The number of spiral turns to use when generating the per-pixel taps. More...
 
Any toAny () const
 

Public Attributes

float bias
 Increase if you have low-poly curves that are getting too much self-shadowing in shallow corners. More...
 
int blurRadius
 Filter radius in pixels. More...
 
int blurStepSize
 Default is to step in 2-pixel intervals. More...
 
float depthPeelSeparationHint
 A hint for how far (in meters) to buffer the depth peel for the ao. More...
 
bool diskFramebuffer = false
 If true, only compute AO within a disk, for VR headsets. More...
 
float edgeSharpness
 Increase to make depth edges crisper. More...
 
bool enabled
 
bool highQualityBlur
 
float intensity
 Darkness multiplier. More...
 
bool monotonicallyDecreasingBilateralWeights
 If true, ensure that the "bilateral" weights are monotonically decreasing moving away from the current pixel. More...
 
int numSamples
 Total number of direct samples to take at each pixel. More...
 
bool packBlurKeys
 Perform an extra packing step to minimize bandwidth on the blur passes. More...
 
float radius
 Radius in world-space units. More...
 
TemporalFilter::Settings temporalFilterSettings
 Temporal filtering occurs before spatial filtering. More...
 
bool temporallyVarySamples
 Vary sample locations with respect to time. More...
 
bool useDepthPeelBuffer
 Increases quality of AO in scenes around overlapping objects. More...
 
bool useNormalBuffer
 Avoids white "halos" around objects, enables using normals in the blur Has negligble cost on most GPUs. More...
 
bool useNormalsInBlur
 Increases sharpness at edges. More...
 
ZStorage zStorage
 

Detailed Description

For use with AmbientOcclusion.

This is not an inner class of AmbientOcclusion to avoid creating a dependency between Lighting and AmbientOcclusion.

Constructor & Destructor Documentation

◆ AmbientOcclusionSettings() [1/2]

G3D::AmbientOcclusionSettings::AmbientOcclusionSettings ( )

◆ AmbientOcclusionSettings() [2/2]

G3D::AmbientOcclusionSettings::AmbientOcclusionSettings ( const Any a)

Member Function Documentation

◆ extendGBufferSpecification()

void G3D::AmbientOcclusionSettings::extendGBufferSpecification ( GBuffer::Specification spec) const

Ensures the GBuffer specification has all the fields needed to render this effect.

See also
GApp::extendGBufferSpecification

◆ numSpiralTurns()

int G3D::AmbientOcclusionSettings::numSpiralTurns ( ) const

The number of spiral turns to use when generating the per-pixel taps.

If numSamples < 100, this is the calculated optimal value for minimizing discrepancy. Otherwise its just a large prime that will at least not cause the samples to degenerate into perfect lines

◆ toAny()

Any G3D::AmbientOcclusionSettings::toAny ( ) const

Member Data Documentation

◆ bias

float G3D::AmbientOcclusionSettings::bias

Increase if you have low-poly curves that are getting too much self-shadowing in shallow corners.

Decrease if you see white lines in sharp corners.

Bias addresses two problems. The first is that a tessellated concave surface should geometrically exhibit stronger occlusion near edges and vertices, but this is often undesirable if the surface is supposed to appear as a smooth curve. Increasing bias increases the maximum concavity that can occur before AO begins.

The second is that due to limited precision in the depth buffer, a surface could appear to occlude itself.

◆ blurRadius

int G3D::AmbientOcclusionSettings::blurRadius

Filter radius in pixels.

This will be multiplied by blurStepSize. Default is 4.

◆ blurStepSize

int G3D::AmbientOcclusionSettings::blurStepSize

Default is to step in 2-pixel intervals.

This constant can be increased while R decreases to improve performance at the expense of some dithering artifacts.

Morgan found that a scale of 3 left a 1-pixel checkerboard grid that was unobjectionable after shading was applied but eliminated most temporal incoherence from using small numbers of sample taps.

Must be at least 1.

◆ depthPeelSeparationHint

float G3D::AmbientOcclusionSettings::depthPeelSeparationHint

A hint for how far (in meters) to buffer the depth peel for the ao.

Since AmbientOcclusion does not perform the depth peel, this is commonly read by the application, which in turn performs the depth peel and passes the resulting buffer into AmbientOcclusion.

◆ diskFramebuffer

bool G3D::AmbientOcclusionSettings::diskFramebuffer = false

If true, only compute AO within a disk, for VR headsets.

The exact disk radius is different for each framebuffer within the AmbientOcclusion pass and has been tuned to look good on all VR headsets.

This parameter must be set at runtime. It is not persisted to any files.

◆ edgeSharpness

float G3D::AmbientOcclusionSettings::edgeSharpness

Increase to make depth edges crisper.

Decrease to reduce flicker. Default is 1.0.

◆ enabled

bool G3D::AmbientOcclusionSettings::enabled

◆ highQualityBlur

bool G3D::AmbientOcclusionSettings::highQualityBlur

◆ intensity

float G3D::AmbientOcclusionSettings::intensity

Darkness multiplier.

◆ monotonicallyDecreasingBilateralWeights

bool G3D::AmbientOcclusionSettings::monotonicallyDecreasingBilateralWeights

If true, ensure that the "bilateral" weights are monotonically decreasing moving away from the current pixel.

Default is true.

◆ numSamples

int G3D::AmbientOcclusionSettings::numSamples

Total number of direct samples to take at each pixel.

Must be greater than 2. The default is 19. Higher values increase image quality.

◆ packBlurKeys

bool G3D::AmbientOcclusionSettings::packBlurKeys

Perform an extra packing step to minimize bandwidth on the blur passes.

If normals are used in the blur, this will pack CS_Z+normals into RGBA8, with RG encoding a 16bit normalized CS_Z value, and BA encoding normals in oct16.

If normals are not used in the blur, simply packs CS_Z values.

◆ radius

float G3D::AmbientOcclusionSettings::radius

Radius in world-space units.

◆ temporalFilterSettings

TemporalFilter::Settings G3D::AmbientOcclusionSettings::temporalFilterSettings

Temporal filtering occurs before spatial filtering.

◆ temporallyVarySamples

bool G3D::AmbientOcclusionSettings::temporallyVarySamples

Vary sample locations with respect to time.

This increases temporal jitter, but combined with temporal filtering, temporal artifacts can be reduced and image quality increased

◆ useDepthPeelBuffer

bool G3D::AmbientOcclusionSettings::useDepthPeelBuffer

Increases quality of AO in scenes around overlapping objects.

Increases runtime cost by about 1.5x.

If true, requires the depth peel buffer to be non-null.

◆ useNormalBuffer

bool G3D::AmbientOcclusionSettings::useNormalBuffer

Avoids white "halos" around objects, enables using normals in the blur Has negligble cost on most GPUs.

If true, requires the normal buffer to be non-null.

◆ useNormalsInBlur

bool G3D::AmbientOcclusionSettings::useNormalsInBlur

Increases sharpness at edges.

Has no effect if not using a precomputed normal buffer, or the blur radius is zero. Use normals in the blur passes in addition to depth to use as weights. Default is true.

◆ zStorage

ZStorage G3D::AmbientOcclusionSettings::zStorage

documentation generated on Wed Nov 24 2021 08:01:53 using doxygen 1.8.15