glsl-blend icon indicating copy to clipboard operation
glsl-blend copied to clipboard

Subtract mode error

Open xiaozhuai opened this issue 2 years ago • 0 comments

Subtract is not as same as LinearBurn

Subtract should be

float blendSubtract(float base, float blend) {
    return max(base-blend, 0.0);
}

vec3 blendSubtract(vec3 base, vec3 blend) {
    return max(base-blend, vec3(0.0));
}

vec3 blendSubtract(vec3 base, vec3 blend, float opacity) {
	return (blendSubtract(base, blend) * opacity + base * (1.0 - opacity));
}

xiaozhuai avatar Jul 19 '22 12:07 xiaozhuai