Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
223 commits
Select commit Hold shift + click to select a range
a378b5b
working
davo0411 Jan 10, 2026
d15f95d
fixes
davo0411 Jan 10, 2026
caf60d0
feat: remove tonemappers, upgrade entire pipeline to HDR
davo0411 Jan 11, 2026
737228b
fixes
davo0411 Jan 11, 2026
db3e990
feat: readd bloom
davo0411 Jan 11, 2026
d2301ef
feat: vanilla eye adapt
davo0411 Jan 11, 2026
05dbb77
feat: color correction
davo0411 Jan 11, 2026
29d8380
feat: HDR dynamic cubemaps
davo0411 Jan 11, 2026
14e9428
feat: works lol
davo0411 Jan 11, 2026
1186038
WORKING
davo0411 Jan 11, 2026
0121fc6
working
davo0411 Jan 11, 2026
3aa06fb
removed unnecessary
davo0411 Jan 11, 2026
ed67fdd
more removed
davo0411 Jan 11, 2026
ab80695
update (#29)
davo0411 Jan 11, 2026
c158e48
Merge branch 'hdr-output' of https://github.com/davo0411/skyrim-commu…
davo0411 Jan 11, 2026
528a435
fixes, removed more unnecessary
davo0411 Jan 11, 2026
016cf68
Update Color.hlsli
davo0411 Jan 11, 2026
eb0d42f
changed process
davo0411 Jan 11, 2026
c32013c
Merge branch 'dev' into hdr-output
davo0411 Jan 11, 2026
6d4ba43
style: 🎨 apply pre-commit.ci formatting
pre-commit-ci[bot] Jan 11, 2026
4d648f8
separate UI working
davo0411 Jan 12, 2026
9f2a533
finally everything working together
davo0411 Jan 12, 2026
378ec3b
style: 🎨 apply pre-commit.ci formatting
pre-commit-ci[bot] Jan 12, 2026
d21a7bf
FG and non-fg working!
davo0411 Jan 12, 2026
228c03a
bajillion fixes
davo0411 Jan 12, 2026
e3fa950
Merge branch 'hdr-output' of https://github.com/davo0411/skyrim-commu…
davo0411 Jan 12, 2026
c7b7aa0
Update HDR.h
davo0411 Jan 12, 2026
29cf7fb
style: 🎨 apply pre-commit.ci formatting
pre-commit-ci[bot] Jan 12, 2026
bbd3f6b
fixes
davo0411 Jan 12, 2026
472947c
Merge branch 'hdr-output' of https://github.com/davo0411/skyrim-commu…
davo0411 Jan 12, 2026
ae91241
Update HDRDisplay.h
davo0411 Jan 12, 2026
8dc2aa5
style: 🎨 apply pre-commit.ci formatting
pre-commit-ci[bot] Jan 12, 2026
578eaf0
cleaner menu
davo0411 Jan 12, 2026
7d9cdc0
Merge branch 'hdr-output' of https://github.com/davo0411/skyrim-commu…
davo0411 Jan 12, 2026
2f3c3fb
style: 🎨 apply pre-commit.ci formatting
pre-commit-ci[bot] Jan 12, 2026
07744cc
ctd fix
davo0411 Jan 12, 2026
eb0820d
Merge branch 'doodlum:dev' into hdr-output
davo0411 Jan 13, 2026
6bda853
fixes
davo0411 Jan 14, 2026
1b51024
bajillion fixes
davo0411 Jan 31, 2026
6033647
fixed tonemapping
davo0411 Jan 31, 2026
2d09488
FG fixed.
davo0411 Feb 1, 2026
3668245
real this time
davo0411 Feb 1, 2026
578f0e4
fg ui properly fixed
davo0411 Feb 2, 2026
1e0984f
Fixed UI alpha
davo0411 Feb 2, 2026
374e244
ll fixes
davo0411 Feb 2, 2026
9a824e4
new metadata
davo0411 Feb 2, 2026
5c29216
fixes
davo0411 Feb 2, 2026
6349be4
Fixed hdr outputting
davo0411 Feb 2, 2026
79ee285
Delete reinhard.hlsl
davo0411 Feb 2, 2026
9a59bc7
Merge branch 'dev' into hdr-output
davo0411 Feb 2, 2026
d96759d
style: 🎨 apply pre-commit.ci formatting
pre-commit-ci[bot] Feb 2, 2026
ba82b41
feat: enable HDR warning, auto enable
davo0411 Feb 2, 2026
14ee19a
Merge branch 'hdr-output' of https://github.com/davo0411/skyrim-commu…
davo0411 Feb 2, 2026
8740855
style: 🎨 apply pre-commit.ci formatting
pre-commit-ci[bot] Feb 2, 2026
f7841f0
fixes, final test
davo0411 Feb 4, 2026
5f72b4f
style: 🎨 apply pre-commit.ci formatting
pre-commit-ci[bot] Feb 4, 2026
5fc846b
flicker fix attempt again
davo0411 Feb 6, 2026
b95419d
New display mapping DICE, fixed UI flicker
davo0411 Feb 6, 2026
82736a2
Merge branch 'hdr-output' of https://github.com/davo0411/skyrim-commu…
davo0411 Feb 6, 2026
2f6c2d3
fixes, upgraded buffers, etc
davo0411 Feb 6, 2026
9701cde
Merge branch 'dev' into hdr-output
davo0411 Feb 8, 2026
8f7d8d3
style: 🎨 apply pre-commit.ci formatting
pre-commit-ci[bot] Feb 8, 2026
5f35e1a
tonemapping changes, ui changes
davo0411 Feb 8, 2026
c389a2e
Merge branch 'hdr-output' of https://github.com/davo0411/skyrim-commu…
davo0411 Feb 8, 2026
d375dcb
style: 🎨 apply pre-commit.ci formatting
pre-commit-ci[bot] Feb 8, 2026
93e9c1c
working again
davo0411 Feb 9, 2026
454e297
removed dice
davo0411 Feb 9, 2026
05d2a88
a lot of tweaks
davo0411 Feb 9, 2026
377e9ab
unclamped paperwhite
davo0411 Feb 9, 2026
f9f862c
bloom clamp, peaknit fix
davo0411 Feb 9, 2026
020aa2d
Update ISHDR.hlsl
davo0411 Feb 9, 2026
f48fa06
Merge branch 'hdr-output' of https://github.com/davo0411/skyrim-commu…
davo0411 Feb 9, 2026
63e9a80
style: 🎨 apply pre-commit.ci formatting
pre-commit-ci[bot] Feb 9, 2026
12195cb
information update
davo0411 Feb 10, 2026
bcc6dec
linear contrast fix
davo0411 Feb 10, 2026
695165d
reordered
davo0411 Feb 10, 2026
3db3e3c
Update HDRDisplay.h
davo0411 Feb 10, 2026
185dd79
fixed my broken fg
davo0411 Feb 11, 2026
ccfd61b
looking good. everything working.
davo0411 Feb 11, 2026
9f1bb19
LL fix up
davo0411 Feb 11, 2026
5cd5e1e
color grading fixes
davo0411 Feb 11, 2026
63f3878
math and comment clean
davo0411 Feb 11, 2026
2dea270
rabbit fixes 1
davo0411 Feb 11, 2026
b062ad3
Update Lighting.hlsl
davo0411 Feb 11, 2026
fd623b8
rabbit cpp 1
davo0411 Feb 11, 2026
7798095
mutex lock suggested by rabbit. nuked sdr brightness ui slider
davo0411 Feb 11, 2026
5e1d187
bajillion rabbit crap
davo0411 Feb 11, 2026
19998bd
misc fixes
davo0411 Feb 11, 2026
d838f46
Update HDROutputCS.hlsl
davo0411 Feb 11, 2026
5fc49cd
Update UIBrightnessCS.hlsl
davo0411 Feb 11, 2026
3046dc2
Merge branch 'dev' into hdr-output
davo0411 Feb 12, 2026
0967a16
style: 🎨 apply pre-commit.ci formatting
pre-commit-ci[bot] Feb 12, 2026
c2f5087
Merge branch 'dev' into hdr-output
davo0411 Feb 13, 2026
46cac80
style: 🎨 apply pre-commit.ci formatting
pre-commit-ci[bot] Feb 13, 2026
8ba051a
Update HDR.cpp
davo0411 Feb 13, 2026
5fca3da
cleanup comments / code, fix non-fg case
davo0411 Feb 13, 2026
6947f2c
background blur fix for hdr
davo0411 Feb 13, 2026
b9a8c18
more alpha fixes, background blur fix
davo0411 Feb 13, 2026
2f60b6c
Update Deferred.cpp
davo0411 Feb 14, 2026
db85084
doodlum comment 1
davo0411 Feb 14, 2026
a7728bc
Merge branch 'dev' into hdr-output
davo0411 Feb 14, 2026
5a9cd92
fix: conditional HDR upgrade for swapchain
davo0411 Feb 14, 2026
5e7009f
Merge branch 'hdr-output' of https://github.com/davo0411/skyrim-commu…
davo0411 Feb 14, 2026
588f360
Update DynamicCubemaps.cpp
davo0411 Feb 14, 2026
9d396bc
refactored setuibuffer
davo0411 Feb 14, 2026
f798bd4
Update Upscaling.cpp
davo0411 Feb 14, 2026
6395f0b
parameter cleanup
davo0411 Feb 15, 2026
c8adc0d
ini instead of hook for 64 bit
davo0411 Feb 15, 2026
0c3404a
style: 🎨 apply pre-commit.ci formatting
pre-commit-ci[bot] Feb 15, 2026
ef7fa09
cleanup
davo0411 Feb 15, 2026
71db4d6
Merge branch 'hdr-output' of https://github.com/davo0411/skyrim-commu…
davo0411 Feb 15, 2026
e973b21
force off with TAA
davo0411 Feb 15, 2026
a02bdfa
Merge branch 'doodlum:dev' into hdr-output
davo0411 Feb 15, 2026
5baefe0
Update HDR.cpp
davo0411 Feb 20, 2026
11e9ed9
TAA Fix comprehensive
davo0411 Feb 20, 2026
97476ad
style: 🎨 apply pre-commit.ci formatting
pre-commit-ci[bot] Feb 20, 2026
7b4612d
loading screen fix yiupppeeee
davo0411 Feb 20, 2026
36a9791
Merge branch 'hdr-output' of https://github.com/davo0411/skyrim-commu…
davo0411 Feb 20, 2026
e2b3f58
style: 🎨 apply pre-commit.ci formatting
pre-commit-ci[bot] Feb 20, 2026
5f4f3ec
Update ISHDR.hlsl
davo0411 Feb 20, 2026
d1810b8
Merge branch 'hdr-output' of https://github.com/davo0411/skyrim-commu…
davo0411 Feb 20, 2026
7e5f9b1
hdr rewrite into hdrdisplay, hook cleanup
davo0411 Mar 2, 2026
1ec7ecc
more fixes
davo0411 Mar 2, 2026
83d38e8
ui blend fix
davo0411 Mar 2, 2026
37c87b7
style: 🎨 apply pre-commit.ci formatting
pre-commit-ci[bot] Mar 2, 2026
6cbaa84
Merge branch 'dev' into hdr-output
davo0411 Mar 2, 2026
69a4b06
Update ISHDR.hlsl
davo0411 Mar 2, 2026
43d807a
fix
davo0411 Mar 2, 2026
f3d0b78
Update ISHDR.hlsl
davo0411 Mar 4, 2026
31f7972
Update ISHDR.hlsl
davo0411 Mar 4, 2026
c9ab362
Update ISHDR.hlsl
davo0411 Mar 4, 2026
b83ac14
Fix: UI elements not rendering correctly
davo0411 Mar 4, 2026
c3fc49b
Merge branch 'dev' into hdr-output
davo0411 Mar 4, 2026
f3112c0
bloom fix
davo0411 Mar 5, 2026
fa0eaec
Update ISHDR.hlsl
davo0411 Mar 5, 2026
8c7a801
fixes
davo0411 Mar 5, 2026
c1ffe85
1
davo0411 Mar 7, 2026
1074d86
2
davo0411 Mar 7, 2026
704b4ee
3
davo0411 Mar 7, 2026
fed1193
style: 🎨 apply pre-commit.ci formatting
pre-commit-ci[bot] Mar 7, 2026
7da31c2
Update ISHDR.hlsl
davo0411 Mar 7, 2026
8a6fd8f
Merge branch 'hdr-output' of https://github.com/davo0411/skyrim-commu…
davo0411 Mar 7, 2026
fc9fbee
HDR SUN
davo0411 Mar 8, 2026
29a201e
UI brightness fix
davo0411 Mar 8, 2026
3453e49
style: 🎨 apply pre-commit.ci formatting
pre-commit-ci[bot] Mar 8, 2026
99d658d
Merge branch 'dev' into hdr-output
davo0411 Mar 8, 2026
0afbf5a
tonemapping changes
davo0411 Mar 10, 2026
0a45d75
tonemapping changes 2
davo0411 Mar 10, 2026
b1709f4
main menu brightness fix
davo0411 Mar 10, 2026
6d9fcb0
Update ISHDR.hlsl
davo0411 Mar 10, 2026
e7b69a5
Update Sky.hlsl
davo0411 Mar 10, 2026
2d91811
Update Sky.hlsl
davo0411 Mar 10, 2026
cbe8698
Update ISHDR.hlsl
davo0411 Mar 10, 2026
2692193
style: 🎨 apply pre-commit.ci formatting
pre-commit-ci[bot] Mar 10, 2026
a1b1490
Update Sky.hlsl
davo0411 Mar 10, 2026
5aa7d8a
Merge branch 'hdr-output' of https://github.com/davo0411/skyrim-commu…
davo0411 Mar 10, 2026
c46b095
style: 🎨 apply pre-commit.ci formatting
pre-commit-ci[bot] Mar 10, 2026
196718d
proc sun v1
davo0411 Mar 12, 2026
080a17e
fix dev
davo0411 Mar 12, 2026
e6f16d9
Update Sky.hlsl
davo0411 Mar 12, 2026
42a13a3
Update Sky.hlsl
davo0411 Mar 14, 2026
0cdce8a
Merge branch 'dev' into hdr-output
davo0411 Mar 14, 2026
23a485c
more sun tweaks
davo0411 Mar 14, 2026
fb1732c
Merge branch 'hdr-output' of https://github.com/davo0411/skyrim-commu…
davo0411 Mar 14, 2026
d59668a
style: 🎨 apply pre-commit.ci formatting
pre-commit-ci[bot] Mar 14, 2026
998f24f
Update Sky.hlsl
davo0411 Mar 14, 2026
273fd39
Merge branch 'hdr-output' of https://github.com/davo0411/skyrim-commu…
davo0411 Mar 14, 2026
25c906f
more sun fixes
davo0411 Mar 14, 2026
02daa14
style: 🎨 apply pre-commit.ci formatting
pre-commit-ci[bot] Mar 14, 2026
6c23b36
Update Sky.hlsl
davo0411 Mar 14, 2026
9d2616d
fixes for nat
davo0411 Mar 14, 2026
dd8e283
Merge branch 'dev' into hdr-output
davo0411 Mar 14, 2026
d7de3f3
style: 🎨 apply pre-commit.ci formatting
pre-commit-ci[bot] Mar 14, 2026
c7fdfce
idk more attempts
davo0411 Mar 14, 2026
d97d564
Merge branch 'hdr-output' of https://github.com/davo0411/skyrim-commu…
davo0411 Mar 14, 2026
1ab5658
style: 🎨 apply pre-commit.ci formatting
pre-commit-ci[bot] Mar 14, 2026
d271563
Merge branch 'dev' into hdr-output
jiayev Mar 16, 2026
083067b
fix shareddata buffer align
jiayev Mar 16, 2026
e26e074
Update HDRDisplay.cpp
davo0411 Mar 16, 2026
255b0f6
idk
davo0411 Mar 16, 2026
e64824c
style: 🎨 apply pre-commit.ci formatting
pre-commit-ci[bot] Mar 16, 2026
5fa2570
Merge branch 'dev' into hdr-output
davo0411 Mar 17, 2026
72eb3a3
Revert "Update HDRDisplay.cpp"
jiayev Mar 19, 2026
722b3db
fix(HDRDisplay): simplify menu state checks for UI brightness scaling
jiayev Mar 19, 2026
424c676
Merge branch 'dev' into hdr-output
jiayev Mar 22, 2026
5546098
Merge branch 'dev' into hdr-output
jiayev Mar 25, 2026
fbeee61
Merge branch 'dev' into hdr-output
jiayev Mar 26, 2026
b74b509
Merge branch 'dev' into hdr-output
jiayev Mar 26, 2026
a59d2e3
uncooking it
davo0411 Mar 27, 2026
7303e13
tweeekkkkkk
davo0411 Mar 27, 2026
93c5a8d
better
davo0411 Mar 27, 2026
71666ef
Update Sky.hlsl
davo0411 Mar 27, 2026
6b625af
style: 🎨 apply pre-commit.ci formatting
pre-commit-ci[bot] Mar 27, 2026
42dd37c
Update HDROutputCS.hlsl
davo0411 Mar 27, 2026
5789e2e
Merge branch 'hdr-output' of https://github.com/davo0411/skyrim-commu…
davo0411 Mar 27, 2026
1d8bef2
style: 🎨 apply pre-commit.ci formatting
pre-commit-ci[bot] Mar 27, 2026
0097d0c
Update DisplayMapping.hlsli
davo0411 Mar 28, 2026
c8456f8
Merge branch 'doodlum:dev' into hdr-output
davo0411 Mar 28, 2026
afe8aa5
fixes, comment removal
davo0411 Mar 28, 2026
3445ae1
Sun Blood occlusion mask
davo0411 Mar 28, 2026
fe42e14
Some UI fixes and nice-to-haves
davo0411 Mar 29, 2026
81635ac
Merge branch 'hdr-output' of https://github.com/davo0411/skyrim-commu…
davo0411 Mar 29, 2026
ebcaf2c
style: 🎨 apply pre-commit.ci formatting
pre-commit-ci[bot] Mar 29, 2026
800d6a4
Merge branch 'dev' into hdr-output
jiayev Apr 1, 2026
0afc5f5
musa changes
davo0411 Apr 6, 2026
70c7f58
Update HDRDisplay.h
davo0411 Apr 6, 2026
61ff10c
Merge branch 'doodlum:dev' into hdr-output
davo0411 Apr 6, 2026
7af5fd0
style: 🎨 apply pre-commit.ci formatting
pre-commit-ci[bot] Apr 6, 2026
fb25bdc
Update version in Upscaling.ini to 1-3-2
davo0411 Apr 7, 2026
45a39b3
code cleanup, comment cleanup
davo0411 Apr 7, 2026
2f5876d
Update HDROutputCS.hlsl
davo0411 Apr 7, 2026
402f1bd
Merge branch 'hdr-output' of https://github.com/davo0411/skyrim-commu…
davo0411 Apr 7, 2026
1b0ebea
style: 🎨 apply pre-commit.ci formatting
pre-commit-ci[bot] Apr 7, 2026
e9e4748
musa changes
davo0411 Apr 7, 2026
cbb4ad6
style: 🎨 apply pre-commit.ci formatting
pre-commit-ci[bot] Apr 7, 2026
e258b42
Update DisplayMapping.hlsli
davo0411 Apr 7, 2026
c413573
Update Upscaling.ini
davo0411 Apr 7, 2026
7186fda
Replace SrgbToLinearSigned with GammaToLinearSafe
davo0411 Apr 7, 2026
022b0cc
Change LinearToSrgbSigned to LinearToGammaSafe
davo0411 Apr 7, 2026
2f0d303
Merge branch 'dev' into hdr-output
alandtse Apr 8, 2026
cae5783
Update HDRDisplay.h
davo0411 Apr 8, 2026
33fa12d
Update HDROutputCS.hlsl
davo0411 Apr 8, 2026
6f019ba
Update ISHDR.hlsl
davo0411 Apr 8, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion features/Cloud Shadows/Shaders/Features/CloudShadows.ini
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[Info]
Version = 1-2-0
Version = 1-2-1
2 changes: 2 additions & 0 deletions features/HDR Display/Shaders/Features/HDRDisplay.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[Info]
Version = 1-0-0
100 changes: 100 additions & 0 deletions features/HDR Display/Shaders/HDRDisplay/HDROutputCS.hlsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
/**
* @file HDROutputCS.hlsl
* @brief HDR: gamma decode, paper-white × (nits/203), BT.2020, PQ. SDR: passthrough + UI.
*/

#include "Common/Color.hlsli"
#include "Common/SharedData.hlsli"

Texture2D<float4> SceneTex : register(t0);
Texture2D<float4> UITex : register(t1);
RWTexture2D<float4> HDROutput : register(u0);

cbuffer PerFrame : register(b0)
{
float enableHDR : packoffset(c0.x);
float paperWhite : packoffset(c0.y);
float peakNits : packoffset(c0.z);
float skipUIComposite : packoffset(c0.w);
float uiBrightness : packoffset(c1.x);
float isSceneLinear : packoffset(c1.y);
float isMainOrLoadingMenu : packoffset(c1.z);
float fgTweenMenuMidAlphaBoost : packoffset(c1.w); ///< TweenMenu: soften AA band when compositing here (UIBrightnessCS skips while paused)
}

[numthreads(8, 8, 1)] void main(uint3 dispatchID : SV_DispatchThreadID) {
uint width, height;
HDROutput.GetDimensions(width, height);
if (dispatchID.x >= width || dispatchID.y >= height)
return;

float4 scene = SceneTex[dispatchID.xy];
float4 ui = UITex[dispatchID.xy];

bool hdrEnabled = enableHDR > 0.5;
bool skipUI = skipUIComposite > 0.5;

float3 finalColor;

if (hdrEnabled) {
bool sceneIsLinear = isSceneLinear > 0.5;
float3 compositedColorLinear;

if (sceneIsLinear) {
float3 sceneLinear = max(0.0, scene.rgb);
if (skipUI) {
compositedColorLinear = sceneLinear;
} else {
float3 uiLinear = Color::SrgbToLinear(max(0.0, ui.rgb));
if (!(isMainOrLoadingMenu > 0.5)) { // UI and scene can't be separated in main menu or loading screen
// scale UI brightness (multiplier based on paperWhite)
uiLinear *= uiBrightness;
}
compositedColorLinear = uiLinear + sceneLinear * (1.0 - ui.a);
}
} else {
float3 sceneGamma = scene.rgb;
float3 compositedColorGamma;
if (skipUI) {
compositedColorGamma = sceneGamma;
} else {
float3 uiGamma = ui.rgb;
if (!(isMainOrLoadingMenu > 0.5)) { // UI and scene can't be separated in main menu or loading screen
// scale UI brightness (multiplier based on paperWhite)
float3 uiLinear = Color::SrgbToLinear(max(0, uiGamma));
uiLinear *= uiBrightness;
uiGamma = Color::LinearToSrgb(uiLinear);
}
#if 0
if (fgTweenMenuMidAlphaBoost > 0.5 && ui.a > 1e-3) {
float midBand = smoothstep(0.3, 0.35, ui.a) * (1.0 - smoothstep(0.55, 0.6, ui.a));
const float fgMidAlphaBoost = 0.12;
ui.a = saturate(ui.a + midBand * fgMidAlphaBoost);
}
#endif

compositedColorGamma = uiGamma + sceneGamma * (1.0 - ui.a);
}

// Non-LL path: ISHDR output is gamma-encoded at this stage.
compositedColorLinear = Color::GammaToLinearSafe(compositedColorGamma);
}

compositedColorLinear = Color::BT709ToBT2020(compositedColorLinear);
finalColor = Color::pq::Encode(max(0.0, compositedColorLinear), paperWhite);

finalColor = saturate(finalColor);
} else {
float3 sceneGamma = scene.rgb;

if (skipUI) {
finalColor = sceneGamma;
} else {
finalColor = ui.rgb + sceneGamma * (1.0 - ui.a);
}

finalColor = saturate(finalColor);
}

HDROutput[dispatchID.xy] = float4(finalColor, 1.0);
}
67 changes: 67 additions & 0 deletions features/HDR Display/Shaders/HDRDisplay/UIBrightnessCS.hlsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
// Preprocess vanilla UI for Frame Gen compositing.
// HDR path converts UI to PQ/BT.2020 using configured paper white.
// SDR path keeps gamma UI and only clamps negatives.

#include "Common/Color.hlsli"

RWTexture2D<float4> UITex : register(u0);

cbuffer PerFrame : register(b0)
{
float enableHDR : packoffset(c0.x); ///< 1.0 = HDR output with PQ, 0.0 = SDR output with gamma
float paperWhite : packoffset(c0.y); ///< Reference white in nits (used by HDR UI conversion)
float peakNits : packoffset(c0.z); ///< Maximum display brightness in nits for HDR (unused here)
float skipUIComposite : packoffset(c0.w); ///< Unused in this shader
float uiBrightness : packoffset(c1.x); ///< UI brightness multiplier
float isSceneLinear : packoffset(c1.y); ///< Unused in this shader
float isMainOrLoadingMenu : packoffset(c1.z); ///< Unused; layout matches HDRDataCB
float fgTweenMenuMidAlphaBoost : packoffset(c1.w); ///< 1 = TweenMenu open: apply mid-alpha AA boost only for pause UI
}
Comment thread
davo0411 marked this conversation as resolved.

[numthreads(8, 8, 1)] void main(uint3 dispatchID : SV_DispatchThreadID) {
// Bounds check to prevent UAV out-of-bounds reads/writes
uint width, height;
UITex.GetDimensions(width, height);
if (dispatchID.x >= width || dispatchID.y >= height)
return;

float4 ui = UITex[dispatchID.xy];

bool hdrEnabled = enableHDR > 0.5;

if (hdrEnabled) {
// FidelityFX FG blends in PQ space, so UI must be PQ/BT.2020.
const float uiReferenceNits = max(paperWhite, 1.0);

if (ui.a > 0.001) {
// Pause menu only: raise coverage in the soft AA band to avoid washout.
float aIn = ui.a;
float aOut = aIn;
if (fgTweenMenuMidAlphaBoost > 0.5) {
float midBand = smoothstep(0.3, 0.35, aIn) * (1.0 - smoothstep(0.55, 0.6, aIn));
const float fgMidAlphaBoost = 0.12;
aOut = saturate(aIn + midBand * fgMidAlphaBoost);
}

float3 uiStraight = ui.rgb / aIn;
float3 uiLinear = Color::SrgbToLinear(max(0, uiStraight));
float3 uiBT2020 = Color::BT709ToBT2020(uiLinear);
float3 uiNits = uiBT2020 * uiReferenceNits * uiBrightness;
ui.rgb = Color::pq::Encode(uiNits / 10000.0, 10000.0) * aOut;
ui.a = aOut;
} else {
// Broken-alpha path: transform premultiplied color and keep alpha at 0.
float3 uiLinear = Color::SrgbToLinear(max(0, ui.rgb));
float3 uiBT2020 = Color::BT709ToBT2020(uiLinear);
float3 uiNits = uiBT2020 * uiReferenceNits * uiBrightness;
ui.rgb = Color::pq::Encode(uiNits / 10000.0, 10000.0);
}
} else {
// SDR path: keep premultiplied gamma UI, clamp negatives only.
ui.rgb = max(0, ui.rgb);
UITex[dispatchID.xy] = ui;
return;
}

UITex[dispatchID.xy] = ui;
}
2 changes: 1 addition & 1 deletion features/Upscaling/Shaders/Features/Upscaling.ini
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[Info]
Version = 1-3-1
Version = 1-4-0
Loading
Loading