FidelityFX Contrast Adaptive Sharpening 1.2

FidelityFX Contrast Adaptive Sharpening (CAS) is a low overhead adaptive sharpening algorithm with optional up-sampling. The technique is developed by Timothy Lottes (creator of FXAA) and was created to provide natural sharpness without artifacts.

Integration guidelines

Sharpness

A float value controls the sharpening strength of CAS. You can pass the sharpness through FfxCasDispatchDescription::sharpness to the ffxCasContextDispatch function in ffx_cas.h, in which the value will be packed into an internal constant buffer.

Sharpening modes

In the CAS sample, there are three sharpening modes that can be selected:

  1. Sharpening disabled.

  2. Sharpening enabled, upsampling disabled.

  3. Both sharpening and upsampling enabled.

You can also toggle the upscaling mode by yourself by setting FFX_CAS_SHARPEN_ONLY in FfxCasContextDescription::flags. If you want upsampling enabled, please don’t forget to set render and display resolution info in the FfxCasContextDescription.

Color space conversion

CAS needs linear input color to perform correctly. If your color buffer is not in linear color space, you can set FfxCasContextDescription::colorSpaceConversion to a color space supported in FfxCasColorSpaceConversion to denote your input color space. CAS will perform color space conversion (if necessary) when loading or outputting color. It also ensures the output will be in the same color space as your input.

If you need to create a new color space conversion function, here’s how:

  1. Create corresponding enum values inside FfxCasColorSpaceConversion and CasShaderPermutationOptions.

  2. Add new branch inside the POPULATE_PERMUTATION_KEY macro in ffx_cas_shaderblobs.cpp. Please take the existing branches as reference.

  3. Add new pre-compiler branches inside the casInput, casOuput, casInputHalf and casOutputHalf functions in ffx_cas_callbacks.glsl or ffx_cas_callbacks.hlsl. Under these branches you should add your new color space conversion as needed.

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!