FidelityFX Combined Adaptive Compute Ambient Occlusion (CACAO)
This sample demonstrates the use of the FidelityFX Combine Adaptive Compute Ambient Occlusion technique.
For details on the technique that underpins the FidelityFX CACAO effect you can refer to the respective technique documentation .
Requirements
-
Windows
-
DirectX(R)12
-
Vulkan(R)
UI elements
The sample contains UI options to allow experimentation with relevant values and techniques. The table below summarizes the UI elements and what they control within the sample.
Element name |
Value |
Description |
---|---|---|
Preset |
|
Selects the quality and toggles between downsampled and native resolution sampling. |
Radius |
|
The radius in world space of the occlusion sphere. A larger radius will make further objects contribute to the ambient occlusion of a point. |
Shadow Multiplier |
|
The linear multiplier for shadows. Higher values intensify shadows. |
Shadow Power |
|
The exponent value for shadows values. Larger values create darker shadows. |
Shadow Clamp |
|
Clamps the shadow values to be within a certain range. |
Horizon Angle Threshold |
|
Minimum angle necessary between geometry and a point to create occlusion. Adjusting this value helps reduce self-shadowing. |
Fade Out From |
|
The starting world space distance to fade the effect out over. |
Fade Out To |
|
The end world space distance to fade the effect out over. |
Quality Level |
|
Determines various aspects of how FidelityFX CACAO is generated, including number of samples taken for screen space ambient occlusion (SSAO) generation, number of pixels SSAO is generated for, etc. |
Adaptive Quality Limit |
|
Limits the total number of samples taken at adaptive quality levels. |
Blur Pass Count |
|
The number of edge sensitive blurs to run on the raw SSAO output. |
Sharpness |
|
The sharpness controls how much blur should bleed over edges. |
Detail Shadow Strength |
|
Adds in more detailed shadows based on edges. These are less temporally stable. |
Generate Normal Buffer From Buffer Target |
|
When toggled on, the normal buffer will be generated from the depth buffer. This means SSAO will only use the depth buffer as input. |
Use Downsampled SSAO |
|
When toggled on, SSAO is generated at half resolution instead of native resolution. |
Bilateral Sigma Squared |
|
Only affects downsampled SSAO. Higher values create a larger blur. |
Bilateral Similarity Distance Sigma |
|
Only affects downsampled SSAO. Lower values create sharper edges. |
Setting up the FidelityFX CACAO effect
The FidelityFX CACAO shaders take as input the depth buffer produced by the geometry rendering passes. In can also optionally take in the normal buffer produced by the geometry rendering passes, otherwise generating this information from the depth buffer.
The ffx_cacao.h
file contains the effect context creation, dispatch, constants update, and context destruction functions.
Note, the effect is designed to work from C++
, HLSL
, and GLSL
. These can be selected via #define
macros (see below).
C++:
HLSL:
GLSL:
Shader options
Some of the FidelityFX CACAO passes support different options.
One supported option is the use of 16 bit floating point (FP16) maths instead of 32 bit.
The shaders can also be run in Wave64 or Wave32. How shaders are run is largely determined at run-time given the executing hardware platform.
Lastly, some passes can run with the Apply Smart
option, enabling edge aware execution for passes such as Apply
and Bilateral Upscale
.
Sample controls and configurations
For sample controls, configuration, and FidelityFX Cauldron Framework UI element details, see Running the samples .