From 8f7ce62b5de450e8bafafa53cb908c9b8d1d9840 Mon Sep 17 00:00:00 2001 From: Orion Reed Date: Sun, 1 Dec 2024 20:38:09 -0500 Subject: [PATCH] fix corner bug --- src/distance-field.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/distance-field.ts b/src/distance-field.ts index f46f1b8..32b71b9 100644 --- a/src/distance-field.ts +++ b/src/distance-field.ts @@ -138,6 +138,10 @@ export class DistanceField extends HTMLElement { vec4 sampled = texture(u_previousTexture, sampleCoord); + if (sampled.z == 0.0) { + continue; // Skip background pixels + } + // Compute distance to the seed point stored in this neighbor float dist = distance(sampled.xy, v_texCoord);