Create an account

Enhanced Shaders and Color Grading for 1.5.1  

Upload: 17 May 2022, 07:31
Created by: LVutner, Meatchunk, Doenitz [X]
Uploaded by: Aqxaro
Version: 1.09
Enhanced Shaders and Color Grading for 1.5.1

Overhauls shaders for a more modern and customizable appearance without the need for ReShade. DX10+


This mod overhauls the lighting and post processing effects of the X-Ray engine for greater visual quality and easier customization. It implements modern graphics techniques and improves the overall handing of light and color within the engine.

Features:

  • Gamma correct lighting
  • Translucency effects on grass and trees
  • PBR style specular effects
  • ACES based color grading
  • Controllable with console commands
  • General fixes to prevent clipping and other visual flaws

It is separated into 2 parts, both of which can be installed individually however they must be installed in the numbered order to prevent conflicts.

Part 1 - Enhanced Shaders

Gamma correct lighting with PBR style specular and various fixes for more modern visuals. This also fixes problems within the shaders, enabling translucent lighting effects on foliage and improvements to tonemapping and bloom blending.

The specular roughness is customizable using the settings in pbr_settings.h

A non-PBR version is available if you do not like how the PBR specular looks. This features all of the gamma correction and fixes however it uses the original diffuse and specular effects to retain the original look of the game.

NOTE: There are currently problems with the DX9 version, DX11 is recommended.

Part 2 - Enhanced Color Grading

Customizable color grading based on the ACES standard, controllable with both in-engine console commands and simple shader modifications.

Use r__color_grading to color grade your image as shown in these examples:

Optional Parts

shader_param controls

Adds new effects and allows color grading to be controlled using the shader_param_ console commands. This gives you complete control over the color grading.

The new effects are contrast control and a channel mixer, these allow for more interesting color modifications.

For compatibility with Beef's Shader Based NVGs there is also a simple version included. This does not feature the channel mixer as those shader_param settings are used for his nightvision effects

The controls work as RGB + Offset, with the first 3 values controlling the red, green and blue channels and the 4th adding to the whole.

These are the default values of each command and the setting that it controls:

    • shader_param_1 1,1,1,0 - Slope
    • shader_param_2 0,0,0,0 - Offset
    • shader_param_3 1,1,1,0 - Power
    • shader_param_4 1,1,1,0 - Contrast
    • shader_param_5 1,0,0,0 - Red Channel Mixer
    • shader_param_6 0,1,0,0 - Green Channel Mixer
    • shader_param_7 0,0,1,0 - Blue Channel Mixer

NOTE: Saturation is done after power and before contrast.

There are config files included that can be loaded using the cfg_load console command as shown:

cfg_load grading_default

There are multiple preset config files for different styles.

  • grading_default - Default values
  • grading_vanilla - Reduced contrast to match the original tonemapping curve of X-ray
  • grading_warm - Orange tinted highlights for a warm atmosphere
  • grading_cold - Blue tined for a cold atmosphere
  • grading_vibrant - Preserves saturation in bright highlights
  • grading_hollywood - An orange and teal tint made with contrast and channel mixing
  • grading_filmic01 - Washed out highlights with green tinted mid tones
  • grading_filmic02 - Red tinted dark tones
  • grading_filmic03 - Dimmed and muddied hues

NOTE: The vibrant and filmic presets are not included with the simple version as they use the channel mixer.

I recommend that you find a preset that you enjoy, copy it and tweak it to your taste, either in game or with a text editor (you can reload your config to see any changes made after saving)

The screenshots below use Corrected Cubemaps and the weather from Aggressor Reshade with these settings:
r2_sun_lumscale 3.0
r2_sun_lumscale_hemi 1.0
r2_sun_lumscale_amb 0.5

r2_tonemap_middlegray is often tweaked for each shot.

Corrected Cubemaps

Cubemaps filtered for improved specular reflections and ambient lighting. This is compatible with both the PBR and non-PBR versions of Enhanced Shaders.

Anomaly's default cubemaps often do not match the color of the sky, this patch fixes this problem as well as providing higher quality reflections for PBR.

This might change the brightness of ambient lighting in some cases.

NOTE: This is will not work as intended with the default shaders.

Installation

  1. Put the gamedata folder from each part into your Anomaly directory, overwrite all when prompted
  2. Delete the shader cache using the launcher or delete the appdata/shaders_cache folder manually

Mod Organiser 2 is highly recommended to prevent problems with uninstalling this addon

Mod Organizer 2 : Stalker Anomaly Setup Guide

Setup

  1. Use these console commands to set everything to the intended default:
    • r__color_grading 0.5, 0.5, 0.5
    • r2_gloss_factor 0.001
    • r2_gloss_min 0.5
  2. Use r2_gloss_min to control the glossiness/roughness of the PBR specular
  3. Use the r2_tonemap_ console commands to set your camera exposure
  4. Use the r__color_grading and Basic Light Settings to color grade your image
  5. Tweak to your taste

