FidelityFX Hybrid Reflections

alt text

This sample demonstrates the use of the FidelityFX Classifier and FidelityFX Denoiser techniques.

For details on the techniques that underpin the FidelityFX Hybrid Reflections effect you can refer to the respective FidelityFX Classifier documentation and FidelityFX Denoiser documentation .

Requirements

  • Windows

  • DirectX(R)12

  • Vulkan(R)

UI elements

The sample contains various UI elements to help you explore the techniques it demonstrates. The table below summarises the UI elements and what they control within the sample.

Element name

Value

Description

Show Debug Target

Checked/Unchecked

Enable/Disable debug target.

Visualizer

Visualize Hit Counter, Show Reflection Target, Visualize Primary Rays

Choose the target to visualize

Global Roughness Threshold

0.0 - 1.0

Modifies the roughness cutoff for ray tracing.

RT Roughness Threshold

0.0 - 1.0

Modifies the roughness cutoff for ray tracing.

Don’t reshade

Checked/Unchecked

Use radiance from screen space shaded image (possible artifacts).

Enable Hybrid Reflections

Checked/Unchecked

Enable/Disable screen space hybridization.

Setting up FidelityFX Hybrid Reflections

The FidelityFX Hybrid Reflections sample uses FidelityFX Classifier to generate a denoise tile list and a ray tracing tile list, FidelityFX Single Pass Downsampler to create a depth hierarchy for depth buffer travesal, and FidelityFX Denoiser to remove noise from the results of tracing jittered reflection rays

Setting up FidelityFX Classifier

Include the interface for the backend of the FidelityFX Classifier API.

C++:

Copied!

#include <FidelityFX/host/ffx_classifier.h>

Create FidelityFX Classifier context

Copied!

m_ClassifierInitializationParameters.flags = FfxClassifierInitializationFlagBits::FFX_CLASSIFIER_REFLECTION ;
m_ClassifierInitializationParameters.flags |= GetConfig ()->InvertedDepth  ? FFX_CLASSIFIER_ENABLE_DEPTH_INVERTED  : 0;
m_ClassifierInitializationParameters.resolution.width  = resInfo.RenderWidth;
m_ClassifierInitializationParameters.resolution.height = resInfo.RenderHeight;
m_ClassifierInitializationParameters.backendInterface  = m_BackendInterface;
FFX_ASSERT(ffxClassifierContextCreate (&m_ClassifierContext, &m_ClassifierInitializationParameters) == FFX_OK );

Set up the dispatch parameters and dispatch

Copied!

FfxClassifierReflectionDispatchDescription  dispatchParameters = {};
dispatchParameters.commandList                = ffxGetCommandList (pCmdList);
...
FfxErrorCode errorCode = ffxClassifierContextReflectionDispatch (&m_ClassifierContext, &dispatchParameters);

Setting up depth downsampler

Include the interface for the backend of FidelityFX Single Pass Downsampler (SPD) API.

C++:

Copied!

#include <FidelityFX/host/ffx_spd.h>

Create FidelityFX SPD context

Copied!

m_SpdInitializationParameters.flags = 0;
m_SpdInitializationParameters.flags |= FFX_SPD_WAVE_INTEROP_WAVE_OPS ;
m_SpdInitializationParameters.downsampleFilter = GetConfig ()->InvertedDepth  ? FFX_SPD_DOWNSAMPLE_FILTER_MAX : FFX_SPD_DOWNSAMPLE_FILTER_MIN;
m_SpdInitializationParameters.backendInterface = m_BackendInterface;
FFX_ASSERT(ffxSpdContextCreate (&m_SpdContext, &m_SpdInitializationParameters) == FFX_OK );

Copy the depth buffer into the depth hierarchy, set up the dispatch parameters, and dispatch

Copied!

FfxSpdDispatchDescription  dispatchParameters = {};
dispatchParameters.commandList                = ffxGetCommandList (pCmdList);
...
FfxErrorCode errorCode = ffxSpdContextDispatch (&m_SpdContext, &dispatchParameters);

Setting up the FidelityFX Denoiser

Include the interface for the backend of the FidelityFX Denoiser API.

C++:

Copied!

#include <FidelityFX/host/ffx_denoiser.h>

Create the FidelityFX Denoiser context

Copied!

m_DenoiserInitializationParameters.flags                      = FfxDenoiserInitializationFlagBits::FFX_DENOISER_REFLECTIONS ;
m_DenoiserInitializationParameters.windowSize.width           = resInfo.RenderWidth;
m_DenoiserInitializationParameters.windowSize.height          = resInfo.RenderHeight;
m_DenoiserInitializationParameters.normalsHistoryBufferFormat = GetFfxSurfaceFormat (m_pNormal->GetFormat());
m_DenoiserInitializationParameters.backendInterface           = m_BackendInterface;
FFX_ASSERT(ffxDenoiserContextCreate (&m_DenoiserContext, &m_DenoiserInitializationParameters) == FFX_OK );

Set up the dispatch parameters and dispatch

Copied!

FfxDenoiserReflectionsDispatchDescription  denoiserDispatchParameters = {};
denoiserDispatchParameters.commandList  = ffxGetCommandList (pCmdList);
...
FfxErrorCode errorCode = ffxDenoiserContextDispatchReflections (&m_VRSContext, &dispatchParameters);

Sample controls and configurations

For sample controls, configuration, and FidelityFX Cauldron Framework UI element details, see Running the samples .

See also

Related pages

  • Visit the FidelityFX SDK product page for download links and more information.

Looking for more documentation on GPUOpen?

AMD GPUOpen software blogs

Our handy software release blogs will help you make good use of our tools, SDKs, and effects, as well as sharing the latest features with new releases.

GPUOpen Manuals

Don’t miss our manual documentation! And if slide decks are what you’re after, you’ll find 100+ of our finest presentations here.

AMD GPUOpen Performance Guides

The home of great performance and optimization advice for AMD RDNAâ„¢ 2 GPUs, AMD Ryzenâ„¢ CPUs, and so much more.

Getting started: AMD GPUOpen software

New or fairly new to AMD’s tools, libraries, and effects? This is the best place to get started on GPUOpen!

AMD GPUOpen Getting Started Development and Performance

Looking for tips on getting started with developing and/or optimizing your game, whether on AMD hardware or generally? We’ve got you covered!

AMD GPUOpen Technical blogs

Browse our technical blogs, and find valuable advice on developing with AMD hardware, ray tracing, Vulkan®, DirectX®, Unreal Engine, and lots more.

Find out more about our software!

AMD GPUOpen Effects - AMD FidelityFX technologies

Create wonder. No black boxes. Meet the AMD FidelityFX SDK!

AMD GPUOpen Samples

Browse all our useful samples. Perfect for when you’re needing to get started, want to integrate one of our libraries, and much more.

AMD GPUOpen developer SDKs

Discover what our SDK technologies can offer you. Query hardware or software, manage memory, create rendering applications or machine learning, and much more!

AMD GPUOpen Developer Tools

Analyze, Optimize, Profile, Benchmark. We provide you with the developer tools you need to make sure your game is the best it can be!