diff --git a/README.md b/README.md index f57b63c..683e0f0 100644 --- a/README.md +++ b/README.md @@ -1,100 +1,68 @@ # vkBasalt -vkBasalt is a Vulkan post processing layer to enhance the visual graphics of games. +vkBasalt is a Vulkan post-processing layer for improving the visuals of games. Expect bugs from it as it is one of my first projects. Use it at your own risk. -Currently, the build in effects are: +Currently, the built-in effects are: +- 3D color lookup table - 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. - -## 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: -- GCC >= 9 -- X11 development files -- glslang -- SPIR-V Headers -- Vulkan Headers - -### 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.** +- Fast Approximate Anti-Aliasing -In general, prefer using distro provided packages. +It is also possible to use ReShade FX shaders. +## Downloading +### [Debian](https://tracker.debian.org/pkg/vkbasalt) ``` -git clone https://github.com/DadSchoorse/vkBasalt.git -cd vkBasalt +sudo apt install vkbasalt ``` -#### 64bit - +### [Fedora](https://src.fedoraproject.org/rpms/vkBasalt) ``` -meson setup --buildtype=release --prefix=/usr builddir -ninja -C builddir install +sudo dnf install vkBasalt ``` -#### 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. +### [Void Linux](https://github.com/void-linux/void-packages/blob/master/srcpkgs/vkBasalt/template) ``` -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 +sudo xbps-install vkBasalt ``` -## Packaging status - -[Debian](https://tracker.debian.org/pkg/vkbasalt) `sudo apt install vkbasalt` - -[Fedora](https://src.fedoraproject.org/rpms/vkBasalt) `sudo dnf install vkBasalt` - -[Void Linux](https://github.com/void-linux/void-packages/blob/master/srcpkgs/vkBasalt/template) `sudo xbps-install vkBasalt` - ## Usage -Enable the layer with the environment variable. +You can enable the layer with an environment variable. + +### Lutris +Follow these steps with Lutris: +1. Right-click a game and click `Configure`. +2. Go to the `System options` tab and scroll down to `Environment variables`. +3. Click `Add` and add `ENABLE_VKBASALT` under `Key` and `1` under `Value`. ### Standard -When using the terminal or an application (.desktop) file, execute: +When using the terminal or an application (.desktop) file, run: ```ini 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: ```ini ENABLE_VKBASALT=1 %command% ``` -## Configure +## Settings +Settings, like the CAS sharpness amount, can be changed in the config file. -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`VKBASALT_CONFIG_FILE=/path/to/vkBasalt.conf` -* `vkBasalt.conf` in the working directory of the game +The config file will be searched for in the locations: * `$XDG_CONFIG_HOME/vkBasalt/vkBasalt.conf` or `~/.config/vkBasalt/vkBasalt.conf` if `XDG_CONFIG_HOME` is not set * `$XDG_DATA_HOME/vkBasalt/vkBasalt.conf` or `~/.local/share/vkBasalt/vkBasalt.conf` if `XDG_DATA_HOME` is not set * `/etc/vkBasalt.conf` * `/etc/vkBasalt/vkBasalt.conf` * `/usr/share/vkBasalt/vkBasalt.conf` +* A file set with the environment variable `VKBASALT_CONFIG_FILE=/path/to/vkBasalt.conf` +* `vkBasalt.conf` in the game's working directory -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](https://github.com/crosire/reshade-shaders), 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. +You can create a file named `vkBasalt.conf` in the game's working directory and change the values there if you want to make changes for only one game. +### ReShade FX shaders +You must set `reshadeTexturePath` and `reshadeIncludePath` to the matching directories from the repository to run ReShade FX shaders, like shaders from the [ReShade repository](https://github.com/crosire/reshade-shaders). You must set a custom effect name to the shader path then add that effect name to `effects` like every other effect to use a specific shader. ```ini effects = colorfulness:denoise @@ -104,35 +72,70 @@ reshadeTexturePath = /home/user/reshade-shaders/Textures reshadeIncludePath = /home/user/reshade-shaders/Shaders ``` -#### Ingame Input +### Ingame input +The [Home key](https://en.wikipedia.org/wiki/Home_key) can be used to toggle the applied effects. The key can also be changed in the config file. It will not work on pure Wayland as it is based on X11, but **should** not crash without X11. -The [HOME key](https://en.wikipedia.org/wiki/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` environment variable, like `VKBASALT_LOG_LEVEL=debug`. Valid values are: `trace, debug, info, warn, error, none`. +The logger outputs to stderr by default. A file as output location can be set with the `VKBASALT_LOG_FILE` environment variable, like `VKBASALT_LOG_FILE="vkBasalt.log"`. -#### Debug Output +## Building from source -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`. +### Dependencies +Before building, you will need: +- GCC ≥ 9 +- glslang +- SPIR-V headers +- Vulkan headers +- X11 development files -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"`. +### Building +These instructions use `--prefix=/usr`, that is not recommended in general as vkBasalt will be installed in directories that are meant for the package manager. An alternative is not setting the prefix, so it will be installed in `/usr/local`. But you must ensure the `ld` finds the library; /usr/local is probably not in the default path. +Prefer to use distro-provided packages in general. +``` +git clone https://github.com/DadSchoorse/vkBasalt.git +cd vkBasalt +``` + +#### 32-bit +Ensure the `PKG_CONFIG_PATH=/usr/lib32/pkgconfig` and `--libdir=lib32` are right for your distro and change them if needed. E.g., you must replace `lib32` by `lib/i386-linux-gnu` on Debian-based distros. +``` +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 +``` + +#### 64-bit +``` +meson setup --buildtype=release --prefix=/usr builddir +ninja -C builddir install +``` ## FAQ +### Why is it called vkBasalt? +It is a joke: Vulkan post-processing → after vulcan → basalt. -#### Why is it called vkBasalt? -It's a joke: vulkan post processing → after vulcan → basalt -#### Does vkBasalt work with dxvk and vkd3d? +### 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? + +### Will vkBasalt get me banned? +Maybe. It has not happened yet to my knowledge, but do not blame me if your frog dies. + +### Will there be an OpenGL version? +No. I do not know anything about OpenGL and I do not 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](https://github.com/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](https://github.com/DadSchoorse/vkBasalt/pull/46). One easy way so to simply edit the shader file. + +### So, is vkBasalt just a Linux port of ReShade? +Not really. The code was mostly written from scratch. vkBasalt directly uses ReShade source code for the shader compiler (thanks [@crosire](https://github.com/crosire)), but that is about it. + +### Does every ReShade shader work? +No. Depth buffer access is not ready yet, shaders that need many techniques do not work and there might still be issues with blending and stencil. + +### You said that "depth buffer access is not ready yet". What do you mean? +There is a WIP version you can enable with `depthCapture = on`. It will cause many issues especially on non-Nvidia hardware. Also, the chosen depth buffer is not always the one wanted. + +### Is there a way to change settings for ReShade shaders? +There is some support for it [#46](https://github.com/DadSchoorse/vkBasalt/pull/46). An easy way to do it is to simply edit the shader file. diff --git a/config/vkBasalt.conf b/config/vkBasalt.conf index 44fc231..46638ff 100644 --- a/config/vkBasalt.conf +++ b/config/vkBasalt.conf @@ -1,103 +1,58 @@ -#effects is a colon seperated list of effect to use -#e.g.: effects = fxaa:cas -#effects will be run in order from left to right -#one effect can be run multiple times e.g. smaa:smaa:cas -#cas - Contrast Adaptive Sharpening -#dls - Denoised Luma Sharpening -#fxaa - Fast Approximate Anti-Aliasing -#smaa - Enhanced Subpixel Morphological Antialiasing -#lut - Color LookUp Table +# (cas = contrast adaptive sharpening | dls = denoised luma sharpening | fxaa = fast approximate anti-aliasing | lut = color lookup table | smaa = enhanced subpixel morphological antialiasing) Sets the effects that are run, that are colon-separated, can run many times and run from left to right, e.g.: smaa:smaa:cas. effects = cas +# Sets ReShade's used file path. reshadeTexturePath = "/path/to/reshade-shaders/Textures" reshadeIncludePath = "/path/to/reshade-shaders/Shaders" depthCapture = off -#toggleKey toggles the effects on/off +# Sets a hotkey to toggle the effects. toggleKey = Home -#enableOnLaunch sets if the effects are enabled when started +# (false, true) Sets the effects to be enabled on startup. enableOnLaunch = True -#casSharpness specifies the amount of sharpning in the CAS shader. -#0.0 less sharp, less artefacts, but not off -#1.0 maximum sharp more artefacts -#Everything in between is possible -#negative values sharpen even less, up to -1.0 make a visible difference +# (0.4; -1.0-1.0) Sets CAS's sharpening amount. Higher values make the image sharper, whereas values lower than 0 make the image softer than native. casSharpness = 0.4 -#dlsSharpness specifies the amount of sharpening in the Denoised Luma Sharpening shader. -#Increase to sharpen details within the image. -#0.0 less sharp, less artefacts, but not off -#1.0 maximum sharp more artefacts +# (0.5; 0.0-1.0) Sets DLS's sharpening amount. Higher values make the image sharper. dlsSharpness = 0.5 -#dlsDenoise specifies the amount of denoising in the Denoised Luma Sharpening shader. -#Increase to limit how intensely film grain within the image gets sharpened. -#0.0 min -#1.0 max +# (0.17; 0.0-1.0) Sets DLS's denoising amount. Higher values make the image softer. dlsDenoise = 0.17 -#fxaaQualitySubpix can effect sharpness. -#1.00 - upper limit (softer) -#0.75 - default amount of filtering -#0.50 - lower limit (sharper, less sub-pixel aliasing removal) -#0.25 - almost off -#0.00 - completely off +# (0.75; 0.0-1.0) Sets FXAA's level of aliasing at the subpixel level. Higher values make the image softer. +# 0.0 disables it. 0.25 is a high level of aliasing. 0.5 is a medium level of aliasing. 0.75 is a low level of aliasing and recommended. 1.0 is a very low level of aliasing. fxaaQualitySubpix = 0.75 -#fxaaQualityEdgeThreshold is the minimum amount of local contrast required to apply algorithm. -#0.333 - too little (faster) -#0.250 - low quality -#0.166 - default -#0.125 - high quality -#0.063 - overkill (slower) +# (0.125; 0.0-1.0) Sets FXAA's minimum amount of contrast needed to apply it. Higher values make the image have more contrast. +# 0.333 is a very high amount. 0.25 is a high amount. 0.166 is a medium amount. 0.125 is a low amount and enough. 0.063 is a very low amount. fxaaQualityEdgeThreshold = 0.125 -#fxaaQualityEdgeThresholdMin trims the algorithm from processing darks. -#0.0833 - upper limit (default, the start of visible unfiltered edges) -#0.0625 - high quality (faster) -#0.0312 - visible limit (slower) -#Special notes: due to the current implementation you -#Likely want to set this to zero. -#As colors that are mostly not-green -#will appear very dark in the green channel! -#Tune by looking at mostly non-green content, -#then start at zero and increase until aliasing is a problem. +# (0.0312; 0.0-0.1) Sets FXAA's minimum value of dark pixels to be ignored. Higher values make FXAA ignore pixels below the value set and may improve the performance. +# 0.0833 is a medium value. 0.0625 is a low value. 0.0312 is a very low value and the visible limit. +# Note: You should put 0 due to the current implementation, because non-green colors will be too dark in the green channel. Tune it by looking at mostly non-green content, then increase it from zero until aliasing is an issue. fxaaQualityEdgeThresholdMin = 0.0312 -#smaaEdgeDetection changes the edge detection shader -#luma - default -#color - might catch more edges, but is more expensive +# (luma; luma, color) Sets SMAA's edge detection shader. Luma detects edges from a monochrome perspective, whereas Color detects edges based on color. +# Luma is good enough. Color is heavier, but may detect more edges. smaaEdgeDetection = luma -#smaaThreshold specifies the threshold or sensitivity to edges -#Lowering this value you will be able to detect more edges at the expense of performance. -#Range: [0, 0.5] -#0.1 is a reasonable value, and allows to catch most visible edges. -#0.05 is a rather overkill value, that allows to catch 'em all. +# (0.05; 0-0.5) Sets SMAA's edge detection sensitivity. Lower values detect more edges at the expense of performance. +# 0.1 is enough. 0.05 detects all edges. smaaThreshold = 0.05 -#smaaMaxSearchSteps specifies the maximum steps performed in the horizontal/vertical pattern searches -#Range: [0, 112] -#4 - low -#8 - medium -#16 - high -#32 - ultra +# (32; 0-112) Sets how many horizontal and vertical search steps are performed in the search for edges. +# 4 is a low quality. 8 is a medium quality. 16 is a high quality. 32 is an ultra quality. smaaMaxSearchSteps = 32 -#smaaMaxSearchStepsDiag specifies the maximum steps performed in the diagonal pattern searches -#Range: [0, 20] -#0 - low, medium -#8 - high -#16 - ultra +# (16; 0-20) Sets how many diagonal search steps are performed in the search for edges. +# 0 is a medium quality. 8 is a high quality. 16 is an ultra quality. smaaMaxSearchStepsDiag = 16 -#smaaCornerRounding specifies how much sharp corners will be rounded -#Range: [0, 100] -#25 is a reasonable value +# (25; 0-100) Sets the strength of rounding edge corners. +# 25 is a good value. smaaCornerRounding = 25 -#lutFile is the path to the LUT file that will be used -#supported are .CUBE files and .png with width == height * height +# Sets LUT's used file path. .CUBE and .png files with width == height * height are supported. lutFile = "/path/to/lut"