Skip to content

Commit 2b63ffe

Browse files
committed
fix: adjust blob border inset delay
1 parent 6655940 commit 2b63ffe

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

plugin/src/Caelestia/Blobs/shaders/blob.frag

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,8 +197,13 @@ void main() {
197197
// Screen-space center (with offset) and pre-computed AABB half-extents
198198
vec2 ctr = rect.xy + sinkProps.yz;
199199

200-
// Delay sink to absorb smin blend depth (circular smin max = (sqrt(2)-1)*k)
201-
float preOff = smoothFactor * (sqrt(2.0) - 1.0);
200+
// Sink onset / residual overlap: how far a rect must penetrate the border before
201+
// the inner wall recedes to form its pocket. Too low and the wall recedes faster
202+
// than the junction can stay convex, denting the inner edge inward near the rect's
203+
// (squared) corners; too high and the rect nestles too deep before the wall yields.
204+
// Tuned between the old cubic blend depth (k/6, too shallow) and the circular blend
205+
// depth ((sqrt2-1)k): half the circular smin gap-closing distance, (2-sqrt2)k/2.
206+
float preOff = smoothFactor * (2.0 - sqrt(2.0)) * 0.5;
202207

203208
// Top border: track rect's BOTTOM edge, only within border thickness
204209
float topPen = clamp(innerTop - (ctr.y + sinkSh.y) - preOff, 0.0, innerTop - outerTop);

0 commit comments

Comments
 (0)