mirror of
https://github.com/storytold/effectcraft.git
synced 2026-10-31 13:37:37 -06:00
fix(effects): clear Cut Away 100 opaque edges
The gradient antialias could leave a half-covered pixel where an opaque source reaches h = 1. Add an endpoint guard on CPU and GPU and cover an opaque edge in the regression test.
This commit is contained in:
@@ -582,6 +582,12 @@ fn ftr_blob(@builtin(global_invocation_id) gid: vec3<u32>) {
|
||||
return;
|
||||
}
|
||||
let cut = P.f[0].x;
|
||||
if (cut >= 1.0) {
|
||||
// Endpoint guard: an opaque source can reach h = 1.0, where the gradient antialias
|
||||
// would otherwise leave a half-covered pixel at Cut Away 100.
|
||||
textureStore(out, p, vec4<f32>(0.0));
|
||||
return;
|
||||
}
|
||||
let hv = textureLoad(aux, p, 0).x;
|
||||
let g = ftr_grad(p);
|
||||
let grad = length(g);
|
||||
|
||||
@@ -126,6 +126,7 @@ fn distort() {
|
||||
"ec.distort.ccblobbylize",
|
||||
&[("property", e(4)), ("softness", n(3.0)), ("cutAway", n(30.0)), ("lightType", e(1)), ("lightPosition", pt(20.0, 10.0))],
|
||||
);
|
||||
effect_case("ec.distort.ccblobbylize", &[("cutAway", n(100.0))]);
|
||||
effect_case("ec.distort.ccblobbylize", &[("property", e(5)), ("metal", n(30.0)), ("roughness", n(0.2))]);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user