Skip to content

Greedfall 2#561

Open
RankFTW wants to merge 2 commits into
clshortfuse:mainfrom
RankFTW:main
Open

Greedfall 2#561
RankFTW wants to merge 2 commits into
clshortfuse:mainfrom
RankFTW:main

Conversation

@RankFTW

@RankFTW RankFTW commented May 11, 2026

Copy link
Copy Markdown

HDR mod for Greedfall 2 (DX12, Silk Engine).

Game renders HDR internally then tonemaps with Narkowicz ACES in a compute pass and blits to an R8G8B8A8 swapchain. No native HDR.

Replaces three shaders:

0x6DE32B48 (tonemap compute): skips ACES, PQ-encodes pre-tonemap HDR through existing R10G10B10A2 buffer
0xF27041D0 (compositing): PQ-encodes UI at controlled brightness, composites with inverted alpha
0xD2C8C305 (final blit): PQ decodes, applies ToneMapPass, outputs scRGB to float16 swapchain
Features:

ACES and RenoDRT tonemapper options
Full color grading (exposure, contrast, saturation, highlights, shadows, blowout, flare, hue correction/shift)
Independent UI brightness control
Color temperature and black floor
Auto-exposure from original shader preserved
Main menu/loading screen passthrough via on_drawn flag detection
No resource upgrades required

Notes:

Does not use RenderIntermediatePass/SwapChainPass pattern. The intermediate R10G10B10A2 buffer between the tonemap and final blit cannot be upgraded to float16 on this game's DX12 pipeline (resource cloning causes rendering corruption). PQ encoding is used as a workaround to transport HDR through the 10-bit buffer. The final blit outputs scRGB directly to the float16 swapchain. HDR10 output mode is not supported as a result — WIP.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a RenoDX-based HDR mod integration for Greedfall 2 (DX12 / Silk Engine) by injecting custom shaders and exposing runtime tuning controls via the addon settings system. The approach transports HDR through the game’s existing 10-bit intermediate by PQ-encoding, then restores/tonemaps and outputs scRGB to a float16 swapchain.

Changes:

  • Introduces a Greedfall2 addon with a ShaderInjectData constant buffer and a comprehensive UI/settings surface for tonemapping + grading.
  • Adds three replacement shaders to bypass the game’s ACES compute tonemap, PQ-encode scene/UI for transport, then decode + tonemap and output scRGB.
  • Adds a local Psycho test17 tonemapper implementation and updates .gitignore for common build/temp/log artifacts.

Reviewed changes

Copilot reviewed 6 out of 7 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/games/greedfall2/shared.h Defines the injected constant buffer layout and renodx macro bindings for shaders.
src/games/greedfall2/addon.cpp Registers the addon, hooks shader replacements, and defines user-facing settings that drive the injected constant buffer.
src/games/greedfall2/0x6DE32B48.cs_6_0.hlsl Replaces the game tonemap compute pass: keeps auto-exposure, uses PQ transport (or vanilla ACES when disabled).
src/games/greedfall2/0xF27041D0.cs_6_0.hlsl Replaces compositing: applies effects, PQ-encodes UI at controlled brightness, composites using inverted alpha.
src/games/greedfall2/0xD2C8C305.ps_6_0.hlsl Replaces final blit: PQ-decodes, applies grading/tonemap, outputs scRGB to the float16 swapchain.
src/games/greedfall2/psycho_test17.hlsl Adds Psycho tonemapper implementation used by the final blit when selected.
.gitignore Ignores MSVC build output, dumps/tmp files, and common logs/artifacts.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +376 to +380
renodx::utils::settings::UpdateSetting("ColorGradeFlare", 0.f);
renodx::utils::settings::UpdateSetting("ColorGradeScene", 100.f);
renodx::utils::settings::UpdateSetting("ColorTemp", 50.f);
renodx::utils::settings::UpdateSetting("ShadowLift", 0.f);
}
Comment on lines +108 to +114
} else {
// Gamma encode before ToneMapPass
hdr = renodx::color::correct::GammaSafe(hdr, true);

// ACES / RenoDRT via ToneMapPass
tonemapped = renodx::draw::ToneMapPass(hdr);
}
Comment on lines +8 to +10
// Game tonemaps with Narkowicz ACES in compute pass 0x6DE32B48.
// When 0x6DE32B48 is replaced, t0 contains gamma-encoded HDR/3 in R10G10B10A2.
// We decode, recover ×3, then apply ToneMapPass with real pre-tonemap HDR values.
Comment on lines +1 to +6
#ifndef RENODX_SHADERS_TONEMAP_PSYCHO_TEST17_HLSL_
#define RENODX_SHADERS_TONEMAP_PSYCHO_TEST17_HLSL_

namespace renodx {
namespace tonemap {
namespace psycho {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants