DadSchoorse / vkBasalt

a vulkan post processing layer for linux
zlib License
1.25k stars 52 forks source link
cplusplus glsl vulkan

vkBasalt

vkBasalt is a Vulkan post processing layer to enhance the visual graphics of games.

Currently, the build in effects are:

It is also possible to use Reshade Fx shaders.

Disclaimer

This is one of my first projects ever, so expect it to have bugs. Use it at your own risk.

Building from Source

Dependencies

Before building, you will need:

Building

These instructions use --prefix=/usr, which is generally not recommened since vkBasalt will be installed in directories that are meant for the package manager. The alternative is not setting the prefix, it will then be installed in /usr/local. But you need to make sure that ld finds the library since /usr/local is very likely not in the default path.

In general, prefer using distro provided packages.

git clone https://github.com/DadSchoorse/vkBasalt.git
cd vkBasalt

64bit

meson setup --buildtype=release --prefix=/usr builddir
ninja -C builddir install

32bit

Make sure that PKG_CONFIG_PATH=/usr/lib32/pkgconfig and --libdir=lib32 are correct for your distro and change them if needed. On Debian based distros you need to replace lib32 with lib/i386-linux-gnu, for example.

ASFLAGS=--32 CFLAGS=-m32 CXXFLAGS=-m32 PKG_CONFIG_PATH=/usr/lib32/pkgconfig meson setup --prefix=/usr --buildtype=release --libdir=lib32 -Dwith_json=false builddir.32
ninja -C builddir.32 install

Packaging status

Debian sudo apt install vkbasalt

Fedora sudo dnf install vkBasalt

Void Linux sudo xbps-install vkBasalt

Usage

Enable the layer with the environment variable.

Standard

When using the terminal or an application (.desktop) file, execute:

ENABLE_VKBASALT=1 yourgame

Lutris

With Lutris, follow these steps below:

  1. Right click on a game, and press configure.
  2. Go to the System options tab and scroll down to Environment variables.
  3. Press on Add, and add ENABLE_VKBASALT under Key, and add 1 under Value.

Steam

With Steam, edit your launch options and add:

ENABLE_VKBASALT=1 %command% 

Configure

Settings like the CAS sharpening strength can be changed in the config file. The config file will be searched for in the following locations:

If you want to make changes for one game only, you can create a file named vkBasalt.conf in the working directory of the game and change the values there.

Reshade Fx shaders

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

Ingame Input

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.

Debug Output

The amount of debug output can be set with the VKBASALT_LOG_LEVEL env var, e.g. VKBASALT_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 VKBASALT_LOG_FILE env var, e.g. VKBASALT_LOG_FILE="vkBasalt.log".

FAQ

Why is it called vkBasalt?

It's a joke: vulkan post processing → after vulcan → basalt

Does vkBasalt work with dxvk and vkd3d?

Yes.

Will vkBasalt get me banned?

Maybe. To my knowledge this hasn't happened yet but don't blame me if your frog dies.

Will there be a openGl version?

No. I don't know anything about openGl and I don't want to either. Also openGl has no layer system like vulkan.

Will there be a GUI in the future?

Maybe, but not soon.

So is vkBasalt just a reshade port for linux?

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.

Does every reshade shader work?

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.

You said that "depth buffer access isn't ready yet", what does this mean?

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.

Is there a way to change settings for reshade shaders?

There is some support for it #46. One easy way so to simply edit the shader file.