mirror of
https://github.com/CNCKitchen/stlTexturizer.git
synced 2026-04-07 22:11:32 +00:00
fix(preview): set boundary falloff to 0 at boundary vertices
Boundary vertices (shared between masked and unmasked faces) were skipped during falloff computation, keeping their falloffAttr at 1.0. This created a ring of full-intensity texture at the mask border before the falloff gradient started. Now these vertices correctly get factor 0 (distance to boundary = 0), matching the export behavior.
This commit is contained in:
+4
-1
@@ -1649,7 +1649,10 @@ function computeBoundaryFalloffAttr(geometry, userMaskArr) {
|
||||
for (const [k, pos] of posFromKey) {
|
||||
const mf = maskFracMap.get(k);
|
||||
const frac = mf[1] > 0 ? mf[0] / mf[1] : 0;
|
||||
if (frac > 0) continue; // masked or boundary vertex — keep 1.0 (mask handles it)
|
||||
if (frac >= 1) continue; // fully masked vertex — keep 1.0 (mask zeroes it anyway)
|
||||
// Boundary vertices (shared between masked and unmasked faces) are AT
|
||||
// the boundary → distance 0 → falloff factor 0.
|
||||
if (frac > 0) { falloffCache.set(k, 0); continue; }
|
||||
|
||||
const px = pos[0], py = pos[1], pz = pos[2];
|
||||
const cix = Math.max(0, Math.min(gRes - 1, Math.floor((px - gMinX) / gDx)));
|
||||
|
||||
Reference in New Issue
Block a user