Commit 8bf8248
authored
Fix the coat darkening color shift (#253)
For reference, the issue with the coat darkening was a color shift that can happen in the presence of a strong coat color.
I came up with a restatement of how the coat darkening operates, which should ensure there is no color (i.e. chromaticity) shift between the darkened and "un-darkened" results.
The resulting approximation corresponds simply to dividing the darkening factor by its luminance (in the undarkened case) which was arranged by design, but at least it follows from some reasonably logical definitions. (Actually I think it makes a bit more sense now, since we don't ignore the absorption color of the coat, and are more explicit about how this all works in RGB).
In code this amounts to:
```C
RGB base_darkening = Lerp(coat_weight, RGB_WHITE, Delta * Lerp(coat_darkening, 1.f/Luminance(Delta), 1.f));
```
where `Delta` is the darkening factor formula given in the spec. Then this `base_darkening` is multiplied into the base lobe.1 parent 120e3b5 commit 8bf8248
3 files changed
Lines changed: 81 additions & 1320 deletions
0 commit comments