mirror of
https://github.com/obsproject/obs-studio.git
synced 2026-05-11 16:59:43 -04:00
nv-filters: Set max effective threshold to 0.95 for Background removal
The threshold THR in Background removal filter has the following effect: - if alpha if between [THR - 0.1; THR], alpha is interpolated; - if alpha >= THR, alpha is set to 1.0; - if alpha <= THR - 0.1, alpha is set to 0. It was introduced in order to smooth the alpha at the edges of the foreground. This works fine unless THR == 1, where there can be bulk pixels with alpha which will be interpolated as if they were at the edge; in order to ensure that a bulk area with alpha set to 1.0 is well defined, the max threshold is now set to 0.95 (so if the user picks a unity threshold, a value of 0.95 will actually be used). This fixes a bug in third party plugins which rely on a bulk foreground safely set at alpha == 1.0. [1] [1] https://github.com/FiniteSingularity/obs-stroke-glow-shadow/issues/61 Signed-off-by: pkv <pkv@obsproject.com>
This commit is contained in:
@@ -834,7 +834,7 @@ static void draw_greenscreen_blur(struct nvvfx_data *filter, bool has_blur)
|
||||
gs_effect_set_texture_srgb(filter->blur_param, filter->blur_texture);
|
||||
} else {
|
||||
gs_effect_set_texture(filter->mask_param, filter->alpha_texture);
|
||||
gs_effect_set_float(filter->threshold_param, filter->threshold);
|
||||
gs_effect_set_float(filter->threshold_param, min(filter->threshold, 0.95f));
|
||||
}
|
||||
gs_effect_set_texture_srgb(filter->image_param, gs_texrender_get_texture(filter->render));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user