Skip to content

dark color mixing regression? #4794

Description

@TripleWhy

What happened?

I noticed that recent versions of the main branch produce artifacts when using dim brightness levels. I traced it to the merge of #4658.

Here is what 4a3af81 (before merge) looks like with the palette effect at global brightness 4:

Image

Image

And this is 23a51e0 (merge commit) with the same preset:

Image

Image

For completeness, I also added screenshots of the UI. There it looks the other way round.

To Reproduce Bug

Use low global brightness.

Expected Behavior

Some colors produce incorrect colors or off pixels on physical LEDs

Install Method

Self-Compiled

What version of WLED?

WLED 0.16.0-alpha (build 2412040)

Which microcontroller/board are you seeing the problem on?

ESP8266

Relevant log/trace output

Anything else?

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

Activity

  1. blazoncek commented on Jul 29, 2025

    @blazoncek
    Contributor

    Due to new way gamma is handled (which is now correctly applied as a last step).

  2. TripleWhy commented on Jul 29, 2025

    @TripleWhy
    ContributorAuthor

    So you are saying this is the correct behavior?
    (and everyone who likes colors should simply turn off gamma correction? ^^)

  3. blazoncek commented on Jul 29, 2025

    @blazoncek
    Contributor

    I can't answer that but gamma is supposed to be applied only as a last step in image manipulation. And now it is. In the past Gamma was applied immediately when color was selected and every calculation worked on gamma modified color.

  4. TripleWhy commented on Jul 29, 2025

    @TripleWhy
    ContributorAuthor

    Well I believe it doesn't really matter when you convert between color spaces, but you need to make sure that the math you are using is the correct one that is applicable for each color space. If you simply move the conversion to a different place, but don't replace all math that happens in between, I can see how that would produce different results.

    sRGB is an exponential color space, so you can't do linear math in it (despite the fact that most people do anyway). I would assume that the RGB colors of WLED are sRGB, are they not? And further I would assume (without knowing much about it), that LEDs are addressed in a linear color space. With these assumptions I would arrive at the conclusion that the gamma correction would have to be done as early as possible. Again, that is without ever having looked at color spaces in the context of LEDs.

    In any case, if you look at the picture, you will notice that there is no hint of mixed colors, just pure red, green and blue, in varying intensities. I don't think that can be a correct result when your input is yellow, cyan or magenta.

  5. DedeHai commented on Jul 29, 2025

    @DedeHai
    Collaborator

    can't reproduce: fixed in #4711

    edit:
    thanks for making me check, I found a different bug :)

  6. TripleWhy commented on Jul 29, 2025

    @TripleWhy
    ContributorAuthor

    As said, I noticed this in the main branch, which contains 4711. Anyway I checked out 00eb406 (4711), and b76ef23 (your fix from today). Same problem.

  7. DedeHai commented on Jul 30, 2025

    @DedeHai
    Collaborator

    what are you settings for color correction? needs to be "Use Gamma correction for color" enabled and set to 2.2 to get the best match to the old looks. it will still look different at very low brightness but I see no black bands at 4 only below that.
    I do agree that at low brightness it might need some tuning as we are running into a resolution problem and it really does not look good below a brightness of 10.

  8. DedeHai commented on Jul 30, 2025

    @DedeHai
    Collaborator

    The base issue is this: calling SetLuminance() in NPB will dim colors all the way to zero.
    To solve it, this function of NPB can not be used and colors need to be scaled before passing them to NPB.

  9. blazoncek commented on Jul 30, 2025

    @blazoncek
    Contributor

    colors of WLED are sRGB, are they not

    WLED does not operate in any color space. It uses linear math and gamma is used to correct for human vision. I.e. a channel value of 127 is considered 50% of brightness.

  10. TripleWhy commented on Jul 30, 2025

    @TripleWhy
    ContributorAuthor

    what are you settings for color correction? needs to be "Use Gamma correction for color" enabled and set to 2.2 to get the best match to the old looks. it will still look different at very low brightness but I see no black bands at 4 only below that.

    Color correction on, brightness correction off (whatever that means). gamma was at 2.8, I assume that is or used to be the default.

    Indeed 2.2 works a bit better, but the brightness and colors still look inconsistent, and I still get black bands at brightness 3 or lower.

    4a3af81 with gamma 2.8 has no black bands at brightness 1, and reasonable colors at least from brightness 3 upwards (3 colors at brightness 1, 6 colors at brightness 2 with the default palette). Same with gamma 2.2.

  11. DedeHai commented on Jul 30, 2025

    @DedeHai
    Collaborator

    4a3af81 with gamma 2.8 has no black bands at brightness 1, and reasonable colors at least from brightness 3 upwards (3 colors at brightness 1, 6 colors at brightness 2 with the default palette). Same with gamma 2.2.

    the black bands are fixable, the rest is a question of personal preference.

  12. TripleWhy commented on Jul 30, 2025

    @TripleWhy
    ContributorAuthor

    I don't think yellow looking like dark red/black/dark green personal preference, but that's just my opinion, I guess

  13. DedeHai commented on Jul 30, 2025

    @DedeHai
    Collaborator

    I don't think yellow looking like dark red/black/dark green personal preference, but that's just my opinion, I guess

    I meant in general. this is an edge case.

  14. DedeHai commented on Jul 31, 2025

    @DedeHai
    Collaborator

    @TripleWhy I made a proof of concept: #4798

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions