Skip to content

Twinklefox/Twinklecat dimmer than expected (16.0.0) #5622

@WJCFerguson

Description

@WJCFerguson

What happened?

The Twinklefox and Twinklecat effects are visibly dimmer in v16.0.0 compared to v0.15.x. This is because the v16.0.0 gamma correction architecture change (commit ee9ac94) moved gamma correction from input colors to the final output stage, but the Twinklefox twinkle colors were not compensated with gamma32inv().

Root cause

In v0.15.x, gamma correction was applied to palette and segment colors when they were loaded (_colors_t[i] = gamma32(seg.currentColor(i))). Effects operated on pre-gamma'd values, and no gamma was applied at output.

In v16.0.0, effects operate on linear (non-gamma'd) colors, and gamma32() is applied at the output stage (FX_fcn.cpp:1685). Effects that do their own internal brightness scaling (like Twinklefox's bright parameter to ColorFromPalette) get their brightness curve gamma-compressed at output, resulting in dimmer mid-brightness twinkles.

A partial fix was already applied to the Twinklefox background color:

bg = gamma32inv(bg); // need to invert gamma as the FX was written without any gamma correction

And the same pattern is used in the Pride2015 effect:

newcolor.color32 = gamma32inv(newcolor.color32);

But the twinkle colors themselves were not given the same treatment.

Fix

Apply gamma32inv() to the twinkle color output, matching the existing pattern:

     CRGBW c = twinklefox_one_twinkle(myclock30, myunique8, cat);
+    c = gamma32inv(c); // invert gamma as the FX was written without gamma correction

     unsigned cbright = c.getAverageLight();

This is a one-line change in FX.cpp within twinklefox_base().

Environment

  • WLED v16.0.0
  • LED type: WS2812B
  • Gamma correction: enabled
  • Effect: Twinklefox with black background

To Reproduce Bug

Observe Twinklefox difference between 0.15.4 and 16.0 install

Expected Behavior

Same or similar brightness

Install Method

Binary from WLED.me

What version of WLED?

16.0

Which microcontroller/board are you seeing the problem on?

ESP8266, ESP32

Relevant log/trace output

Anything else?

No response

Code of Conduct

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    AIPartly generated by an AI. Make sure that the contributor fully understands the code!bugfixed in sourceThis issue is unsolved in the latest release but fixed in master

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions