Saved searches
Use saved searches to filter your results more quickly
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.
AMD Fidelity FX Contrast Adaptive Sharpening plugin for Unreal Engine
License
amedrycki/FidelityFXCAS
Name already in use
- Local
- Codespaces
Use Git or checkout with SVN using the web URL.
Work fast with our official CLI. Learn more about the CLI.
Sign In Required
Please sign in to use Codespaces.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching Xcode
If nothing happens, download Xcode and try again.
Launching Visual Studio Code
Your codespace will open once ready.
There was a problem preparing your codespace, please try again.
Latest commit
Git stats
Files
Failed to load latest commit information.
README.md
AMD Fidelity FX Contrast Adaptive Sharpening plugin for Unreal Engine
Version and support
The current plugin version has been developed and tested on UE v4.24 on Windows platform on a C++ project.
This plugin provides an implementation of Fidelity FX Contrast Adaptive Sharpening effect into the Unreal Engine Pipeline.
FidelityFX is a series of optimized shader-based features aimed at improving rendering quality and performance.
Contrast Adaptive Sharpening (CAS)
Contrast Adaptive Sharpening (CAS) is the first FidelityFX release. CAS provides a mixed ability to sharpen and optionally scale an image. The algorithm adjusts the amount of sharpening per pixel to target an even level of sharpness across the image. Areas of the input image that are already sharp are sharpened less, while areas that lack detail are sharpened more. This allows for higher overall natural visual sharpness with fewer artifacts. CAS was designed to help increase the quality of existing Temporal Anti-Aliasing (TAA) solutions. TAA often introduces a variable amount of blur due to temporal feedback. The adaptive sharpening provided by CAS is ideal to restore detail in images produced after TAA . CAS’ optional scaling capability is designed to support Dynamic Resolution Scaling (DRS). DRS changes render resolution every frame, which requires scaling prior to compositing the fixed-resolution User Interface (UI). CAS supports both up-sampling and down-sampling in the same single pass that applies sharpening.
View in full resolution for the differences to be fully visible.
| Screen space CAS OFF | Screen space CAS ON |
|---|---|
![]() |
![]() |
| Upsampling from 50% resolution (CAS OFF) | Upsampling from 50% resolution (CAS ON) |
|---|---|
![]() |
![]() |
In short this plugin let’s you do 4 things:
- Draw a texture to a render target using CAS.
- Draw a texture to a higher resolution render target using CAS and it’s upsampling feature.
- Apply CAS in the UE rendering pipeline as a post process screen space effect.
- Replace UE’s default upsample pass in the rendering pipeline with CAS’ upsampling (requires small engine code modifications).
It is also a good reference material if you want to learn how to write Global Shaders for Unreal Engine.
To add the plugin to your project:
- Download the repository to the following folder in your project <ProjectName>/Plugins/FidelityFXCAS/ .
- Right click your project’s .uproject file and choose Generate Visual Studio project files.
- Open your projects’ solution in Visual Studio and compile.
- Enable the plugin in your
- Open your project in Unreal Editor and choose Edit -> Plugins from the menu to open the Plugins manager window.
- The plugin should be visible in the category Project -> Rendering.
- Select the FidelityFXCAS plugin and check Enable. You may be asked to rebuild the plugin and restart the editor.
[Optional] Enabling screen space upsampling (requires Unreal Engine source code modification)
This step is only required to enable the CAS screen space upsampling plugin functionality. If you skip this step you may still use other plugin functionalities. Unreal Engine v4.24 does not provide any means to replace the default upsampling pipeline with your custom algorithms. Therefore to add the callback for the plugin to use the following changes in 3 engine source code files are required.
In the file Engine/Source/Runtime/RenderCore/Public/RendererInterface.h in line 748 (UE v4.24) or 750 (UE v4.25) add a delegate declaration and a callback accessor:
In the file Engine/Source/Runtime/Renderer/Private/RendererModule.h add the callback accessor definition in line 97 (UE v4.24) or 96 (UE v4.25) and delegate member variable in line 115 (UE v4.24) or 117 (UE v4.25):
In the file Engine/Source/Runtime/Renderer/Private/PostProcess/PostProcessUpscale.cpp add EngineModule.h include in line 5 and call the callback in line 200 (UE 4.24) or 199 (UE 4.25):
After you’ve made the changes to the source code you need to let the module know it can use them. Change the following line in the CASTest1/Plugins/FidelityFXCAS/Source/FidelityFXCAS/FidelityFXCAS.Build.cs file:
After making the changes to the source code you will have to compile your project.
For a working example see the FidelityFXCASExample repository containing a working Unreal Engine (v4.24) C++ project.
Screen space CAS
After running your game open the console (by pressing ` ) and use the follwing console variables:
- r.fxcas.DisplayInfo — Enables onscreen inormation display for AMD FidelityFX CAS plugin.
- 0 Disabled — no information is displayed (default)
- 1 Enabled — displays information about the CAS plugin status
- 0 Disabled (default)
- 1 Enabled
- 0 minimum (lower ringing)
- 1 maximum (higher ringing)
Screen space CAS with upsampling
After running your game open the console (by pressing ` ) and change the render resolution to half the size using the console variable r.ScreenPercentage 50 and enable FX CAS with r.fxcass.SSCAS 1 .
If you enabled the custom upsampling callback by applying the engine source code modifications described in the section Enabling screen space upsampling (requires Unreal Engine source code modification) above, the rendering pipeline will automatically use the FX CAS upsampling. If you turn off FX CAS with r.fxcass.SSCAS 0 the render pipeline will switch back to the default upsampling.
If you did not apply the engine source code modifications the screen space CAS will still work and sharpen the image in a postprocess before the upsampling takes plase. Then the render pipeline will apply the default upsampling algorithms.
Rendering a texture to a render target
To render a texture to a render target use the DrawToRenderTarget method provided by the plugin’s blueprint library.
Pre-initializing compute shader outputs
The plugin needs buffers for compute shader to work. There are two buffers needed for the screen space CAS and one buffer for each texture render target you use. The plugin will do the automatic lazy initialization of the necessary buffers during the first render pass. However, you can-preinitialize the necessary buffers to avoid any possible performance drops later.
To pre-initialize the screen space buffers you can use the blueprint method void InitSSCASCSOutputs(const FIntPoint& Size) or the C++ method void InitSSCASCSOutputs(const FIntPoint& Size) provided by the module.
To pre-initialize the render target buffers you can use the blueprint method void InitCSOutput(class UTextureRenderTarget2D* InOutputRenderTarget) .
Module API methods
- Module access methods
- static bool IsAvailable() — returns true if the module is loaded
- static FFidelityFXCASModule& Get() — returns the loaded module reference
- static bool IsEnabledOnCurrentPlatform() — return true if the module is enabled for the current platform
- bool GetIsSSCASEnabled() const — returns true if SS CAS is enabled
- void SetIsSSCASEnabled(bool Enabled) — enables / disables SS CAS
- void EnableSSCAS() — enables SS CAS
- void DisableSSCAS() — disables SS CAS
- float GetSSCASSharpness() const — returns the current value of the Sharpness parameter
- void SetSSCASSharpness(float Sharpness) — sets the Sharpness parameter (the Sharpness value should be in the range [0, 1])
- bool GetUseFP16() const — returns true if SS CAS is using the half-precision version of the shader
- void SetUseFP16(bool UseFP16) enables / disables the use of half-presicions shader for SS CAS
- void InitSSCASCSOutputs(const FIntPoint& Size) — initializes the compute shader outputs for SS CAS
- void GetSSCASResolutionInfo(FIntPoint& OutInputResolution, FIntPoint& OutOutputResolution) const — gets the input and output resolutions for SS CAS
- FIntPoint GetSSCASInputResolution() const — returns the current input resolution for SS CAS
- FIntPoint GetSSCASOutputResolution() const — return the current output resolution for SS CAS
Blueprint library API
- General purpose plugin methods
- bool IsPluginEnabledOnCurrentPlatform() — return true if the module is enabled for the current platform
- bool GetIsSSCASEnabled() — returns true if screen space CAS is enabled
- void SetIsSSCASEnabled(bool bEnabled) — enables / disables screen space CAS
- void ToggleIsSSCASEnabled() — toggles SS CAS between enabled and disabled
- void EnableSSCAS() — enables SS CAS
- void DisableSSCAS() — disables SS CAS
- void InitSSCASCSOutputs(const FIntPoint& Size) — initializes SS CAS compute shader output buffers
- float GetSSCASSharpness() — returns the current value of the Sharpness parameter
- void SetSSCASSharpness(float Sharpness) — sets the Sharpness parameter (the Sharpness value should be in the range [0, 1])
- bool GetUseFP16() — returns true if SS CAS is using the half-precision version of the shader
- void SetUseFP16(bool UseFP16) — enables / disables the use of half-presicions shader for SS CAS
- void InitCSOutput(class UTextureRenderTarget2D* InOutputRenderTarget) — initializes compute shader output buffer for a given render target
- void DrawToRenderTarget(class UTextureRenderTarget2D* InOutputRenderTarget, class UTexture2D* InInputTexture)` — renders a texture to a render target and aplies CAS and upscaling (if the render target resolution is greater than the texture resolution).
Copyright (c) 2020 Andrzej Medrycki
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the «Software»), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED «AS IS», WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
AMD FidelityFX – набор инструментов для более реалистичной графики в комплексных видеоиграх
AMD FidelityFX – уникальный набор инструментов, который повышает качество графики в несколько раз. В него входит 7 инструментов, которые предназначены для разработчиков видеоигр и которые облегчают создание игровых шедевров. AMD FidelityFX оптимизирован для современных архитектур AMD RDNA и AMD RDNA 2. Использование FidelityFX позволяет получить максимально качественную картинку без значительных потерь производительности. Естественно, оценить преимущества технологий данного набора не выйдет без исходного инструмента – ПК. Это можно сделать, если купить компьютеры в Киеве по самым привлекательным ценам.

Набор инструментов AMD FidelityFX позволяет получить оптимально качественную графику. Специалисты AMD приложили максимум усилий во время его создания, он получился действительно полезным. Этот набор обеспечивает профессиональную поддержку для разработчиков видеоигр. На данный момент, в AMD FidelityFX входят: FidelityFX: Contrast Adaptive Sharpening, FidelityFX: Ambient Occlusion, FidelityFX: Variable Shading, FidelityFX: Screen Space Reflections, FidelityFX: Denoiser, FidelityFX: HDR Mapper, FidelityFX: Downsampler.
FidelityFX: Contrast Adaptive Sharpening (FidelityFX CAS) – технология, которая обеспечивает максимальную детализацию графики. Она устраняет потерю деталей после применения технологии TAA и при этом сохраняет максимальную четкость графики с минимальным количеством артефактов. Технология обладает уникальным концептом, который позволяет играть в видеоигры с наличием мельчайших деталей. Это особенно полезно и важно для мониторов с очень высоким разрешением дисплея (2K, 4K, 8K). Графика выглядит очень реалистично и насыщенно. Для игр с поддержкой FidelityFX CAS мы рекомендуем выключать функцию Radeon Image Sharpening иначе графика может стать слишком резкой.
FidelityFX: Ambient Occlusion – технология, которая обеспечивает оптимально реалистичную геометрию теней. Она была специально оптимизирована для инновационной архитектуры RDNA. Используя рассеянный свет, FidelityFX: Ambient Occlusion улучшает внешний вид предметов. Эта технология имеет очень большое значение для комплексных современных игр. Рассеянный свет падает на предметы более структурировано и реалистично, что позволяет отображать максимально реалистичные тени. Это улучшает общее восприятие графики во время игры.
FidelityFX: Variable Shading – технология, которая позволяет максимально эффективно осуществлять рендеринг. Она оптимизирована под архитектуру AMD RDNA 2, обрабатывает полутоны с переменной частотой затенения для анализа яркости и движения кадров. Таким образом, максимальная производительность достигается без потери качества графики. Она обладает колоссальной значимость во время разработки видеоигр. Движение кадров получается более плавными.
FidelityFX: Screen Space Reflections – технология, которая прорабатывает высококачественные отражения предметов. Она, как и другие технологии набора, оптимизирована под архитектуру RDNA. Построение теней и устранение шума позволяют создавать реалистичные отображения с минимальным влиянием на общую производительность. Наши специалисты оценили эффективность этой технологии.
FidelityFX: Denoiser – технология, которая повышает качество трассировки лучей и сложных эффектов. Технология осуществляет шумоподавление, что позволяет демонстрировать максимально качественную графику в реальном времени. Лучше всего работает на видеокартах AMD последней серии.
FidelityFX: HDR Mapper – технология, которая обеспечивает максимально качественную HDR графику. Она оптимизирована для использования с дисплеями с поддержкой AMD FreeSync Premium Pro. FidelityFX: HDR Mapper – идеальный HDR-преобразователь, который обеспечит вас максимально качественной картинкой.
FidelityFX: Downsampler – технология, которая осуществляет ускоренную генерацию MIP-текстур. Это однопроходной понижающий сэмплер (SPD), осуществляющий асинхронные вычисления для оптимизации производительности.
Команда AMD создала очень профессиональный и очень полезный набор инструментов для разработчиков. Он обеспечит индустрию видеоигр дальнейшим ростом. Качество видеоигр будет постоянно расти и одной из причин является именно этот уникальный набор инструментов. С ростом производительности продукции компании AMD, технологии для компьютерных систем становятся тоже более продвинутыми.
Набор инструментов AMD FidelityFX используется огромнім количеством разработчиков со всего мира – CAPCOM, UNITY, ACTIVISION, UBISOFT, SQUARE ENIX, GUERRILLA, а это значит, что видеоигры будут демонстрировать все более продвинутую графику и более комплексный геймплей.


.png)
.png)