diff --git a/README.md b/README.md
index db3530e..a594e00 100644
--- a/README.md
+++ b/README.md
@@ -495,8 +495,9 @@ your drag, and the surface updates when you release.
Select a visible, unlocked part and choose **Sculpt**. Draw builds or removes material, Clay
Buildup layers broad strokes, and Inflate/Deflate changes the volume of rounded details. Grab
-moves a patch, Crease sharpens a groove or ridge, and Smooth and Flatten clean up the surface.
-The brush adds mesh detail locally as needed. Adjust **Detail** to change the density.
+moves a patch, Crease carves a groove, Ridge raises and pinches an edge, and Smooth and Flatten
+clean up the surface. The brush adds mesh detail locally as needed. Adjust **Detail** to change
+the density.
- Hold **Alt** to invert an applicable brush and **Shift** for temporary smoothing.
- Use **Mask** to protect areas. Hold **Alt** to erase protection or **Shift** to soften it.
diff --git a/src/components/SculptControls.tsx b/src/components/SculptControls.tsx
index 4ae2ab4..08475c7 100644
--- a/src/components/SculptControls.tsx
+++ b/src/components/SculptControls.tsx
@@ -10,6 +10,7 @@ const brushes: Record = {
smooth: 'Smooth',
flatten: 'Flatten',
crease: 'Crease',
+ ridge: 'Ridge',
clay: 'Clay Buildup',
inflate: 'Inflate/Deflate',
mask: 'Mask',
@@ -106,7 +107,9 @@ export function SculptControls() {
{brush === 'mask'
? 'Drag to paint protection. Hold Alt to erase or Shift to soften.'
: 'Drag on the part to sculpt. Hold Shift to smooth.'}
- {['draw', 'crease', 'clay', 'inflate'].includes(brush) ? ' Hold Alt to invert.' : ''}
+ {['draw', 'crease', 'ridge', 'clay', 'inflate'].includes(brush)
+ ? ' Hold Alt to invert.'
+ : ''}
@@ -256,7 +259,7 @@ export function SculptControls() {
)}
>
)}
- {brush === 'crease' && (
+ {(brush === 'crease' || brush === 'ridge') && (
0)) return;
const radius = s.radius * (s.pressureRadius ? Math.max(0.08, p) : 1);
let angle = footprint(s, sample);
- if (brush === 'crease' && active.applied) {
+ if ((brush === 'crease' || brush === 'ridge') && active.applied) {
const dx = sample.clientX - active.applied.clientX;
const dy = active.applied.clientY - sample.clientY;
if (dx || dy) angle = Math.atan2(dy, dx);
diff --git a/src/core/sculpt-mesh.ts b/src/core/sculpt-mesh.ts
index 575188a..fba859c 100644
--- a/src/core/sculpt-mesh.ts
+++ b/src/core/sculpt-mesh.ts
@@ -1029,13 +1029,15 @@ export class SculptMesh {
.clone()
.multiplyScalar(sign * Math.min(layer, settings.radius * 0.22) * strength);
}
- case 'crease': {
+ case 'crease':
+ case 'ridge': {
const toward = new Vector3().subVectors(hit.point, point);
toward.addScaledVector(normal, -toward.dot(normal));
if (hit.tangent) toward.addScaledVector(footprint.tangent, -toward.dot(footprint.tangent));
+ const direction = settings.brush === 'ridge' ? sign : -sign;
return toward
.multiplyScalar(MathUtils.clamp(settings.pinch ?? 0.5, 0, 1) * strength * 0.4)
- .addScaledVector(normal, -sign * depth * 0.22);
+ .addScaledVector(normal, direction * depth * 0.22);
}
case 'smooth': {
const neighbors = this.neighborsOf(weld, footprint);
diff --git a/src/core/types.ts b/src/core/types.ts
index 995a635..c5b79c2 100644
--- a/src/core/types.ts
+++ b/src/core/types.ts
@@ -20,7 +20,7 @@ export type Tool =
| 'sculpt';
export type SculptBrush =
- 'draw' | 'grab' | 'smooth' | 'flatten' | 'crease' | 'clay' | 'inflate' | 'mask';
+ 'draw' | 'grab' | 'smooth' | 'flatten' | 'crease' | 'ridge' | 'clay' | 'inflate' | 'mask';
export interface SculptureSettings {
brush: SculptBrush;
diff --git a/src/docs/assembly-guides.ts b/src/docs/assembly-guides.ts
index ebfba73..650c492 100644
--- a/src/docs/assembly-guides.ts
+++ b/src/docs/assembly-guides.ts
@@ -373,7 +373,7 @@ export const assemblyGuides: DocArticle[] = [
id: 'brushes',
title: 'Choose a brush',
paragraphs: [
- 'To change the outline, use Grab. To build or cut relief, try Draw, Clay Buildup, Crease or Inflate/Deflate. Use Smooth for ripples, Flatten for a level patch, and Mask to protect a detail. Each example shows the same view before and after the stroke.',
+ 'To change the outline, use Grab. To build or cut relief, try Draw, Clay Buildup, Crease, Ridge or Inflate/Deflate. Use Smooth for ripples, Flatten for a level patch, and Mask to protect a detail. Each illustrated example shows the same view before and after the stroke.',
],
},
{
@@ -455,6 +455,13 @@ export const assemblyGuides: DocArticle[] = [
caption: 'The surface draws inward along the stroke.',
},
},
+ {
+ id: 'ridge',
+ title: 'Ridge',
+ paragraphs: [
+ 'Drag along an outer edge or where you want to raise a ridge. Increase Pinch to draw the surface closer to the stroke. Hold Alt to carve a groove.',
+ ],
+ },
{
id: 'clay',
title: 'Clay Buildup',
diff --git a/tests/e2e/sculpt.spec.ts b/tests/e2e/sculpt.spec.ts
index 3744d77..c0c72e9 100644
--- a/tests/e2e/sculpt.spec.ts
+++ b/tests/e2e/sculpt.spec.ts
@@ -733,6 +733,47 @@ test('mask paint subdivides without displacement and restores weights with undo
expect(await weights()).toEqual(protection);
});
+test('raises a ridge with a stroke and carves a groove with Alt', async ({ page }) => {
+ await openSculpt(page, {
+ ...block,
+ parts: [
+ {
+ ...block.parts[0],
+ geometry: serializeGeometry(new PlaneGeometry(8, 6, 40, 30).translate(0, 0, 2)),
+ },
+ ],
+ });
+ const ridge = page.getByRole('button', { name: 'Ridge', exact: true });
+ await ridge.click();
+ await expect(ridge).toHaveAttribute('aria-pressed', 'true');
+ await page.getByText('Advanced brush settings', { exact: true }).click();
+ await expect(page.getByRole('spinbutton', { name: 'Pinch' })).toHaveValue('0.5');
+
+ const before = await mesh(page);
+ const start = await screen(page, [-1, 0, 2]);
+ const end = await screen(page, [1, 0, 2]);
+ const drag = async () => {
+ await page.mouse.move(start.x, start.y);
+ await page.mouse.down();
+ await page.mouse.move(end.x, end.y, { steps: 8 });
+ await page.mouse.up();
+ };
+ await drag();
+ await expect.poll(async () => (await mesh(page)).peak).toBeGreaterThan(before.peak + 0.01);
+ await page.keyboard.press('ControlOrMeta+z');
+ await expect.poll(() => mesh(page)).toEqual(before);
+
+ await page.keyboard.down('Alt');
+ try {
+ await drag();
+ } finally {
+ await page.keyboard.up('Alt');
+ }
+ await expect
+ .poll(async () => (await mesh(page)).positions.some((z, i) => i % 3 === 2 && z < 1.99))
+ .toBe(true);
+});
+
test('applies Clay Buildup and Inflate and keeps their falloff settings independent', async ({
page,
}) => {
diff --git a/tests/unit/sculpt-mesh.test.ts b/tests/unit/sculpt-mesh.test.ts
index c20659c..013af47 100644
--- a/tests/unit/sculpt-mesh.test.ts
+++ b/tests/unit/sculpt-mesh.test.ts
@@ -271,24 +271,27 @@ describe('sculpt mesh', () => {
expect(paint.getMask()).toHaveLength(painted.getAttribute('position').count);
});
- it('cuts a pinched groove and uses inverted depth for a pinched ridge', () => {
+ it('pinches Crease and Ridge in opposite depth directions and inverts each brush', () => {
const source = mesh([0, 0, 0, 0.5, 0, 0, 0, 0.5, 0], [0, 1, 2]);
const settings = dab(new Vector3(), {
- brush: 'crease',
pinch: 1,
tangent: new Vector3(0, 1, 0),
minEdge: 100,
});
- const groove = new SculptMesh(source, identity);
- const ridge = new SculptMesh(source, identity);
- expect(groove.dab(settings)).toBe(true);
- expect(ridge.dab({ ...settings, inverted: true })).toBe(true);
- const cut = groove.finish()!.getAttribute('position');
- const raised = ridge.finish()!.getAttribute('position');
- expect(cut.getX(1)).toBeLessThan(0.5);
- expect(raised.getX(1)).toBe(cut.getX(1));
- expect(cut.getZ(0)).toBeLessThan(0);
- expect(raised.getZ(0)).toBe(-cut.getZ(0));
+ const positions = (brush: 'crease' | 'ridge', inverted = false) => {
+ const draft = new SculptMesh(source, identity);
+ expect(draft.dab({ ...settings, brush, inverted })).toBe(true);
+ return draft.finish()!.getAttribute('position');
+ };
+
+ const groove = positions('crease');
+ const ridge = positions('ridge');
+ expect(groove.getX(1)).toBeLessThan(0.5);
+ expect(ridge.getX(1)).toBe(groove.getX(1));
+ expect(groove.getZ(0)).toBeLessThan(0);
+ expect(ridge.getZ(0)).toBe(-groove.getZ(0));
+ expect(ridge.array).toEqual(positions('crease', true).array);
+ expect(groove.array).toEqual(positions('ridge', true).array);
});
it('builds clay toward a surface plane and inflates using an individual vertex normal', () => {