Repository navigation
Description
Summary
The Fade to Color transition's "Peak Color Point" slider allows 0 and 100, but at either end the audio gain computes 0/0 and returns NaN. The NaN is multiplied into the program audio mix, so program audio can drop out or distort at the start (0%) or end (100%) of the transition. Severity: medium. It only affects those two slider values, but a NaN in the audio mix spoils everything downstream of it.
Steps / trigger
- Add a Fade to Color transition and set "Peak Color Point" to 0 (or to 100).
- Switch scenes with that transition while audio is playing.
- The first samples of the transition (at 0%) or the last samples (at 100%) are mixed with a NaN gain. Anything downstream of the mix, such as meters, filters and encoders, sees NaN samples.
Cause
Line numbers are against current master.
plugins/obs-transitions/transition-fade-to-color.c:172: the slider range is0, 100, and:52-59turns it intoswitch_pointin[0, 1].plugins/obs-transitions/transition-fade-to-color.c:36-40:smoothstep(min, max, x)computes(x - min) / (max - min)with no check formin == max. At a switch point of 0 it issmoothstep(0, 0, t), and at 100 it issmoothstep(1, 1, t). Atx == minthis is0/0 = NaN, andclamppasses NaN through because both comparisons are false.plugins/obs-transitions/transition-fade-to-color.c:143-149,:151-157:mix_ais NaN att == 0for a 0% switch point, andmix_bis NaN att == 1for 100%.libobs/obs-source-transition.c:869:out[i] += in[i] * mix(...)addsin[i] * NaNinto the mix. Even a silent input (0 * NaN) gives NaN.libobs/obs-source-transition.c:446-462:calc_timereturns exactly0.0fbefore the transition starts and1.0fonce it has ended, so those exact values occur on real audio samples.
The plugin is C only, so ON and OFF behave the same. The test I wrote does not measure how long the audible dropout lasts. It checks the gain and the summed sample values.
Proposed fix
Guard the equal-edge case in smoothstep: when min == max, return x >= max ? 1.0f : 0.0f. That is a finite step at the collapsed edge. The unequal-edge arithmetic is unchanged. The regression test configures the real plugin through its update callback and checks both gain callbacks at switch points 0, 50 and 100 for finite values, the expected curve at times 0, 0.25, 0.5, 0.75 and 1, and a finite, non-silent sum.
I'd like to work on this; a fix with a regression test is ready.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
zackees commentedon Oct 13, 2026
@chriscoveries go ahead: please open the PR with the RED test commit first, then the fix (one PR per issue, targeting master). Marking it claimed for you so nobody duplicates it.
chriscoveries commentedon Oct 14, 2026
Releasing this one. We're backed up on CI and won't get it landed soon, so anyone who wants it is welcome to take it.
If it helps, our RED test and fix are on the fork branch
fix/fade-to-color-switch-point-edges. They passed review on our side but haven't been through CI, so reuse them or start fresh, whichever you prefer.zackees commentedon Oct 14, 2026
Claiming.
test: Fade to Color gains are NaN at 0% and 100% switch points (RED)
obs-transitions: Treat a zero-width smoothstep as a step (GREEN)
obs-transitions: Fade to Color switch point 0%/100% no longer yields …