FidelityFX Hybrid Shadows

alt text

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

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

Slides which review the main steps of FidelityFX Hybrid Shadows sample can be found here.

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.

Controls

Element name

Value

Description

Run Hybrid Shadow

Checked/Unchecked

Enable/Disable the hybrid shadows.

Use Denoiser

Checked/Unchecked

Enable/Disable the shadow denoiser.

Sun Solid Angle

0.0 - 1.0

Controls the size of the sun light.

Debug Mode

Disabled, Show RayTraced Tiles, Show Ray minT, Show Ray maxT, Show Ray length, Show RayTracing Texture

Used to select the debug output view.

TileCutOff

0 - 32

Used to discard a tile where not enough rays need to be traced in the FidelityFX Classifier.

PCF Offset

Checked/Unchecked

Used to offset the blocker depth value in the FidelityFX Classifier.

Reject Lit Pixels for Ray Tracing

Checked/Unchecked

Used to discard pixels for ray tracing that are in lit areas in the FidelityFX Classifier.

Use Shadow Maps to determine RayT

Checked/Unchecked

Enable/Disable the use of shadow maps to determine ray properties.

Setting up FidelityFX Hybrid Shadows

The FidelityFX Hybrid Shadows sample uses FidelityFX Classifier to generate a list of tiles on the screen from which a ray tracing kernel can be launched. Then, the FidelityFX Denoiser can be enabled to remove noise from the raw, 1 sample per pixel ray tracing output.

Setting up classifier

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

Copied!

#include <FidelityFX/host/ffx_classifier.h>

Create FidelityFX Classifier context

Copied!

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

Set up the dispatch parameters and dispatch

Copied!

FfxClassifierShadowDispatchDescription  shadowClassifierDispatchParams = {};
shadowClassifierDispatchParams.commandList  = ffxGetCommandList (pCmdList);
...
FFX_ASSERT(FFX_OK  == ffxClassifierContextShadowDispatch (&m_ClassifierContext, &shadowClassifierDispatchParams));

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 FidelityFX Denoiser context

Copied!

m_DenoiserCtxDesc.flags = FFX_DENOISER_SHADOWS ;
m_DenoiserCtxDesc.windowSize.width = resInfo.RenderWidth;
m_DenoiserCtxDesc.windowSize.height = resInfo.RenderHeight;
m_DenoiserCtxDesc.flags |= GetConfig ()->InvertedDepth  ? FFX_CLASSIFIER_ENABLE_DEPTH_INVERTED  : 0;
m_DenoiserCtxDesc.backendInterface = backendInterface;
FFX_ASSERT(ffxDenoiserContextCreate (&m_DenoiserContext, &m_DenoiserCtxDesc) == FFX_OK );

Set up the dispatch parameters and dispatch

Copied!

FfxDenoiserShadowsDispatchDescription  denoiserDispatchDescription = {};
denoiserDispatchDescription.commandList  = ffxGetCommandList (pCmdList);
...
FFX_ASSERT(FFX_OK  == ffxDenoiserContextDispatchShadows (&m_DenoiserContext, &denoiserDispatchDescription));

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!