NOTE: r2_gloss_min MUST be used to control the specular to prevent inconsistent specular highlights (r2_gloss_factor is affected light brightness).

NOTE: You may need to adjust your r2_sun_lumscale_ settings after installing this mod. The gamma correction causes lighting to blend differently and will cause the colors of the lighting to change.

Customization

Enhanced Shaders

pbr_settings.h contains settings for tweaking the PBR specular.

#define USE_PBR
enables/disables PBR specular, enabled by default. Disabling this will use the specular code to emulate the non-PBR specular behavior for improved fresnel highlights. Not as performance friendly as the proper non-PBR version.

#define USE_GGX_SPECULAR
enables/disables GGX specular, disabled by default. Enabling this will allow lights to use the prettier but more expensive GGX specular seen in most modern engines. This might make specular too prominent.

The settings below are used convert the glossmap and material ID into PBR specular and roughness values.
r2_gloss_min is used to tweak to the result in engine.

#define ALBEDO_AMOUNT 1.00
Controls the brightness of the diffuse texture.

#define ROUGHNESS_LOW 0.4
Controls the lowest value of the roughness. Decreasing this will make highlights shinier.

#define ROUGHNESS_HIGH 1.00
Controls the highest value of the roughness. Decreasing this will make everything shinier.

#define ROUGHNESS_POW 0.25
Controls the power curve of the glossmap. Decreasing this will make make the highlights stronger more pronounced.

#define SPECULAR_BASE 0.056
Controls the zero incidence specular value. Increasing this will boost the overall specular.

#define SPECULAR_RANGE 1
Controls the amount of influence of the glossmap and material ID on specular. Increasing this will make highlights from the glossmap more pronounced.

#define SPECULAR_POW 1
Controls the power curve of the specular. Increasing this will make the specular more contrasted.

NOTE: In PBR 'specular' refers to the amount of reflection while facing a surface directly.

Enhanced Color Grading

ACES_settings.h contains the variables for used color grading, by default they are set up to use the in-engine variables, however they can be set manually for greater control.

In log space colors can behave strangely, here's how the controls generally affect the color grading:

  • Slope - Tints the light tones
  • Offset - Tints the whole image
  • Power - Tints the dark tones

If you do not like the how color grading behaves in log space you can disable it to grade in linear, which most users will probably be more familiar with (it will behave the same as Lift Gamma Gain in ReShade).

ACES_LMT.h contains additional color effects that can be used together, by default a contrast reduction is enabled to match the original look of the game.

There are multiple #define directives used to control various features:

#define USE_ACES in ACES.h
enables/disables ACES, enabled by default. If disabled color grading will be done without any wide gamut color transforms. Disable this for performance.

#define USE_LOG_GRADING in ACES_settings.h
enables/disables ACEScc log space for color grading, enabled by default. If disabled color grading will be done in linear space.

Change log

1.09 - Detector Fix and Crash fix
Alpha channel of accum buffer now works as self illumination, fixing all artefact detectors
Missing files added
Simple shader_param control option added to prevent conflicts with Beef's Shader Based NVG

1.08 - Foliage fix and new color grading effects
Foliage SSS fixed
Grass material ID set to the foliage ID
Grass specular improved
Grass normals changed
Default pbr_settings values changed for greater reflectivity
Color grading moved to ACES_Color_Grading.h and treated as a LMT
Added contrast and channel mixer to shader_param controls
LMTs supported even with ACES disabled
LMT setup and usage changed
shader_param behaviour changed to RGB + Offset for easier adjustments
shader_param controls extended with new effects
New color grading preset cfg files to demonstrate color mixer and contrast effects
Old color grading presets adjusted for less extreme tinting
Updated ACES RRT with glow module and red modifier
Fixed the brightness of corrected cubemaps in shader (no longer need lumscale adjustment to match the original brightness)
Strict gamma correction option for sky blending removed, it caused problems with ambient lighting
USE_ACES_COLORSPACE removed since USE_ACES will serve the same purpose now

1.07 - Detector self illum fix
Artefact detector self illumination fixed
pbr_settings.h added for controllable specular
PBR cubemaps added for more accurate lighting
Fixed ambient cubemap projection
mirrored power added to tint negative ACEScc log values
Added example shader_param cfg files

1.06 - Now without PBR!
Non PBR version of Enhanced Shaders added
ACEScc black level fixed
Renamed Gamma to Power
Saturation changed to the official equation
shader_param_ support added

1.05 - Dark interiors and gamma correction fixed

1.04 - Exoskeleton fix 2

1.03 - Exoskeleton fix

1.02 - Gamma and Detector fix
Fixed Detector white screen
sRGB improved and optimized
Option for gamma correct sky blending added

1.01 - DX9 fix

1.0 - Release

Comments
The minimum comment length is 10 characters.