Skip to content

Fix gamma slider via pixel shader #178#481

Merged
void2012 merged 5 commits intosmartcmd:mainfrom
ModMaker101:fix/gamma-slider-renderpath-178
Mar 5, 2026
Merged

Fix gamma slider via pixel shader #178#481
void2012 merged 5 commits intosmartcmd:mainfrom
ModMaker101:fix/gamma-slider-renderpath-178

Conversation

@ModMaker101
Copy link
Contributor

Description

This PR fixes the gamma slider so it properly affects scene brightness on all platforms. Instead of relying on DXGI system level gamma, gamma is now applied directly through the light-texture pipeline

Changes

Previous Behavior

  • Gamma slider did almost nothing.
  • Originally attempted hardware gamma via IDXGIOutput::SetGammaControl, which was unreliable.

Root Cause

  • The engine never applied gamma in a sofware path.
  • Hardware gamma APIs were inactive in the environments people were using.

New Behavior

  • Gamma slider now affects global brightness consistently.
  • A small toe lift keeps shadows readable when brightend.
  • Works per-player in split-screen.

Fix Implementation

  • Removed reliance on DXGI.
  • Added software gamma curve inside updateLightTexture, with clamping and toe correction
  • Verified in day/night, caves, underwater, and rain.

Related Issues

Before:
image

After:
image

Not entirely too much of a difference during the day.

Before:
image

After:
image

Now I'm WAY to lazy to try and time it up to get a lighting strike, but yeah the gamma bar also works too:

2026-03-04.15-45-41.mp4

@ModMaker101
Copy link
Contributor Author

Oh yeah sorry for the quality, GitHub only allows 10MBs.

@void2012
Copy link
Collaborator

void2012 commented Mar 4, 2026

goated PR, thanks

@ModMaker101
Copy link
Contributor Author

Yeah, no problem.

@hartelex
Copy link

hartelex commented Mar 4, 2026

Nice. Wanted to report the gamma slider doing barely anything as a bug, but I guess I don't have to.

@DFelipehDEV
Copy link
Contributor

DFelipehDEV commented Mar 4, 2026

idk if its the video quality but i remember console edition having a way more agressive gamma setting(also i believe it affected the ui)
image

@gizmogoat
Copy link

LCEMP's gamma fix seems most accurate if we want to merge that in. The following images are 50% gamma and 100% gamma:
image

image

@void2012
Copy link
Collaborator

void2012 commented Mar 5, 2026

@ModMaker101

@ModMaker101
Copy link
Contributor Author

My implementation isn't intended to replicate the LC gamma curve it's designed to provide a software fix for the gamma that fixes the slider not doing anything. LCE IIRC used a much more aggressive non-linear curve. My PR does not aim to match that behavior. Instead, I'm applying a standard gamma function with a small toe lift. If we ever decide to target the LC gamma profile, we can add that as a separate preset. But this PR's goal was to make the gamma slider functional.

@ModMaker101
Copy link
Contributor Author

And I forgot to say, but in ICEMP they use post processing for the gamma. Mine is built into the lighting pipeline directly. But I am working on a commit to make it more LC-like.

@void2012
Copy link
Collaborator

void2012 commented Mar 5, 2026

Okay, converting to draft.

@void2012 void2012 marked this pull request as draft March 5, 2026 15:44
@ModMaker101
Copy link
Contributor Author

Yeah, I'll probably have it out by the end of the day.

@ModMaker101 ModMaker101 marked this pull request as ready for review March 5, 2026 18:40
@ModMaker101
Copy link
Contributor Author

@void2012 ready for review. One caveat is I kept getting an exception for multiplayer thing which is in progress so I wasn't able to test split-screen.

image

@void2012
Copy link
Collaborator

void2012 commented Mar 5, 2026

Ask wine people to test and this can be merged.

@ModMaker101
Copy link
Contributor Author

I had someone test it for me and they said it was all working @void2012 .

@void2012 void2012 merged commit cbcf3de into smartcmd:main Mar 5, 2026
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.

Gamma slider has no effect

5 participants