Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue #123 - Brightness Controls #138

Merged
merged 9 commits into from
Feb 14, 2024

Conversation

0xABADCAFE
Copy link
Collaborator

@0xABADCAFE 0xABADCAFE commented Feb 5, 2024

Adds controls for fine tuning the display brightness. Separate adjustments are provided for gamma, contrast and brightness offset.
These can be modified in game by using the numeric pad when not in map mode (map mode uses these for scrolling around the map).

  • The brightness offset control effectively adjusts the black point.

    • NP 1 decreases
    • NP 2 resets to default
    • NP 3 increases
  • The contrast control linearly adjusts the brightness scaling

    • NP 4 decreases
    • NP 5 resets to default
    • NP 6 increases
  • The gamma control applies a precalculated gamma curve.

    • NP 7 decreases
    • NP 8 resets to default
    • NP 9 increases
    • For now the gamma adjustment is only capable of brightening

Notes:

  • Settings are saved separately for AGA and RTG display types

  • The actual implementation is a fixed point arithmetic equation of Lout = B + C * Lin ^ G applied to each gun of a palette entry when recalculating the palette:

    • Lin is the intensity input (0 - 1, represented as 0 - 255)
    • Lout is the intensity output (0 - 1, represented as 0 - 255)
    • B is the brightness adjustment as 8.8 fixed point
    • C is the contrast adjustment as 8.8 fixed point
    • G is the gamma (precalculated lookup for curves of x ^ 0.9375 - x ^ 0.5)

The current settings allow for some extreme modification and should be clamped accordingly.

The calculation is performed only when a setting changes and currently happens in Vid_the LoadMainPalette() which expects a 32-bit fractional value per gun.

@0xABADCAFE 0xABADCAFE changed the title Splat fill the 32-bit RGB gun values Issue #123 - Brightness Controls Feb 12, 2024
@0xABADCAFE 0xABADCAFE linked an issue Feb 12, 2024 that may be closed by this pull request
@0xABADCAFE 0xABADCAFE merged commit d82e8da into mheyer32:main Feb 14, 2024
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.

Brightness Controls
1 participant