Skip to content

Commit bbf1800

Browse files
mrdoobclaude
andcommitted
Examples: Use Wendland C2 falloff for sculpt brushes.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 869d592 commit bbf1800

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

examples/jsm/sculpt/SculptTools.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -656,8 +656,7 @@ function decimationPass( mesh, iTris, center, radius2, detail2 ) {
656656
else if ( fallOff < radius2 * 2.0 ) {
657657

658658
fallOff = ( Math.sqrt( fallOff ) - radius ) / ( radius * Math.SQRT2 - radius );
659-
const f2 = fallOff * fallOff;
660-
fallOff = 3.0 * f2 * f2 - 4.0 * f2 * fallOff + 1.0;
659+
fallOff = falloff( fallOff );
661660

662661
} else continue;
663662

examples/jsm/sculpt/SculptUtils.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,8 +214,10 @@ function pointInsideTriangle( point, v1, v2, v3 ) {
214214

215215
function falloff( dist ) {
216216

217-
const d2 = dist * dist;
218-
return 3.0 * d2 * d2 - 4.0 * d2 * dist + 1.0;
217+
// Wendland C2 kernel: (1-d)^4 * (4d+1)
218+
const t = 1.0 - dist;
219+
const t2 = t * t;
220+
return t2 * t2 * ( 4.0 * dist + 1.0 );
219221

220222
}
221223

0 commit comments

Comments
 (0)