Repository navigation
Description
Board / MCU
Other
LED Chipset
WS2812B / NeoPixel
FastLED Version
git master
Arduino / PlatformIO version
PIOArduio 1.4.4
Operating System
Windows
Description
Creating an issue to mirror the feedback provided within the original reddit post describing the model & our followup conversations, relevant recent bits from reddit :
"bit of an update:
the LP solver within FastLED now is mostly just white channel usage with almost 0 RGB involvement on White-like values. The actual algorithm as you currently have implemented seems to have diverged quite a bit from the original math model implementation : https://gist.github.com/JChalka/915603d7930b7216d5c5aae834ec2ea9#9-reference-wx-mode-wx_lp_legacy
quick verifier session (36 samples) : https://docs.google.com/spreadsheets/d/1IwOEJ_shMiYU1MPdZpvGLIUXNmY3tPXj8nfiHJAZkX0/edit?usp=sharing
The good news:
- LP solver & sub-gamut are no longer 1:1 outputs
- sub-gamut is now target white point aware and it works, verifier was able to capture passing dE white points with equal RGB components for the input at the default D65 white point
- Dual channels mostly look better as far as Y ratio scaling is concerned, there is some issues noted below that are different than that failure mode
the bad news:
-
the LP solver is no longer working as a chromaticity aware solver and is just shoving in white and removing residuals which is contradictory to its actual goals as a solver and is no longer following the math model implementation as much as it can
-
the sub-gamut solver is now failing single-channel topology rules within the native-gamut, which given the failure type shown could probably spill into named-gamuts. There are quite a few cases where we have illegal topology in play despite "fl::set_input_gamut(&testBenchRgbwProfile, fl::InputGamut::Native);" so things like single channel & dual-channel/Edge authority should stick.
-
Dual-channels like yellow_half aren't being properly scaled down to their appropriate output drive levels, yellow_half for example is basically the same output RGBW tuple as full yellow which means there is no "half" it's just always full yellow
the sub-gamut model has strict legal topologies while addressing the native gamut:
black
R, G, B, W
RG, RB, BG
RW, GW, BW
RGW, RBW, BGW
This means in native-gamut mode single channel authority should always be present, 0, 0, 65535 should never pull in R or G for example and full channel budget should be allowed. As shown in the quick verifier session pure Greens currently pull in about ~half of it's q16 budget on white as well which is illegal topology within the struct sub-gamut model
this pull-in is also present in values like Cyan, red_half, green_half, cyan_half, magenta_half, spring, azure, violet, & dark_green. In the native_gamut these should basically all be authoritative Single channel or Dual channel solves not a triangle solve that somehow manages to bring in white, the fix shouldn't probably involve a post-solve channel strip either as that would mask problems within the algorithm as implemented that would allow illegal topologies and then named-gamuts would still be able to allow the illegal topologies instead of following the strict sub-gamut rules and then projecting to the named-gamuts hull
bit of another note :
in rgbww.cpp.hpp around line 208 : const colorimetric_detail::DiodeProfile& wp = profile.warm_path; causes a compile-time error when the colorimetric path is enabled via the flag, fixed via const fl::DiodeProfile& wp = profile.warm_path; (PR already created to fix this one)
edit: I'm running a larger verification session currently which is exposing a couple more bugs that affect 3-channel input solves (it's mostly just granularity issues following similar trends as yellow_half) I'll report back with that medium-run CSV when it finishes up"
"Following up with the medium patch set report : https://docs.google.com/spreadsheets/d/1GYxE3jcknTTUx9mYUp4wGJd8SEkBKI-sdCajryqsx6U/edit?usp=sharing
Exposes a bit more issues than the quick patch-set did, although the issues flagged from that still apply.
h180_s100_v015 0 9830 9830 | 0 24029 65535 38635
h180_s100_v035 0 22937 22937 | 0 24029 65535 38635
h180_s100_v055 0 36044 36044 | 0 24029 65535 38635
h180_s100_v075 0 49151 49151 | 0 24029 65535 38635
Dual-channels are the biggest failures where it pulls in an unrelated third channel in sub-gamut mode + there is no granularity, every solve is essentially pegged to its max Y solve regardless of the input RGB tuple.
h000_s060_v015 9830 3932 3932 | 18610 0 932 3826
h000_s060_v035 22937 9175 9175 | 43422 0 2175 8927
h000_s060_v055 36044 14418 14418 | 65535 0 3283 13474
h000_s060_v075 49151 19661 19661 | 65535 0 3283 13474
h000_s060_v100 65535 26214 26214 | 65535 0 3283 13473
this is also present in some, but not all, 3 channel solves where inputs get clipped partway through and then are never allowed to be fully granular which compresses the high end and leaves mostly low-end"
I attached a more detailed README/report comparing the current FastLED RGBW colorimetric implementation against the current reference math model and verifier outputs.
The main goal here is not to move FastLED toward baked 3D LUTs. The Python math model is currently performing very well, and FastLED already has most of the right building blocks for a fast analytical runtime path: profile caching, source-space matrices, cached sub-gamut inverses, and W-displacement math.
The report focuses on the current divergences:
- Native single-channel and native outer-edge topology authority are not currently preserved.
- Some HSV/value ramps collapse multiple input values to the same RGBW output, suggesting value is being lost after a full-chroma/endpoint solve.
- The current boosted W overdrive behavior is useful, but it should be separated from the reference
wx_lp_legacybehavior, which is a chromaticity-preserving max-feasible-W endpoint.
The README includes concrete failing verifier rows, FastLED-vs-cube overlap data, source/model snippets, and proposed C++-style pseudocode for fixing the solver while keeping the runtime path analytical and MCU-friendly.
Steps to reproduce
FASTLED_RGBW_COLORIMETRIC_DIVERGENCE_README.md
Minimal sketch
Serial / debug output
Checklist
- I have searched existing issues for duplicates
- I have tested with the latest FastLED release or git master
- I can reproduce this with a minimal sketch
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
fix(rgbw): native topology authority for strict + boosted solvers (#2748
JChalka commentedon Jun 4, 2026
Thanks for the update here — this latest commit definitely fixed one important part of the previous report.
The native single/dual illegal-topology issue is mostly addressed now: in the stopped-early verifier subset I’m seeing 0 illegal native single/dual outputs, where the previous run had W/third-channel bleed on single and dual native edges. Pure red/green/blue and half red/green/blue now correctly stay on their native channel, which is a good improvement.
The remaining issue is that the native topology guard currently treats both single-channel and dual-channel inputs as direct passthrough:
That is correct for single-channel native identity, but not for dual-channel native edges.
The rule we need is:
So
yellow_halfshould not pull in B or W, but it also should not return32768,32768,0,0. With the current reference model/ramp path, the expected shape is closer to:The latest verifier shows the current passthrough behavior failing hard:
What needs to be implemented is a fixed-topology dual solve:
The dual edge helper should solve only the active two columns:
The second remaining issue is value granularity for 3-channel/interior solves. The current path still appears to solve the value-scaled RGB input directly, then normalize if a channel exceeds 1.0. That causes different value levels to collapse into the same output.
Current examples:
The strict solver should instead do the same chroma/value split as the reference model:
Projection and normalization should happen on the full-chroma endpoint, not on the already value-scaled input node. Otherwise
v055,v075, andv100can all normalize into the same tuple.The third remaining item is the LP solver.
solve_wx_overdrive()is useful as a boosted/drift mode, but it is not the referencewx_lp_legacysolver.wx_lp_legacyshould be restored as its own mode:Then the modes can remain cleanly separated:
So the direct implementation asks are:
wx_lp_legacyseparately fromsolve_wx_overdrive().This still keeps the FastLED path analytical and MCU-friendly. No baked 3D LUT is required.
Suggested remaining fixes for sub-gamut model :
FASTLED_RGBW_COLORIMETRIC_FOLLOWUP_REQUIRED_FIXES.md
Suggested remaining fixes for LP Solver + Comparison report:
FASTLED_LP_LEGACY_CUBE_COMPARISON_REPORT.md
JChalka commentedon Jun 4, 2026
I should have a PR ready soon, I want this medium run to finish up first though in case I missed something in my patch
zackees commentedon Jun 10, 2026
Seeing this on review, i'm opening it back up for further review and will close when done
JChalka commentedon Jun 10, 2026
@zackees #2752 fixed that up, so things are aligned now and looking sane
zackees commentedon Jun 10, 2026
Awesome glad to hear. Final question how does your formula handle the fact that green is so much more perceptually visible? we have basic color adjustment for that. Have you looked into if we are doing it wrong?
4 remaining items
zackees commentedon Jun 10, 2026
fair enough. Thanks again.
JChalka commentedon Jun 10, 2026
No problem, glad to be able to contribute something after years of using FastLED!
I've got one more PR en-route in regards to the sub-gamut model as implemented:
Opt-out patch that ensures channels scale appropriately according to the input RGB values.
Basically the current sub-gamut model (other models already have proper endpoint scaling) allows output values such as this:
so it pretty much goes "input RGB -> White extraction energy split -> scale channels based on the split channel energy from the input, not the actual input". Can see that W is set to 55705 instead of 65535 so the 'problem' is deterministic
post-fix output would look somewhat close to (given my wall-measured RGBW primary xyY values)
instead.
I've already got the fix implemented in my local fork I just want to run the verifier before I push the PR to ensure it landed right, if you want I can also work towards splitting the core solver logic away from a strict "white extraction" sense such that it could be applied to RGB as well. Overall I think this would be a nice clean split as then the actual solver work could just get moved into a "colorimetric_response.cpp.hpp" and then RGB/RGBW/Future 5 channel+ chipsets source/header files could just pull in the few functions it needs to actually solve the values and then the colorimetric_response source becomes the consolidated area for the actual math model implementations.
probably not something I'd implement today, would like to get an RGB test bench setup first and I've got some other things IRL I need to take care of, but the plumbing is pretty much all there so the hard work is basically done for that.
zackees commentedon Jun 11, 2026
Please yes, that would be awesome. Just a reminder that the acceptance criteria is that the algorithm compresses well into a discrete form
JChalka commentedon Jun 13, 2026
RGB algo should be a bit less than the current sub-gamut implementation so that should be pretty easy, things like the LP overdrive solver aren't really applicable toward it since there's no inner channel.
I'll probably implement this in a few different phases that way it's not just an all-in-one sweep.
Probably something like:
Phase 1) Implement RGBW Sub-gamut endpoint scaling as implemented in my local fork (this is already on my forked repo but has not been tested, been a bit busy)
Phase 2) split portable functions from RGBW_Colorimetric into colorimetric_response.cpp.hpp/.h
Phase 3) implement RGB_colorimetric.cpp.hpp/.h
Phase 4) find good implementation points for rgb_colorimetric - This is the bit that I haven't actually looked too deep into yet (aka "where is the best entry point?")
Overall I think both RGB/RGBW colorimetric should continue to be an opt-in rather than an opt-out so I don't want to go replacing the current/legacy functions (or break old code) so the final implementation will probably still keep the compile-time gating, although I'll probably look into runtime enabling/disabling as well so that things mesh well with the newly implemented Channels API. The explicit compile-time enable/disable is good for maintaining binary sizes on hardware that can't exactly support this due to memory constraints though.
Expect Phase 1 sometime within the next few days, it's already been implemented on my end I've just got some stuff going on around the house so I haven't exactly got around to running the verification session to make sure it looks sane
zackees commentedon Jun 18, 2026
Coming back on this now. You'll start seeing this addressed.
I want to really push the envelop on this color computation. Right now we are on theoretical math. From experience theory is great but hardware has all kinds of quirks. The machine AI can get this 99% perfect if the following is true:
That's the only thing missing from this equation right now.
What you should know is that I have an entire feedback loop so the AI can get the calculations to as close to ideal within the constraints as we want. The AI jargon term is "auto research" and if you look at the FastLED repo I have implemented this AI pattern directly into the project.
Infact, this is how I'm programming drivers now for LEDs.
I'd like to apply "auto research" and harden your algorithm by throwing it "into battle" on RGBW strips.
There's two options I'd like you to consider, either is fine.
If you choose (2) here's how it benefits you:
What this auto research work flow would look is this:
Like I said, I'm perfectly happy to do all of this. This is just me the opportunity to level you up like you've level this project up.
You don't have to make a decision right away, just think about it and let me know at your convenience. I'll make sure to put attribution to your satisfaction so that everyone knows that the color correction came from your efforts and all credit goes to you.
zackees commentedon Jun 18, 2026
Follow-up tracking has been split out into #3231.
That new meta issue covers the remaining post-#2752 work from this thread:
h315_s015_v100, where output appears scaled from white-extraction split energy rather than the actual input endpoint/value.colorimetric_responseplumbing and an opt-in RGB colorimetric path, while keeping RGB/RGBW behavior gated and discrete-form friendly.The original #2748 items fixed by #2749 and #2752 can stay documented here; the remaining work should continue in #3231.
JChalka commentedon Jun 18, 2026
Bit of an update, Phase 1 is essentially almost complete. I'm waiting on a final verification pass to finish up on that and then I'll be moving onto phase 2 (aka the shared-function split to colorimetric_response)
phase 3 has slightly shifted in scope as technically the current RGBCCT/W+W implementation within FastLED is an overdrive model, not a strict sub-gamut solve. so I'm going to go ahead and make sure that phase 3 also lands the RGBCCT efficient strict sub-gamut model.
The RGBCCT/W+W strict sub-gamut solve does have a bit of ambiguity where one side of the triangle doesn't contain obvious efficient solves. in a cool white + warm white setup this ends up being the RB side of the triangle where there is an overlap between RB+WW & RB+CW where either solve could be valid, the GR & GB sides are where the Warm White & Cool White diodes lean towards so there is an obvious efficient inner-emitter solve and it doesn't have the same ambiguity/overlap. There's a few directions I've laid out for how this could be looked at but I still need to work out which path would essentially be "most efficient", ideally the boundary for RB+WW or RB+CW would be a cached decision so that way there's no added runtime complexity between strict sub-gamut RGBW and strict sub-gamut RGBCCT/W+W, I may need to actually get some of these WS2805 RGBCCT strips to actually verify some of these CCT models against. Even if we can mathematically come up with an efficient boundary approach we don't want the brightness/ Y/nits to shift dramatically across the boundary and produce odd results. RGBCCT is essentially experimental until it can be physically verified against, even if the may be math sound.
I did recently order a spectrophotometer to play around with so I'll be able to build a spectral correction matrix for my colorimeter soon and we should be able to parse some more accurate xyY & dE checks and see how the wall is actually influencing the LED output/reflection. This is especially useful for profiling different chipset/led types and should help keep measured xyY more accurate. Doesn't mean much for the algorithm itself but this does make verification dE/dY checks more sane in that the measured data should be much more accurate after the spectral correction.
still have ~1000 patches left to check on phase 1 and then I might finish up phase 2/3 today or tomorrow. Phase 3 is split between RGB & RGBCCT so the RGB-only (and RGB within RGBW strip solve by extension for compatibility, aka RGB only solve but output to RGBW strip) path will almost certainly land first (without the final FastLED hook-in, as that point still needs to be determined) with the RGBCCT path landing a bit later due to it being a bit more nuanced.
As far as the RGB solve entrypoint goes this is a bit of an interesting one as the RGB pipeline within FastLED is different depending on the chipset/end device. The colorimetric solve essentially resembles a 3DLUT in that once values pass through the colorimetric solve they cannot be mutated/manipulated. This means any gamma correction or power scaling needs to happen before it enters the colorimetric path, and we don't want any other color tempearture settings or such manipulating the pre-solved values (gamma correction before Solve is the correct way to handle Gamma/Transfer curve, along with power management work). Once the colorimetric path has solved its values they cannot be changed for any reason whatsoever; doing so would mean the post-solve mutated values are no longer "correct" and should shift their chromaticity. So the RGB solve entrypoint within the FastLED RGB-Only pipeline needs to be in a spot where it can output to all available chipsets but have any power scaling or gamma/transfer application made before the solve.
zackees commentedon Jun 18, 2026
Split out the shared colorimetric response layer + RGB colorimetric entrypoint design into #3242 so this can be planned independently from the remaining RGBW endpoint-scaling/verifier work.
zackees commentedon Jun 28, 2026
@JChalka Thank you, sonia, for originating the RGBW colorimetric work and for the math-model discussion, verifier material, and roadmap that shaped this implementation.
I pushed the current profile-backed API in draft PR #3435. The full sketch is here:
https://github.com/FastLED/FastLED/blob/codex/rgbw-colorimetric-codec/examples/RGBWColorimetric/RGBWColorimetric.ino
Inline example of the new API shape:
The key part is that the measured profile lives with the
fl::Rgbwconfig viafl::shared_ptr<const fl::color::DiodeProfile>, so users can enable the colorimetric path with.setRgbw(rgbw)without managing a raw profile pointer.zackees commentedon Jun 28, 2026
Closing after pushing the current RGBW colorimetric codec/profile API and example in draft PR #3435: #3435