vkBasalt is a Vulkan post processing layer to enhance the visual graphics of games.
Currently, the build in effects are:
- Contrast Adaptive Sharpening
- Denoised Luma Sharpening
- Fast Approximate Anti-Aliasing
- Enhanced Subpixel Morphological Anti-Aliasing
- 3D color LookUp Table
It is also possible to use ReShade FX shaders.
So far:
- unbundled
stb
headers, use system package - unbundeled
ReShade FX
, bumped to most recent version, use system package - migrated to
vkroots
, use system package - split in 3 parts, removed
depthCapture
option from config, config initialized only once VULKANFX_CONFIG
environment variable
Expect it to have bugs. Use it at your own risk.
Before building, you will need:
-
GCC >= 9
-
x11-libs/libX11
-
dev-util/glslang
-
dev-util/spirv-headers
-
dev-util/vulkan-headers
-
dev-libs/stb
-
media-libs/vkroots
-
dev-util/vma (Vulkan Memory Allocator)
-
>=dev-util/reshade-fx-6.4.1 (Parser/Codegen for the ReShade FX shader language)
-
(optional) dev-util/reshade-fxc (ReShade FX shader compiler)
In my gentoo overlay it also contain patch to generate config from ReShade FX shader.e.g. `$ reshade-fx2conf Daltonize.fx`
# Daltonize.fx # type: combo # items: Protanopia # Deuteranopia # Tritanopia # #Type = 0 # Directives #RESHADE_DEPTH_INPUT_X_OFFSET=0 #RESHADE_DEPTH_INPUT_Y_PIXEL_OFFSET=0 #RESHADE_DEPTH_INPUT_X_PIXEL_OFFSET=0 #RESHADE_DEPTH_INPUT_Y_OFFSET=0 #RESHADE_DEPTH_INPUT_Y_SCALE=1 #RESHADE_DEPTH_INPUT_X_SCALE=1 #RESHADE_DEPTH_LINEARIZATION_FAR_PLANE=1000.0 #RESHADE_DEPTH_INPUT_IS_LOGARITHMIC=0 #RESHADE_DEPTH_INPUT_IS_MIRRORED=0 #RESHADE_DEPTH_INPUT_IS_REVERSED=1 #RESHADE_DEPTH_MULTIPLIER=1 #RESHADE_DEPTH_INPUT_IS_UPSIDE_DOWN=0
Prepare overlay
emerge app-eselect/eselect-repository -vp
eselect repository add vulkanfx git https://github.com/pchome/VulkanFX-gentoo-overlay.git
emaint sync -r vulkanfx
emerge media-gfx/VulkanFX -q
nano /etc/portage/package.use/multilib
media-gfx/VulkanFX abi_x86_32
dev-util/reshade-fx abi_x86_32
dev-util/reshade-fxc abi_x86_32
# on/off hotkey
x11-libs/libX11 abi_x86_32
# required by x11-libs/libX11-1.8.11::gentoo
# required by media-gfx/VulkanFX-9999::vulkanfx[xlib]
# required by media-gfx/VulkanFX (argument)
>=x11-libs/libxcb-1.17.0 abi_x86_32
# required by x11-libs/libxcb-1.17.0::gentoo
# required by x11-libs/libX11-1.8.11::gentoo
# required by media-gfx/VulkanFX-9999::vulkanfx[xlib]
# required by media-gfx/VulkanFX (argument)
>=x11-libs/libXau-1.0.12 abi_x86_32
# required by x11-libs/libxcb-1.17.0::gentoo
# required by x11-libs/libX11-1.8.11::gentoo
# required by media-gfx/VulkanFX-9999::vulkanfx[xlib]
# required by media-gfx/VulkanFX (argument)
>=x11-libs/libXdmcp-1.1.5 abi_x86_32
emerge media-gfx/VulkanFX -q
You can try to follow pchome/gentoo-dev-playground instructions and then return to gentoo route.
Enable the layer with the environment variable.
Implicit vulkan layers will be loaded automatically when corresponding environment variable was provided. Use one of:
ENABLE_VULKANFX=1
- default: depth capture disabledENABLE_VULKANFX=depth
- depth: depth capture enabledENABLE_VULKANFX=simple
- simple: depth capture and ReShade FX disabled
$ git clone https://github.com/crosire/reshade-shaders /tmp/fxs
$ ENABLE_VULKANFX=1 VULKANFX_CONFIG='effects=fxaa:cas:dlt;casSharpness=1.0;dlt=/tmp/fxs/Shaders/Daltonize.fx;reshadeTexturePath=/tmp/fxs/Textures;reshadeIncludePath=/tmp/fxs/Shaders' vkgears
VulkanFX info: no good config file
VulkanFX info: config string: effects=fxaa:cas:dlt;casSharpness=1.0;dlt=/tmp/fxs/Shaders/Daltonize.fx;reshadeTexturePath=/tmp/fxs/Textures;reshadeIncludePath=/tmp/fxs/Shaders
VulkanFX info: effects = fxaa:cas:dlt
VulkanFX info: casSharpness = 1.0
VulkanFX info: dlt = /tmp/fxs/Shaders/Daltonize.fx
VulkanFX info: reshadeTexturePath = /tmp/fxs/Textures
VulkanFX info: reshadeIncludePath = /tmp/fxs/Shaders
304 frames in 5.0 seconds = 60.779 FPS
301 frames in 5.0 seconds = 60.002 FPS
300 frames in 5.0 seconds = 59.999 FPS
...
If built in e.g. gentoo environment and copied to different os / location
#!/bin/sh
export VK_IMPLICIT_LAYER_PATH="share/vulkan/implicit_layer.d"
export LD_LIBRARY_PATH="lib64:lib:${LD_LIBRARY_PATH}"
export ENABLE_VULKANFX=1
export VULKANFX_CONFIG="effects=fxaa:cas"
#export VULKANFX_LOG_LEVEL=debug
#export VK_LOADER_DEBUG=layer
vkgears
where curren directory contain lib lib64 run.sh share
Settings like the CAS sharpening strength can be changed in the config file. The config file will be searched for in the following locations:
- a file set with the environment variable
VULKANFX_CONFIG_FILE=/path/to/VulkanFX.conf
VulkanFX.conf
in the working directory of the game$XDG_CONFIG_HOME/VulkanFX/VulkanFX.conf
or~/.config/VulkanFX/VulkanFX.conf
ifXDG_CONFIG_HOME
is not set$XDG_DATA_HOME/VulkanFX/VulkanFX.conf
or~/.local/share/VulkanFX/VulkanFX.conf
ifXDG_DATA_HOME
is not set/etc/VulkanFX.conf
/etc/VulkanFX/VulkanFX.conf
/usr/share/VulkanFX/VulkanFX.conf
If you want to make changes for one game only, you can create a file named VulkanFX.conf
in the working directory of the game and change the values there.
To override some of the default config options the VULKANFX_CONFIG
env var can be used, e.g. VULKANFX_CONFIG='effects=fxaa:cas;casSharpness=1.0'
.
The separator is ;
To run reshade fx shaders e.g. shaders from the reshade repo, you have to set reshadeTexturePath
and reshadeIncludePath
to the matching dirctories from the repo. To then use a specific shader you need to set a custom effect name to the shader path and then add that effect name to effects
like every other effect.
effects = colorfulness:denoise
colorfulness = /home/user/reshade-shaders/Shaders/Colourfulness.fx
denoise = /home/user/reshade-shaders/Shaders/Denoise.fx
reshadeTexturePath = /home/user/reshade-shaders/Textures
reshadeIncludePath = /home/user/reshade-shaders/Shaders
The HOME key can be used to disable and re-enable the applied effects, the key can also be changed in the config file. This is based on X11 so it won't work on pure wayland. It should however at least not crash without X11.
The amount of debug output can be set with the VULKANFX_LOG_LEVEL
env var, e.g. VULKANFX_LOG_LEVEL=debug
. Possible values are: trace, debug, info, warn, error, none
.
By default the logger outputs to stderr, a file as output location can be set with the VULKANFX_LOG_FILE
env var, e.g. VULKANFX_LOG_FILE="VulkanFX.log"
.
It's a joke: vulkan post processing → after vulcan → basalt
Yes.
Maybe. To my knowledge this hasn't happened yet but don't blame me if your frog dies.
No. I don't know anything about openGl and I don't want to either. Also openGl has no layer system like vulkan.
Maybe, but not soon.
Not really, most of the code was written from scratch. vkBasalt directly uses reshade source code for the shader compiler (thanks @crosire), but that's about it.
No. Shaders that need multiple techniques do not work, there might still be problems with stencil and blending and depth buffer access isn't ready yet.
There is a wip version that you can enable with depthCapture = on
. It will lead to many problems especially on non nvidia hardware. Also the selected depth buffer isn't always the one you would want.
There is some support for it #46. One easy way so to simply edit the shader file.