CasCmdLine is a simple, command-line Windows® program included in the AMD FidelityFX CAS repository in binary and source form. It lets you test the effect on image files such as screenshots from your game.
The usage is very simple. If you have a screenshot from your game saved as an image file (PNG, JPG, or BMP) just open Windows® Terminal (Command Prompt). Then launch the program with parameters specifying the name of the source file to read and the target file to write, for example:
CasCmdLine.exe MyGame-01.png MyGame-01_CAS.png
Then you will be able to see how our Contrast Adaptive Sharpening algorithm would affect your game by comparing the two images.
AMD FidelityFX CAS can not only do sharpening, but also optionally upscale the resolution in a single pass. You can test this feature by specifying additional options at the beginning of the command line.
For example, if your source image is 1920 x 1080, you can see how upscaling to 2560 x 1440 with sharpening would look like by issuing a command:
CasCmdLine.exe -Scale 2560 1440 MyGame-01.png MyGame-01_ScaledCAS.png
If you want to compare the result with a simpler upscaling algorithm and see how much difference AMD FidelityFX CAS introduces, use an additional parameter
-Mode to choose a different algorithm.
NearestNeighbor– your result will then look pixelated.
Linear– to use linear interpolation – your result will look blurry.
CasCmdLine.exe -Scale 2560 1440 -Mode Linear MyGame-01.png MyGame-01_ScaledLinear.png
The CAS algorithm also lets you control the level of sharpness, in the range
does not mean there’s no sharpening, but rather it’s the default. You can request extra sharpness by increasing this parameter. Use command line argument
-Sharpness to specify it.
CasCmdLine.exe -Sharpness 0.7 MyGame-01.png MyGame-01_CAS.png
The tool offers additional features for advanced users. It performs gamma correction by default – assumes the image is saved with sRGB gamma encoding, converts the pixels to linear space while AMD FidelityFX CAS is being applied, and then back to sRGB before saving.
If you want to work on a dump of some intermediate texture from inside of your engine which is stored in linear space, use parameter
-Linear to disable the gamma correction.
You can also increase the precision of processing by specifying
-FP16 parameter. The program will then use
R16G16B16A16_FLOAT texture format. By default, it is
Using such high precision requires an appropriate file format. CasCmdLine supports also DDS files, which can store textures in high precision.
Full documentation of the command line syntax can be seen by launching the program without any parameters.
The tool is open source, based on the MIT license. The source is a short Microsoft® Visual Studio project written in C++ that uses Windows® Imaging Component (WIC) to load and save images and initializes Direct3D® 11 (without any window or swapchain) to launch AMD FidelityFX CAS. It may also serve as an example of AMD FidelityFX CAS integration.