Skip to content

Commit a6ce9e1

Browse files
mrdoobclaude
andcommitted
Examples: Clamp smooth intensity in Sculpt addon.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 7a30d77 commit a6ce9e1

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

examples/jsm/sculpt/SculptTools.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,7 @@ function smoothTangentVerts( mesh, iVerts, intensity ) {
461461
const i3 = i * 3;
462462
const smx = smoothVerts[ i3 ], smy = smoothVerts[ i3 + 1 ], smz = smoothVerts[ i3 + 2 ];
463463
const d = nx * ( smx - vx ) + ny * ( smy - vy ) + nz * ( smz - vz );
464-
const mI = intensity * mAr[ ind + 2 ];
464+
const mI = Math.min( intensity * mAr[ ind + 2 ], 1.0 );
465465
vAr[ ind ] = vx + ( smx - nx * d - vx ) * mI;
466466
vAr[ ind + 1 ] = vy + ( smy - ny * d - vy ) * mI;
467467
vAr[ ind + 2 ] = vz + ( smz - nz * d - vz ) * mI;
@@ -617,7 +617,7 @@ function toolSmooth( mesh, iVerts, intensity ) {
617617

618618
// Taubin lambda-mu smoothing: two-pass to preserve volume
619619
// Lambda pass (shrink toward centroid)
620-
const lambda = intensity;
620+
const lambda = Math.min( intensity, 1.0 );
621621
laplacianSmooth( mesh, iVerts, smoothVerts );
622622
for ( let i = 0; i < nbVerts; ++ i ) {
623623

@@ -632,7 +632,7 @@ function toolSmooth( mesh, iVerts, intensity ) {
632632
}
633633

634634
// Mu pass (inflate back to preserve volume)
635-
const mu = - intensity * 1.06;
635+
const mu = - lambda * 1.06;
636636
laplacianSmooth( mesh, iVerts, smoothVerts );
637637
for ( let i = 0; i < nbVerts; ++ i ) {
638638

0 commit comments

Comments
 (0)