Skip to content

Free, open-source 3D sculpting for Linux, macOS and Windows: dense meshes, remeshing, painting, built-in AI (image/text to 3D), Send to Unreal, game-ready LODs, Gaussian splats and OpenUSD.

ZBrush feel: U/I/O sliders, Space QuickMenu, Smooth's own Z Intensity, RGB Intensity, Focal Shift, ZBrush brush letters, mask and Ctrl+W keys, Ctrl+click blur/sharpen, straight Shift strokes, roll, ZBrush/SculptForge input styles

islandmed6044ffb181e8
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 17462518..7e0e1d5a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -190,6 +190,7 @@ if(SCULPTFORGE_BUILD_APP)
src/app/PanelProject.cpp
src/app/PanelSubTools.cpp
src/app/Tablet.cpp
+ src/app/Input.cpp
src/render/GL.cpp
src/render/Camera.cpp
src/render/Clusters.cpp
diff --git a/docs/guide/shortcuts.md b/docs/guide/shortcuts.md
index 6169856d..d542f0c4 100644
--- a/docs/guide/shortcuts.md
+++ b/docs/guide/shortcuts.md
@@ -24,33 +24,26 @@ action registry, the same source as the Controls window.
| Action | Keys | What it does |
|---|---|---|
| Brush picker | <kbd>B</kbd> | Pop up every brush under the cursor. Type the first letter of a brush, then the orange letter on its tile (B S T = Standard). |
-| Clay | <kbd>2</kbd> | Builds up clay that fills the hollows first. |
-| ClayBuildup | <kbd>0</kbd> | Square, flat-topped clay strokes for blocking in forms. |
-| Crease | <kbd>6</kbd> | Cuts a sharp crease; Alt raises a ridge. |
-| DamStandard | <kbd>9</kbd> | A sharp V-shaped crease with the sides pinched in (ZBrush DamStandard). |
-| Flatten | <kbd>7</kbd> | Presses the surface toward a plane. |
-| Inflate | <kbd>5</kbd> | Swells the surface outward along its normals. |
-| Move | <kbd>4</kbd> | Grabs the surface under the cursor and pulls it along. |
| Paste brush | <kbd>Ctrl</kbd>+<kbd>V</kbd> | Add the brush on the clipboard: a brush code someone shared, or the text of a .sfbrush file. |
-| Pinch | <kbd>8</kbd> | Pulls the surface toward the stroke to tighten edges. |
-| Smooth | <kbd>3</kbd> | Relaxes the surface. Hold Shift to smooth with any brush. |
-| Standard | <kbd>1</kbd> | Raises the surface along the stroke; Alt digs in. |
### Color
| Action | Keys | What it does |
|---|---|---|
| Pick colour | <kbd>C</kbd> | Take the paint colour from the model under the cursor. |
+| Switch Color | <kbd>V</kbd> | Swap the main and the secondary colour. |
### Draw
| Action | Keys | What it does |
|---|---|---|
| Draw Size at cursor | <kbd>S</kbd> | A Draw Size slider under the cursor: drag it, or type a number and press Enter. |
+| Focal Shift at cursor | <kbd>O</kbd> | A Focal Shift slider under the cursor: below 0 a broad, hard brush tip, above 0 a soft point (-100..100). The inner ring of the brush cursor shows it. |
| Larger brush | <kbd>]</kbd> | Make the brush 10% larger (hold to repeat). |
| Paint | <kbd>P</kbd> | Paint colour without sculpting (ZBrush Rgb on, Zadd off). Alt paints back to white, Shift still smooths. |
+| RGB Intensity at cursor | <kbd>I</kbd> | An RGB Intensity slider under the cursor: how strongly painting colours the surface (1-100). |
| Smaller brush | <kbd>[</kbd> | Make the brush 10% smaller (hold to repeat). |
-| Strength at cursor | <kbd>I</kbd> | A Strength slider under the cursor: drag it, or type a number and press Enter. |
+| Z Intensity at cursor | <kbd>U</kbd> | A Z Intensity slider under the cursor: drag it, or type a number (1-100) and press Enter. Hold Shift (or pick Smooth) to set Smooth's own Z Intensity. |
### Edit
@@ -77,6 +70,7 @@ action registry, the same source as the Controls window.
|---|---|---|
| Command palette | <kbd>F3</kbd> or <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>P</kbd> | Search every command, brush and setting by name and run it. Commands that need parameters open in the console. |
| Controls | <kbd>F1</kbd> | Every shortcut and mouse gesture, generated from the commands themselves. |
+| QuickMenu | <kbd>Space</kbd> | ZBrush's QuickMenu under the cursor: brush, stroke, alpha, material, colour, Draw Size, Focal Shift and the intensities. Hold Space and let go to close it, or tap Space to keep it open. |
| User Guide | <kbd>Shift</kbd>+<kbd>F1</kbd> | The SculptForge user guide: every tool explained, with search. Hold Ctrl over a control and press F1 to open the chapter about it. |
### LightBox
@@ -96,6 +90,7 @@ action registry, the same source as the Controls window.
| Action | Keys | What it does |
|---|---|---|
| Load UI... | <kbd>Ctrl</kbd>+<kbd>L</kbd> | Load a layout file someone shared (or you saved with Save UI). |
+| Save UI... | <kbd>Ctrl</kbd>+<kbd>Alt</kbd>+<kbd>Shift</kbd>+<kbd>I</kbd> | Save the layout, shortcuts and interface preferences to a file you can share. |
| Shelves | <kbd>Tab</kbd> | Hide or show the shelves and trays around the canvas. |
| Store Config | <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>I</kbd> | Keep the current layout, shortcuts and interface preferences for future sessions. Like ZBrush, SculptForge never saves them on its own. |
@@ -104,6 +99,7 @@ action registry, the same source as the Controls window.
| Action | Keys | What it does |
|---|---|---|
| Fullscreen | <kbd>F11</kbd> | Fill the screen with SculptForge (again: back to a window). |
+| Mask | <kbd>Ctrl</kbd>+<kbd>H</kbd> | Darken masked areas. |
| Wireframe | <kbd>Shift</kbd>+<kbd>F</kbd> | Show the mesh's polygons (quads and triangles) over the surface (ZBrush PolyFrame). |
### Script
@@ -112,13 +108,23 @@ action registry, the same source as the Controls window.
|---|---|---|
| Console | <kbd>`</kbd> | The script console: every command you run appears as a script line, and you can type commands yourself. |
+### Stroke
+
+| Action | Keys | What it does |
+|---|---|---|
+| LazyMouse | <kbd>L</kbd> | LazyMouse on or off: the brush trails the cursor on a string, for steady lines. |
+
### Tool
| Action | Keys | What it does |
|---|---|---|
+| Clear Mask | <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>A</kbd> | Unmask everything (also: Ctrl+drag on the background). |
| Divide | <kbd>Ctrl</kbd>+<kbd>D</kbd> | Add a subdivision level: four times the polygons, and the lower levels are kept, so you can step down to shape big forms and back up to the detail. Quads stay quads (Catmull-Clark). Smt off divides without smoothing. |
+| Group Masked | <kbd>Ctrl</kbd>+<kbd>W</kbd> | Turn the masked part into a new polygroup and clear the mask (ZBrush Ctrl+W). With nothing masked, everything visible becomes one group. |
| Higher Res | <kbd>D</kbd> | Step one subdivision level up (more polygons, for detail). Edits made below carry the detail along. |
+| Invert Mask | <kbd>Ctrl</kbd>+<kbd>I</kbd> | Mask what is unmasked and unmask what is masked (also: Ctrl+click the background). |
| Lower Res | <kbd>Shift</kbd>+<kbd>D</kbd> | Step one subdivision level down (fewer polygons, for big forms). The detail of the higher levels is kept. |
+| Mask All | <kbd>Ctrl</kbd>+<kbd>A</kbd> | Mask the whole visible SubTool. |
### Transform
diff --git a/docs/zbrush-parity.md b/docs/zbrush-parity.md
new file mode 100644
index 00000000..1cb5ca69
--- /dev/null
+++ b/docs/zbrush-parity.md
@@ -0,0 +1,130 @@
+# ZBrush parity audit
+
+What a ZBrush sculptor does without thinking in the first hour, what SculptForge does, and how big the gap is.
+Written for the v0.7 "ZBrush feel" pass (branch feat/zfeel, 2026-10-24) after a working ZBrush modeler tried
+v0.2 and uninstalled it because it "didn't feel like ZBrush".
+
+**Gap**: none / small (works, but differently enough to notice) / big (missing, or the hands do the wrong thing).
+**Priority**: P1 trips a ZBrush user in the first hour, P2 noticed within a day, P3 nice to have.
+**Status** is what the v0.7 pass did about it (*fixed*, *kept* = deliberately different, *open*).
+
+ZBrush behaviour is checked against Maxon's official shortcut sheet [1] and the ZBrush documentation [2-5];
+rows marked † come from ZBrush practice and community references [6] where Maxon's sheet is silent, and should
+be confirmed by a ZBrush user.
+
+## Navigation (Edit mode, a 3D mesh)
+
+| ZBrush | SculptForge before v0.7 | Gap | Pri | Status |
+|---|---|---|---|---|
+| Drag on the background: free rotate [1 §3] | Same (free rotation is the default since v0.3, Turntable is a preference) | none | – | – |
+| Alt+drag on the background: move (pan) [1 §3] | Same | none | – | – |
+| Alt+click, release Alt, drag: scale (zoom) [1 §3] | Same | none | – | – |
+| Shift pressed during a rotation: snap to 90 degree views [1 §3] | Same | none | – | – |
+| Shift+click, release Shift, drag: rotate around the view axis (Z) [1 §3] | Shift+drag snapped; releasing Shift before moving just orbited | big | P2 | fixed: roll |
+| Right-click navigation (Preferences): rotate, Alt pans, Ctrl scales, also over the model [1 §3.1] | Same, always on | none | – | – |
+| F: fit the mesh to the view [1 §6] | Same (frames every visible SubTool) | none | – | – |
+| Shift+Alt+click a SubTool: frame it [1 §6.1] | Missing | small | P3 | fixed |
+| P: perspective on / off [1 §6] | P is Paint; the view is always perspective | small | P3 | open (needs an orthographic camera; documented) |
+| Mouse wheel | ZBrush does not zoom with the wheel by default; SculptForge does | none (extra) | – | kept |
+
+## Sculpting modifiers
+
+| ZBrush | SculptForge before v0.7 | Gap | Pri | Status |
+|---|---|---|---|---|
+| Alt held: ZAdd / ZSub swap [1 §5] | Same (and the ring turns red) | none | – | – |
+| Shift held: Smooth brush [2] | Same | none | – | – |
+| Smooth keeps its own Z Intensity: holding Shift, the slider shows and sets Smooth's value [2] | Smooth used the active brush's Strength, so a gentle Standard (0.1) smoothed at 0.1 | big | P1 | fixed: separate Smooth intensity, Shift shows it |
+| Shift pressed after a stroke starts: the stroke is constrained to a straight line † [6] | Nothing (Shift mid-stroke ignored) | big | P2 | fixed: straight line, snapping to 45 degrees |
+| Ctrl held: paint the mask (MaskPen) [1 §6.6] | Same | none | – | – |
+| Ctrl+Alt held: erase the mask [1 §6.6] | Same | none | – | – |
+| Ctrl+click on the mesh: blur the mask [1 §6.6] | Painted a dot of mask | big | P1 | fixed |
+| Ctrl+Alt+click on the mesh: sharpen the mask [1 §6.6] | Erased a dot of mask | big | P1 | fixed |
+| Ctrl+click the background: invert the mask [1 §6.6] | Same | none | – | – |
+| Ctrl+click+drag the background: clear the mask [1 §6.6] | Same, but with nothing masked the drag zoomed the view | small | P2 | fixed: ZBrush style does nothing; SculptForge style keeps the zoom |
+| MaskLasso / MaskRect (Ctrl+drag) [3] | Same (v0.3) | none | – | – |
+| Ctrl+A mask all, Ctrl+Shift+A clear mask, Ctrl+I invert mask, Ctrl+H view mask [1 §6.6] | Buttons only, no keys | big | P1 | fixed |
+
+## Visibility and polygroups
+
+| ZBrush | SculptForge before v0.7 | Gap | Pri | Status |
+|---|---|---|---|---|
+| Ctrl+Shift+drag: show inside (green); press Alt during the drag: hide inside (red) [1 §6.9] | Same; the keys can be let go during the drag, as in ZBrush | none | – | – |
+| Ctrl+Shift+click the background: show everything [1 §6.9] | Same | none | – | – |
+| Ctrl+Shift+click a polygroup on a fully visible mesh: show only it [1 §6.9] | Same | none | – | – |
+| Ctrl+Shift+click a polygroup on a partly hidden mesh: hide that group [1 §6.9] | Isolated the clicked group instead | big | P1 | fixed |
+| Ctrl+Shift+click twice: hide the group (the second click inverts the isolation) [1 §6.9] | Same | none | – | – |
+| Ctrl+Shift+click+drag on the background: reverse visibility [1 §6.9] | A rectangle around nothing failed with "Nothing visible inside" | small | P2 | fixed: a selection that encloses nothing inverts the visibility |
+| Ctrl+Shift+Alt+click a polygroup: hide it | Same (SculptForge extra, harmless) | none | – | kept |
+| Ctrl+W: group masked and clear the mask [1 §6.8] | Tool > Polygroups > From mask, no key, mask kept | big | P1 | fixed: Ctrl+W; with nothing masked it groups what is visible † |
+| Ctrl+Shift+W | Not a default ZBrush shortcut in Maxon's sheet [1] | – | – | – |
+| Shift+F: PolyFrame and polygroups [1 §6] | Same | none | – | – |
+
+## Keys
+
+| ZBrush | SculptForge before v0.7 | Gap | Pri | Status |
+|---|---|---|---|---|
+| B then two letters: B S T Standard [1 §5.1] | Same pop-up | none | – | – |
+| B C B ClayBuildup, B D S DamStandard, B M V Move, B I N Inflate, B P I Pinch, B S M Smooth, B S H SnakeHook † | Letters were "first free letter": B C A, B D A, B M O ... | big | P1 | fixed: ZBrush letters for the brushes both apps have |
+| S: Draw Size at the cursor [1 §5] | Same | none | – | – |
+| U: Z Intensity at the cursor [1 §5] | Missing (I was Strength) | big | P1 | fixed |
+| I: RGB Intensity at the cursor [1 §5] | I opened Strength (= Z Intensity); paint had no intensity of its own | big | P1 | fixed: RGB Intensity for paint; SculptForge style keeps I = Strength |
+| O: Focal Shift at the cursor [1 §5] | No focal shift | big | P2 | fixed: Focal Shift (falloff), inner ring shows it |
+| [ and ]: Draw Size steps [1 §5] | Same (10% steps) | none | – | – |
+| Space (or right-click): QuickMenu at the cursor [1 §1] | Missing | big | P1 | fixed: Space QuickMenu (right-click stays navigation, as with ZBrush's RightClick Navigation on) |
+| L: Lazy Mouse on / off [1 §5.3] | Missing | small | P2 | fixed |
+| C: pick the colour under the cursor [1 §5.2] | Same | none | – | – |
+| V: switch main and secondary colour [1 §5.2] | Clicking the swatch only | small | P2 | fixed |
+| Q W E R: Draw, Move, Scale, Rotate [1 §5] | Same (Gizmo 3D instead of the Transpose line) | small | – | kept (Gizmo 3D, documented) |
+| T: Edit mode on / off [1 §5] | No 2.5D canvas mode: always in Edit | none | – | kept (documented) |
+| X: symmetry [1 §6] | Same | none | – | – |
+| Ctrl+Z / Ctrl+Shift+Z [1 §1] | Same (Ctrl+Y too) | none | – | – |
+| Ctrl+D divide, D / Shift+D higher / lower res [1 §6.2] | Same (subdivision levels since v0.5) | none | – | – |
+| , LightBox, Tab hide palettes, Ctrl+Alt+click assign a hotkey, Ctrl+Shift+I Store Config, Ctrl+L load UI [1] | Same | none | – | – |
+| Ctrl+Shift+Alt+I: save the UI configuration [1 §12] | Missing | small | P3 | fixed |
+| N: list all SubTools [1 §6.1] | Missing | small | P3 | open (the SubTool palette is in the right tray) |
+| 9: QuickSave [1 §1] | 9 was the DamStandard brush (1-0 pick brushes) | small | P2 | fixed: ZBrush style 9 = QuickSave, digits free; SculptForge style keeps 1-0 brushes |
+| 1, 2, 3, Shift+1: replay / record strokes [1 §5.3] | Missing (1-0 picked brushes) | small | P3 | open (no stroke replay yet) |
+| F1-F6 pop-ups (tools, brushes, strokes ...) [1 §1] | F1 Controls, F3 command palette | small | P3 | kept (B, M and the left-shelf tiles pop the same lists) |
+| H: ZScript window [1 §13] | ` opens the console | small | P3 | kept |
+| Ctrl+E edge loop, Ctrl+U reload ZScript | Ctrl+E export GLB, Ctrl+U Send to Unreal | small | P3 | kept (no edge loop tool) |
+
+## Feel and defaults
+
+| ZBrush | SculptForge | Gap | Pri | Status |
+|---|---|---|---|---|
+| Draw Size in screen pixels, constant on screen while zooming [4] | Same (radius in pixels, default 60; ZBrush 64) | none | – | – |
+| Pen pressure drives Z Intensity, not size, by default [4] | Same (Pressure > Strength on, Size off; global curve in Preferences > Tablet) | none | – | – |
+| Dab spacing: even along the stroke, independent of frame rate | Same: every input sample counts, dabs every 15% of the radius | none | – | – |
+| LazyMouse with a small radius on by default for most brushes † | Dots stroke, no lazy; L now toggles LazyMouse | small | P3 | kept |
+| Cursor: outer ring = Draw Size, inner ring = Focal Shift [4] | The inner ring showed Strength | small | P2 | fixed: inner ring shows Focal Shift |
+| Brush falloff: smooth curve, Focal Shift 0 by default [4] | Smoothstep; Focal Shift added (0 = unchanged maths) | none | – | – |
+| Open mesh borders | Smooth treats border vertices like the others, so an open edge pulls in a little with every pass. ZBrush's Smooth holds open borders better † | small | P3 | open (brush maths, out of scope for this pass) |
+| Alt+click a SubTool selects it [1 §6.1] | Same | none | – | – |
+| Paint without sculpting: Zadd off, Rgb on | P toggles the Paint brush (SculptForge) | none | – | kept |
+
+## The "SculptForge" input style
+
+The few places where SculptForge's own defaults differ and some users like them are kept behind
+**Preferences > Input > Style** (ZBrush by default):
+
+| | ZBrush (default) | SculptForge |
+|---|---|---|
+| 1 ... 0 | free (9 = QuickSave) | pick the ten built-in brushes |
+| I | RGB Intensity at the cursor | Strength (Z Intensity) at the cursor |
+| Ctrl+drag on the background with nothing masked | nothing (clears the mask) | zooms |
+
+## Sources
+
+1. Maxon, *ZBrush Shortcuts and Mouse Actions* (PDF):
+ <https://help.maxon.net/zbr/en-us/Content/Resources/Uploads/ZBrush-Shortcuts.pdf> (section numbers in brackets)
+2. Maxon ZBrush documentation, *Brush* and *Smooth brushes*:
+ <https://help.maxon.net/zbr/en-us/Content/html/reference-guide/brush/brush.html>
+3. Maxon ZBrush documentation, *Masking Essentials*:
+ <https://help.maxon.net/zbp/en-us/Content/html/5_sculpting-and-painting_masking-essentials.html>
+4. Maxon ZBrush documentation, *Draw palette* (Draw Size, Focal Shift, Z / RGB Intensity):
+ <https://help.maxon.net/zbr/en-us/Content/html/reference-guide/draw/draw.html>
+5. Maxon ZBrush documentation, *Masking sub-palette*:
+ <https://help.maxon.net/zbr/en-us/Content/html/zbrushcore/reference-guide/tool/masking/masking.html>
+6. ZBrushCentral and Polycount threads on Shift-constrained strokes (behaviour changed with LazyMouse 2.0 in
+ 4R8): <https://www.zbrushcentral.com/t/4r8-drawing-straight-lines/206837>,
+ <https://polycount.com/discussion/comment/833245>
diff --git a/src/app/Actions.cpp b/src/app/Actions.cpp
index 12eb1755..1d939810 100644
--- a/src/app/Actions.cpp
+++ b/src/app/Actions.cpp
@@ -198,6 +198,15 @@ bool ActionRegistry::handleKey(SDL_Keycode key, SDL_Keymod mods) {
return true;
}
+void ActionRegistry::setDefaultShortcut(std::string_view id, std::string chord) {
+ for (auto& a : actions_)
+ if (a.id == id && a.shortcut != chord) {
+ a.shortcut = std::move(chord);
+ ++revision_;
+ return;
+ }
+}
+
std::string ActionRegistry::shortcutText(std::string_view id) const {
for (const auto& [oid, chord] : overrides_)
if (oid == id) return chord;
diff --git a/src/app/Actions.h b/src/app/Actions.h
index d994c486..f096559f 100644
--- a/src/app/Actions.h
+++ b/src/app/Actions.h
@@ -57,6 +57,9 @@ public:
bool handleKey(SDL_Keycode key, SDL_Keymod mods);
std::string shortcutText(std::string_view id) const; // effective chord after user overrides
void setShortcut(std::string_view id, std::string chord); // user override ("" clears)
+ // Changes an action's default chord (Preferences > Input switches between the ZBrush and SculptForge
+ // defaults); user overrides still win.
+ void setDefaultShortcut(std::string_view id, std::string chord);
Json overridesToJson() const;
void overridesFromJson(const Json& j);
void touch(std::string_view id); // most-recently-used, for the command palette
diff --git a/src/app/App.cpp b/src/app/App.cpp
index e0339058..c595140c 100644
--- a/src/app/App.cpp
+++ b/src/app/App.cpp
@@ -640,6 +640,9 @@ void App::handleEvent(const SDL_Event& e) {
else if (!io.WantCaptureKeyboard && (e.key.key == SDLK_LEFTBRACKET || e.key.key == SDLK_RIGHTBRACKET))
onKey(e.key.key, e.key.mod);
break;
+ case SDL_EVENT_KEY_UP:
+ if (e.key.key == SDLK_SPACE) quickMenuKeyUp(); // a held Space closes the QuickMenu when let go
+ break;
case SDL_EVENT_DROP_FILE:
if (e.drop.data) openPathConfirmed(e.drop.data);
break;
@@ -705,6 +708,10 @@ void App::onMouseDown(float x, float y, Uint8 button) {
// Dragging on empty space navigates (ZBrush style).
drag_ = (mod & SDL_KMOD_ALT) ? Drag::Pan : ctrlDown(mod) ? Drag::Zoom : Drag::Orbit;
panFromAlt_ = drag_ == Drag::Pan;
+ // ZBrush: Shift+click, let go of Shift, then drag turns the view about its own axis (Z).
+ rollPending_ = drag_ == Drag::Orbit && (mod & SDL_KMOD_SHIFT);
+ rollStartX_ = x;
+ rollStartY_ = y;
}
} else if (button == SDL_BUTTON_RIGHT) {
// ZBrush's right-click navigation: rotate (Shift snaps), Alt pans (release Alt to zoom), Ctrl zooms.
@@ -732,9 +739,21 @@ void App::onMouseMove(float x, float y, float dx, float dy, bool fromPen) {
lastInputPen_ = fromPen;
// ZBrush: start a pan with Alt, then let go of Alt while still dragging to zoom.
if (drag_ == Drag::Pan && panFromAlt_ && !(inputMods() & SDL_KMOD_ALT)) drag_ = Drag::Zoom;
+ // Shift+press on the background: letting go of Shift before the drag gets going rolls the view instead.
+ if (rollPending_ && drag_ == Drag::Orbit) {
+ if (!(inputMods() & SDL_KMOD_SHIFT)) {
+ drag_ = Drag::Roll;
+ rollPending_ = false;
+ } else if (std::hypot(x - rollStartX_, y - rollStartY_) > 6.0f) {
+ rollPending_ = false; // a Shift-snapped rotation after all
+ } else {
+ return;
+ }
+ }
switch (drag_) {
case Drag::Stroke: strokeTo(x, y); break;
case Drag::Orbit: orbitBy(dx, dy); break;
+ case Drag::Roll: rollBy(x, y, dx, dy); break;
case Drag::Pan: camera_.pan(dx, dy, canvasHeight()); break;
case Drag::Zoom: camera_.zoom(-dy * 0.05f); break;
case Drag::MaskCanvas: maskCanvasMove(x, y); break;
@@ -757,11 +776,29 @@ void App::orbitBy(float dx, float dy) {
else camera_.setOrientation(orbitRaw_.orientation());
}
+void App::rollBy(float x, float y, float dx, float dy) {
+ // Turn about the view axis by the angle the cursor sweeps around the canvas centre (a sideways drag far
+ // from the centre still turns, by its length).
+ const CanvasRect c = canvasRect();
+ const glm::vec2 centre(c.x + c.w * 0.5f, c.y + c.h * 0.5f);
+ const glm::vec2 now(x, y), before(x - dx, y - dy);
+ float angle = 0.0f;
+ if (glm::length(now - centre) > 20.0f && glm::length(before - centre) > 20.0f) {
+ const glm::vec2 a = before - centre, b = now - centre;
+ angle = std::atan2(a.x * b.y - a.y * b.x, glm::dot(a, b));
+ } else {
+ angle = dx * 0.008f;
+ }
+ camera_.setOrientation(camera_.orientation() * glm::angleAxis(-angle, glm::vec3(0, 0, 1)));
+}
+
void App::onMouseUp() {
+ rollPending_ = false;
orbitStarted_ = false;
panFromAlt_ = false;
if (drag_ == Drag::Select) selectionMouseUp();
- if (drag_ == Drag::Stroke) endStroke();
+ if (drag_ == Drag::Stroke && maskClickPending_) maskClickRelease(); // Ctrl+click: blur / sharpen the mask
+ else if (drag_ == Drag::Stroke) endStroke();
if (drag_ == Drag::MaskCanvas) maskCanvasRelease();
if (drag_ == Drag::SubToolClick) subtoolClickRelease();
gizmoRelease();
@@ -782,6 +819,8 @@ void App::onKey(SDL_Keycode key, SDL_Keymod mod) {
void App::beginStroke(float x, float y, const RayHit& hit) {
strokeBrush_ = activeBrush();
+ straight_ = {};
+ straight_.shiftAtStart = (inputMods() & SDL_KMOD_SHIFT) != 0;
strokeInvert_ = invertToggle_ != (((inputMods() & SDL_KMOD_ALT) != 0) || (erasing() && eraserAction() == PenAction::Invert));
// Shift still smooths geometry while the Paint brush is active (ZBrush behaviour).
strokePaint_ = strokeBrush_ != BrushType::Smooth && (paintMode_ || paintRgb_);
@@ -810,6 +849,7 @@ void App::beginStroke(float x, float y, const RayHit& hit) {
p.viewDir = camera_.forward();
p.radius = radiusPx_ * pressure * camera_.worldPerPixel(hit.position, canvasHeight());
p.strength = strength_;
+ p.focal = focalShift_;
doc_.sculptor.beginGrab(doc_.mesh, doc_.bvh, p, symmetry_);
grabPlanePoint_ = grabLast_ = hit.position;
return;
@@ -828,6 +868,11 @@ void App::beginStroke(float x, float y, const RayHit& hit) {
}
void App::strokeTo(float x, float y) {
+ if (maskClickPending_) { // Ctrl+press on the model: a drag past the click slop paints the mask after all
+ if (std::hypot(x - maskClickX_, y - maskClickY_) < 4.0f) return;
+ maskClickPending_ = false;
+ firstDab(maskClickX_, maskClickY_);
+ }
const BrushRecipe* recipe = strokeRecipe();
if (strokeBrush_ == BrushType::Move && !recipe && strokeSculpt_) {
glm::vec3 origin, dir;
@@ -854,6 +899,11 @@ void App::strokeTo(float x, float y) {
x = lazy.x;
y = lazy.y;
}
+ { // Shift pressed after the stroke began: a straight line (ZBrush)
+ const glm::vec2 c = constrainStroke(x, y);
+ x = c.x;
+ y = c.y;
+ }
if (firstDabPending_) {
// The pen touched down without a real pressure yet: the stroke starts where it first presses
@@ -919,10 +969,13 @@ void App::dabAt(float x, float y, float pressure) {
p.viewDir = camera_.forward();
p.radius = radiusPx_ * (pressureSize_ ? std::max(pressure, 0.05f) : 1.0f) *
camera_.worldPerPixel(hit.position, canvasHeight()) * dabRadiusScale_;
- p.strength = strength_ * dabStrengthScale_;
+ // Smooth keeps its own Z Intensity (ZBrush), whether picked or held with Shift.
+ p.strength = (strokeBrush_ == BrushType::Smooth ? smoothStrength_ : strength_) * dabStrengthScale_;
p.pressure = pressureStrength_ ? pressure : 1.0f;
p.invert = strokeInvert_;
p.frontFacesOnly = frontFacesOnly_;
+ p.focal = focalShift_;
+ lastDabScreen_ = glm::vec2(x, y);
if (strokeMask_) {
p.strength = maskStrength_;
doc_.sculptor.dabMask(doc_.mesh, doc_.bvh, p, symmetry_);
@@ -1203,6 +1256,7 @@ void App::drawUi() {
// Draw order (ui-spec §12): shells, LightBox, floating windows, then pop-ups and help.
drawShell();
drawLightBoxUi(); // thumbnails, the LightBox over the canvas, pickers, size / strength pop-ups
+ drawQuickMenu(); // Space (Input.cpp)
drawSubToolPopups();
if (showBrushLab_) drawBrushLab();
drawBrushGallery();
@@ -2137,16 +2191,18 @@ void App::drawBrushCursor() {
dl->AddLine(ImVec2(c.x, c.y - arm), ImVec2(c.x, c.y + arm), IM_COL32(230, 230, 230, 220), 1.5f);
return;
}
+ const BrushType shownBrush = drag_ == Drag::Stroke ? strokeBrush_ : activeBrush(); // Shift mid-stroke draws a line
ImU32 col = masking ? IM_COL32(230, 230, 230, 200)
- : activeBrush() == BrushType::Smooth ? IM_COL32(120, 200, 255, 200)
+ : shownBrush == BrushType::Smooth ? IM_COL32(120, 200, 255, 200)
: inverted ? IM_COL32(255, 110, 110, 200)
: IM_COL32(255, 190, 120, 200);
- if (!masking && paintMode_ && activeBrush() != BrushType::Smooth) { // Paint brush: ring in the paint colour
+ if (!masking && paintMode_ && shownBrush != BrushType::Smooth) { // Paint brush: ring in the paint colour
const glm::vec3 pc = linearToSrgb(inverted ? glm::vec3(1.0f) : doc_.paintColor);
col = ImGui::GetColorU32(ImVec4(pc.x, pc.y, pc.z, 0.9f));
}
dl->AddCircle(c, r, col, 64, 1.5f);
- dl->AddCircle(c, r * (0.25f + 0.75f * (1.0f - strength_)), IM_COL32(255, 255, 255, 60), 48, 1.0f);
+ // The inner ring is Focal Shift, as in ZBrush: where the falloff drops to half.
+ dl->AddCircle(c, r * focalRingFraction(focalShift_), IM_COL32(255, 255, 255, 90), 48, 1.0f);
if (strokeType_ == StrokeType::LazyMouse && drag_ == Drag::Stroke) {
// The string from the cursor to the lagging brush point.
const ImVec2 lp(lazyMouse_.point.x, lazyMouse_.point.y);
diff --git a/src/app/App.h b/src/app/App.h
index 32d64d47..57b63dd1 100644
--- a/src/app/App.h
+++ b/src/app/App.h
@@ -98,13 +98,14 @@ public:
void queueFile(FileAction action, std::string path);
private:
- enum class Drag { None, Stroke, Orbit, Pan, Zoom, MaskCanvas, SubToolClick, Select, Gizmo };
+ enum class Drag { None, Stroke, Orbit, Pan, Zoom, Roll, MaskCanvas, SubToolClick, Select, Gizmo };
void handleEvent(const SDL_Event& e);
void onMouseDown(float x, float y, Uint8 button);
void onMouseMove(float x, float y, float dx, float dy, bool fromPen);
void onMouseUp();
void orbitBy(float dx, float dy); // a rotation drag: free or turntable (Preferences), Shift snaps
+ void rollBy(float x, float y, float dx, float dy); // Shift+click, release Shift, drag: turn about the view axis
void onKey(SDL_Keycode key, SDL_Keymod mod);
bool pick(float x, float y, RayHit& hit) const; // the active SubTool (what brushes work on)
@@ -305,6 +306,7 @@ private:
void maskCanvasRelease();
bool maskSelectMouseDown(float x, float y, SDL_Keymod mod); // true if it took the click
void maskSelectMouseUp();
+ void maskClickRelease(); // Ctrl+click on the model without dragging: blur the mask (Ctrl+Alt: sharpen)
bool strokeMask_ = false; // the current stroke edits the mask
float maskStrength_ = 1.0f;
int maskIterations_ = 1;
@@ -704,7 +706,7 @@ private:
friend void drawStrokeGrid(App&, GridMode);
void initLightBox(); // end of init(): library folders, thumbnail cache, actions, project thumbnails
void drawLightBoxUi(); // every frame from drawUi: thumbnails, the LightBox, pickers, size / strength pop-ups
- // The LightBox / picker shortcuts (, B M S I) until the action registry dispatches keys.
+ // The LightBox / picker shortcuts (, B M S) until the action registry dispatches keys.
bool lightBoxKey(SDL_Keycode key, SDL_Keymod mod);
void quickSave(); // file.quicksave: a timestamped project in <library>/QuickSave
LibraryRoots library_;
@@ -854,6 +856,45 @@ private:
float move[3] = {0, 0, 0}, rotate[3] = {0, 0, 0}, scale = 100.0f;
} gizmo_;
// ---- end Gizmo 3D ----
+ // ---- ZBrush feel (Input.cpp, docs/zbrush-parity.md) ----
+ // Preferences > Input (the ZBrush or SculptForge key style), the Space QuickMenu, the intensities and Focal
+ // Shift (U / I / O), ZBrush's mask and polygroup keys, Shift-constrained straight strokes and the
+ // Shift+click, release Shift, drag roll.
+ void registerInputActions();
+ void applyInputStyle(); // the style's default shortcuts (1-0 brushes or 9 QuickSave; I = RGB or Z Intensity)
+ bool zbrushStyle() const { return uiPrefs_.inputStyle == 0; }
+ void drawInputSection(); // Preferences > Input
+ // Z Intensity (0-100 on screen): Smooth's own while Shift is held or Smooth is the brush, as in ZBrush.
+ void drawZIntensitySlider(const char* id);
+ void openQuickMenu();
+ void quickMenuKeyUp(); // Space released: a hold closes the menu, a tap leaves it open
+ void drawQuickMenu();
+ void groupMasked(); // Ctrl+W
+ // Straight strokes: Shift pressed after a stroke started constrains it to a line from where Shift went down,
+ // snapped to 45 degree steps on screen. Returns the point to draw towards.
+ glm::vec2 constrainStroke(float x, float y);
+ float smoothStrength_ = 0.5f; // Smooth's own Z Intensity (Shift+stroke, or the Smooth brush)
+ float rgbIntensity_ = 1.0f; // paint strength (ZBrush RGB Intensity, 100 by default)
+ float focalShift_ = 0.0f; // -1..1 (ZBrush Focal Shift -100..100)
+ struct QuickMenu {
+ bool open = false;
+ ImVec2 at{0, 0};
+ double openedAt = 0.0; // seconds (a short press is a tap)
+ bool keyHeld = false; // Space is still down
+ bool untilLeave = false; // Space let go over the menu: it closes when the pointer leaves it
+ int openedFrame = -1;
+ } quickMenu_;
+ struct StraightStroke {
+ bool active = false; // Shift went down mid-stroke
+ bool shiftAtStart = false; // the stroke began with Shift (it smooths; Shift isn't a constraint then)
+ glm::vec2 origin{0.0f};
+ } straight_;
+ bool rollPending_ = false; // Shift+press on the background: let go of Shift before moving to roll the view
+ float rollStartX_ = 0.0f, rollStartY_ = 0.0f;
+ glm::vec2 lastDabScreen_{0.0f}; // window pixels of the last dab (UI tests: last_dab_x / last_dab_y)
+ bool maskClickPending_ = false; // Ctrl+press on the model: a click blurs (Alt: sharpens), a drag paints
+ float maskClickX_ = 0.0f, maskClickY_ = 0.0f;
+ // ---- end ZBrush feel ----
// ---- Tablet (Tablet.cpp, core/Tablet.h, docs/tablet.md) ----
// SDL turns pen tip contact into left mouse button events (SDL_PEN_MOUSEID); the pen's own events
// add pressure, tilt, the eraser end and the side buttons, which are mapped in Preferences > Tablet.
diff --git a/src/app/AssetLibrary.cpp b/src/app/AssetLibrary.cpp
index 19ae7aa7..1c7a849d 100644
--- a/src/app/AssetLibrary.cpp
+++ b/src/app/AssetLibrary.cpp
@@ -336,7 +336,23 @@ std::vector<std::pair<char, size_t>> letterBadges(const std::vector<std::string>
auto taken = [&](char c) {
return std::any_of(badges.begin(), badges.end(), [c](const auto& b) { return b.first == c; });
};
+ auto has = [&](size_t i) {
+ return std::any_of(badges.begin(), badges.end(), [i](const auto& b) { return b.second == i; });
+ };
+ // ZBrush's own keys for the brushes both apps have (B S T Standard, B C B ClayBuildup ...) come first, so
+ // the hands that know ZBrush pick the same brush.
+ static const std::pair<const char*, const char*> kZBrushKeys[] = {
+ {"standard", "st"}, {"smooth", "sm"}, {"snakehook", "sh"}, {"claybuildup", "cb"}, {"clay", "cl"},
+ {"damstandard", "ds"}, {"move", "mv"}, {"inflate", "in"}, {"pinch", "pi"}, {"flatten", "fl"},
+ {"trim", "td"}, {"layer", "ly"}, {"nudge", "nu"}, {"crease", "cr"}};
+ if (typed.size() == 1)
+ for (size_t i : kept) {
+ const std::string n = typedName(names[i]);
+ for (const auto& [name, keys] : kZBrushKeys)
+ if (n == name && keys[0] == typed[0] && !taken(keys[1]) && !has(i)) badges.emplace_back(keys[1], i);
+ }
for (size_t i : kept) {
+ if (has(i)) continue;
const std::string n = typedName(names[i]);
if (n.rfind(typed, 0) != 0) continue;
for (size_t k = typed.size(); k < n.size(); ++k)
diff --git a/src/app/AssetLibrary.h b/src/app/AssetLibrary.h
index 1c394a6b..2c51f75c 100644
--- a/src/app/AssetLibrary.h
+++ b/src/app/AssetLibrary.h
@@ -129,8 +129,9 @@ std::string typedName(const std::string& name);
// containing it (`substring` says which). Empty `typed` keeps all.
std::vector<size_t> filterByTyped(const std::vector<std::string>& names, const std::string& typed,
bool* substring = nullptr);
-// The key badge of each kept name: the first letter after `typed` in the name that no earlier name
-// took. Returns (letter, index into names) pairs; substring matches get none.
+// The key badge of each kept name: ZBrush's own second letter for the brushes it shares with SculptForge
+// (B C B ClayBuildup, B D S DamStandard, B M V Move ...), otherwise the first letter after `typed` in the name
+// that no earlier name took. Returns (letter, index into names) pairs; substring matches get none.
std::vector<std::pair<char, size_t>> letterBadges(const std::vector<std::string>& names,
const std::vector<size_t>& kept, const std::string& typed);
diff --git a/src/app/Config.cpp b/src/app/Config.cpp
index d1b792fe..1f12e84a 100644
--- a/src/app/Config.cpp
+++ b/src/app/Config.cpp
@@ -45,6 +45,7 @@ Json toJson(const UiPrefs& p) {
j.set("libraryFolder", p.libraryFolder);
j.set("cameraNotch", double(p.cameraNotch));
j.set("turntable", p.turntable);
+ j.set("inputStyle", std::string(p.inputStyle == 1 ? "sculptforge" : "zbrush"));
j.set("alphabeticalPalettes", p.alphabeticalPalettes);
j.set("tablet", toJson(p.tablet));
j.set("antialiasing", double(p.antialiasing));
@@ -66,6 +67,7 @@ void fromJson(const Json& j, UiPrefs& p) {
if (j["libraryFolder"].isString()) p.libraryFolder = j["libraryFolder"].asString();
p.cameraNotch = std::clamp(int(j["cameraNotch"].asNumber(p.cameraNotch)), 0, 2);
p.turntable = j["turntable"].asBool(p.turntable);
+ if (j["inputStyle"].isString()) p.inputStyle = j["inputStyle"].asString() == "sculptforge" ? 1 : 0;
p.alphabeticalPalettes = j["alphabeticalPalettes"].asBool(p.alphabeticalPalettes);
fromJson(j["tablet"], p.tablet);
const int aa = int(j["antialiasing"].asNumber(p.antialiasing));
@@ -345,6 +347,7 @@ void App::initActions() {
registerBakeUiActions(); // Tool > Bake (PanelBake.cpp)
registerRetopoUiActions(); // Geometry > QRemesh, SubTool > ProjectAll (PanelRetopo.cpp)
registerPerformanceUiActions(); // Preferences > Performance (PanelPerformance.cpp)
+ registerInputActions(); // ZBrush keys: U I O, Space, L, V, Ctrl+A / I / H / W..., the input style (Input.cpp)
// Every command, so the command palette finds anything scriptable.
actions_.registerCommands(
@@ -412,6 +415,7 @@ bool App::readUiConfig(const std::string& path, std::string& err) {
actions_.overridesFromJson(j["shortcuts"]);
fromJson(j["prefs"], uiPrefs_);
applyPerformancePrefs();
+ applyInputStyle();
return true;
}
diff --git a/src/app/Config.h b/src/app/Config.h
index cfe9b415..35a70492 100644
--- a/src/app/Config.h
+++ b/src/app/Config.h
@@ -29,6 +29,7 @@ struct UiPrefs {
bool alphabeticalPalettes = false; // strict A-Z palette bar like ZBrush (default: File, Edit first)
int cameraNotch = 0; // keep the UI out of a laptop's camera notch: 0 automatic, 1 always, 2 never
bool turntable = false; // rotation: false = free, about the screen axes (ZBrush); true = turntable (Y up)
+ int inputStyle = 0; // Preferences > Input: 0 ZBrush, 1 SculptForge (1-0 brushes, I = Z Intensity...)
TabletSettings tablet; // Preferences > Tablet: pressure curve, eraser, pen buttons
// Preferences > Performance (PanelPerformance.cpp).
int antialiasing = 4; // samples per pixel in the 3D view: 1 (off), 2, 4 or 8
diff --git a/src/app/Input.cpp b/src/app/Input.cpp
new file mode 100644
index 00000000..04fa41ef
--- /dev/null
+++ b/src/app/Input.cpp
@@ -0,0 +1,293 @@
+// SculptForge - open source digital sculpting
+// SPDX-License-Identifier: GPL-3.0-or-later
+//
+// The ZBrush feel (docs/zbrush-parity.md): ZBrush's keys that SculptForge lacked (U Z Intensity, I RGB
+// Intensity, O Focal Shift, Space QuickMenu, L LazyMouse, V switch colour, Ctrl+A / Ctrl+Shift+A / Ctrl+I /
+// Ctrl+H for the mask, Ctrl+W group masked), Preferences > Input with the ZBrush and SculptForge key styles,
+// the QuickMenu itself and Shift-constrained straight strokes. The mouse gestures live with the rest of the
+// input in App.cpp (roll, Ctrl+click blur / sharpen in PanelMasking.cpp).
+#include "app/App.h"
+#include "app/Pickers.h"
+#include "app/Ui.h"
+
+#include <IconsLucide.h>
+
+#include <imgui_internal.h>
+
+#include <algorithm>
+#include <cctype>
+#include <cmath>
+#include <string>
+
+namespace sf {
+
+namespace {
+
+constexpr double kQuickMenuTapSeconds = 0.25; // Space released sooner: a tap, the QuickMenu stays open
+
+bool anyMasked(const Mesh& mesh) {
+ return std::any_of(mesh.mask.begin(), mesh.mask.end(), [](float m) { return m > 0.0f; });
+}
+
+// The brush's action id, as the shell registers it ("brush.claybuildup").
+std::string brushId(BrushType t) {
+ std::string id = "brush.";
+ for (const char* c = brushName(t); *c; ++c)
+ if (*c != ' ') id += char(std::tolower(static_cast<unsigned char>(*c)));
+ return id;
+}
+
+} // namespace
+
+void App::registerInputActions() {
+ auto add = [this](const char* id, const char* label, const char* icon, const char* palette, const char* shortcut,
+ const char* description, std::function<void()> run, std::function<bool()> checked = nullptr,
+ std::function<bool()> enabled = nullptr) {
+ Action a;
+ a.id = id;
+ a.label = label;
+ a.icon = icon;
+ a.palette = palette;
+ a.shortcut = shortcut;
+ a.description = description;
+ a.run = std::move(run);
+ a.checked = std::move(checked);
+ a.enabled = std::move(enabled);
+ actions_.add(std::move(a));
+ };
+
+ // The sliders at the cursor (S is Draw Size, in LightBox.cpp).
+ add("ui.strength_popup", "Z Intensity at cursor", ICON_LC_CIRCLE_DOT, "Draw", "U",
+ "A Z Intensity slider under the cursor: drag it, or type a number (1-100) and press Enter. Hold Shift (or "
+ "pick Smooth) to set Smooth's own Z Intensity.",
+ [this] { PickerUi::sizePopup(*this, PickerUi::Slider::ZIntensity); });
+ add("ui.rgb_popup", "RGB Intensity at cursor", ICON_LC_PALETTE, "Draw", "I",
+ "An RGB Intensity slider under the cursor: how strongly painting colours the surface (1-100).",
+ [this] { PickerUi::sizePopup(*this, PickerUi::Slider::RgbIntensity); });
+ add("ui.focal_popup", "Focal Shift at cursor", ICON_LC_CIRCLE_DASHED, "Draw", "O",
+ "A Focal Shift slider under the cursor: below 0 a broad, hard brush tip, above 0 a soft point (-100..100). The "
+ "inner ring of the brush cursor shows it.",
+ [this] { PickerUi::sizePopup(*this, PickerUi::Slider::FocalShift); });
+ add("ui.quickmenu", "QuickMenu", ICON_LC_LAYOUT_GRID, "Help", "Space",
+ "ZBrush's QuickMenu under the cursor: brush, stroke, alpha, material, colour, Draw Size, Focal Shift and the "
+ "intensities. Hold Space and let go to close it, or tap Space to keep it open.",
+ [this] { openQuickMenu(); }, [this] { return quickMenu_.open; });
+
+ // Stroke and colour.
+ add("stroke.lazy", "LazyMouse", ICON_LC_SPLINE, "Stroke", "L",
+ "LazyMouse on or off: the brush trails the cursor on a string, for steady lines.",
+ [this] { strokeType_ = strokeType_ == StrokeType::LazyMouse ? StrokeType::Dots : StrokeType::LazyMouse; },
+ [this] { return strokeType_ == StrokeType::LazyMouse; });
+ add("color.switch", "Switch Color", ICON_LC_ARROW_LEFT_RIGHT, "Color", "V",
+ "Swap the main and the secondary colour.", [this] { std::swap(doc_.paintColor, secondaryColor_); });
+
+ // Masking (ZBrush Tool > Masking keys).
+ add("mask.all", "Mask All", ICON_LC_SQUARE, "Tool > Masking", "Ctrl+A", "Mask the whole visible SubTool.",
+ [this] { runCommand("mask_all"); });
+ add("mask.clear", "Clear Mask", ICON_LC_ERASER, "Tool > Masking", "Ctrl+Shift+A",
+ "Unmask everything (also: Ctrl+drag on the background).", [this] { runCommand("mask_clear"); });
+ add("mask.invert", "Invert Mask", ICON_LC_FLIP_HORIZONTAL_2, "Tool > Masking", "Ctrl+I",
+ "Mask what is unmasked and unmask what is masked (also: Ctrl+click the background).",
+ [this] { runCommand("mask_invert"); });
+ actions_.setDefaultShortcut("view.mask", "Ctrl+H"); // View Mask
+ add("polygroup.group_masked", "Group Masked", ICON_LC_SHAPES, "Tool > Polygroups", "Ctrl+W",
+ "Turn the masked part into a new polygroup and clear the mask (ZBrush Ctrl+W). With nothing masked, "
+ "everything visible becomes one group.",
+ [this] { groupMasked(); });
+ actions_.setDefaultShortcut("config.save", "Ctrl+Shift+Alt+I");
+
+ // Preferences > Input: the key style.
+ add("input.style_zbrush", "ZBrush", nullptr, "Preferences > Input", "",
+ "ZBrush's keys and gestures: I is RGB Intensity, 9 is QuickSave, the number keys don't pick brushes, and "
+ "Ctrl+drag on the background only clears the mask.",
+ [this] {
+ uiPrefs_.inputStyle = 0;
+ applyInputStyle();
+ },
+ [this] { return uiPrefs_.inputStyle == 0; });
+ add("input.style_sculptforge", "SculptForge", nullptr, "Preferences > Input", "",
+ "SculptForge's own keys from before 0.7: 1-9 and 0 pick the first ten brushes, I is Z Intensity (as is U), "
+ "and Ctrl+drag on the background zooms when nothing is masked.",
+ [this] {
+ uiPrefs_.inputStyle = 1;
+ applyInputStyle();
+ },
+ [this] { return uiPrefs_.inputStyle == 1; });
+ applyInputStyle();
+}
+
+void App::applyInputStyle() {
+ const bool sf = !zbrushStyle();
+ for (int i = 0; i < int(BrushType::Count) && i < 10; ++i)
+ actions_.setDefaultShortcut(brushId(BrushType(i)), sf ? (i < 9 ? std::to_string(i + 1) : "0") : "");
+ actions_.setDefaultShortcut("file.quicksave", sf ? "" : "9");
+ actions_.setDefaultShortcut("ui.strength_popup", sf ? "U / I" : "U");
+ actions_.setDefaultShortcut("ui.rgb_popup", sf ? "" : "I");
+}
+
+void App::drawInputSection() {
+ ImGui::TextDisabled("Style");
+ ImGui::SameLine();
+ ui::Segmented(*this, {"input.style_zbrush", "input.style_sculptforge"});
+ ImGui::TextDisabled("Rotation");
+ ImGui::SameLine();
+ int rotation = uiPrefs_.turntable ? 1 : 0;
+ ImGui::SetNextItemWidth(-1);
+ if (ImGui::Combo("##rotation_input", &rotation, "Free (ZBrush)\0Turntable\0")) uiPrefs_.turntable = rotation == 1;
+ ui::HelpText("Rotation", nullptr,
+ "Free: the model turns about the screen's axes and can roll over the top, as in ZBrush. Turntable: it "
+ "stays upright, as in Blender or Maya.",
+ "Preferences > Input");
+}
+
+void App::drawZIntensitySlider(const char* id) {
+ const bool smooth = activeBrush() == BrushType::Smooth && drag_ != Drag::Stroke;
+ float& value = smooth ? smoothStrength_ : strength_;
+ float shown = value * 100.0f;
+ if (ui::SliderInside(id, &shown, 1.0f, 100.0f, smooth ? "Smooth Z Intensity %.0f" : "Z Intensity %.0f"))
+ value = std::clamp(shown / 100.0f, 0.01f, 1.0f);
+ ui::HelpText(smooth ? "Smooth Z Intensity" : "Z Intensity", "U",
+ smooth ? "How strongly Smooth works. Smooth keeps its own value, as in ZBrush: hold Shift to see and "
+ "set it. Ctrl+click to type."
+ : "How strongly each dab changes the surface (1-100). Holding Shift shows Smooth's own value. "
+ "Ctrl+click to type.",
+ "Draw");
+}
+
+// ---------------------------------------------------------------------------
+// Ctrl+W
+// ---------------------------------------------------------------------------
+
+void App::groupMasked() {
+ if (anyMasked(doc_.mesh)) {
+ runCommand("polygroup_from_mask");
+ if (lastCommandOk_) {
+ const std::string message = status_;
+ runCommand("mask_clear");
+ status_ = message;
+ }
+ } else {
+ runCommand("polygroup_merge_visible");
+ }
+ if (lastCommandOk_) renderSettings_.showPolygroups = true; // like the panel's buttons: show the result
+}
+
+// ---------------------------------------------------------------------------
+// Straight strokes
+// ---------------------------------------------------------------------------
+
+glm::vec2 App::constrainStroke(float x, float y) {
+ if (straight_.shiftAtStart || !(inputMods() & SDL_KMOD_SHIFT)) {
+ straight_.active = false;
+ return {x, y};
+ }
+ if (!straight_.active) {
+ straight_.active = true;
+ straight_.origin = glm::vec2(lastX_, lastY_); // the line starts where the stroke is when Shift goes down
+ }
+ const glm::vec2 d = glm::vec2(x, y) - straight_.origin;
+ if (glm::length(d) < 1e-3f) return straight_.origin;
+ constexpr float kStep = 3.14159265f / 4.0f; // 45 degrees
+ const float angle = std::round(std::atan2(d.y, d.x) / kStep) * kStep;
+ const glm::vec2 dir(std::cos(angle), std::sin(angle));
+ return straight_.origin + dir * std::max(0.0f, glm::dot(d, dir));
+}
+
+// ---------------------------------------------------------------------------
+// QuickMenu (Space)
+// ---------------------------------------------------------------------------
+
+void App::openQuickMenu() {
+ if (quickMenu_.open && !quickMenu_.keyHeld) { // tapped open, tapped again: close
+ quickMenu_.open = false;
+ return;
+ }
+ quickMenu_.open = true;
+ quickMenu_.at = ImVec2(mouseX_, mouseY_);
+ quickMenu_.openedAt = ImGui::GetTime();
+ quickMenu_.keyHeld = true;
+ quickMenu_.untilLeave = false;
+ quickMenu_.openedFrame = ImGui::GetFrameCount();
+}
+
+void App::quickMenuKeyUp() {
+ if (!quickMenu_.keyHeld) return;
+ quickMenu_.keyHeld = false;
+ if (!quickMenu_.open) return;
+ // Held: let go to close, as in ZBrush, unless the pointer is on the menu (then it stays until it leaves).
+ const bool tap = ImGui::GetTime() - quickMenu_.openedAt < kQuickMenuTapSeconds;
+ ImGuiWindow* w = ImGui::FindWindowByName("QuickMenu##quickmenu");
+ const bool over = w && ImGui::IsMouseHoveringRect(w->Pos, ImVec2(w->Pos.x + w->Size.x, w->Pos.y + w->Size.y), false);
+ if (!tap && !over) quickMenu_.open = false;
+ quickMenu_.untilLeave = !tap && over;
+}
+
+void App::drawQuickMenu() {
+ if (!quickMenu_.open) return;
+ if (pickerOpen() && ImGui::GetFrameCount() > quickMenu_.openedFrame + 1) { // a tile opened its picker
+ quickMenu_.open = false;
+ return;
+ }
+ const float s = uiScale_;
+ const float tile = 56.0f * s;
+ const float width = 4 * tile + 3 * ImGui::GetStyle().ItemSpacing.x + 150.0f * s;
+ ImGui::SetNextWindowPos(ImVec2(quickMenu_.at.x - width * 0.5f, quickMenu_.at.y - tile * 0.5f), ImGuiCond_Appearing);
+ ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, 6.0f);
+ ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(8, 8));
+ ImGui::PushStyleColor(ImGuiCol_WindowBg, IM_COL32(37, 37, 40, 245));
+ bool close = false;
+ if (ImGui::Begin("QuickMenu##quickmenu", nullptr,
+ ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoSavedSettings |
+ ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoFocusOnAppearing)) {
+ ImGui::BeginGroup();
+ drawBrushTile("##qm_brush", ImVec2(tile, tile));
+ ImGui::SameLine();
+ drawStrokeTile("##qm_stroke", ImVec2(tile, tile));
+ ImGui::SameLine();
+ drawAlphaTile("##qm_alpha", ImVec2(tile, tile));
+ ImGui::SameLine();
+ drawMaterialTile("##qm_material", ImVec2(tile, tile));
+ ImGui::EndGroup();
+ ImGui::SameLine();
+ ImGui::BeginGroup();
+ const float sw = 150.0f * s;
+ ImGui::SetNextItemWidth(sw);
+ ui::SliderInside("##qm_drawsize", &radiusPx_, 2.0f, 800.0f, "Draw Size %.0f", ImGuiSliderFlags_Logarithmic);
+ ui::HelpText("Draw Size", "S", "Brush radius in screen pixels.", "QuickMenu");
+ float focal = focalShift_ * 100.0f;
+ ImGui::SetNextItemWidth(sw);
+ if (ui::SliderInside("##qm_focal", &focal, -100.0f, 100.0f, "Focal Shift %.0f")) focalShift_ = focal / 100.0f;
+ ui::HelpText("Focal Shift", "O", "Below 0: a broad, hard tip. Above 0: a soft point.", "QuickMenu");
+ const bool smooth = activeBrush() == BrushType::Smooth;
+ float& zValue = smooth ? smoothStrength_ : strength_;
+ float z = zValue * 100.0f;
+ ImGui::SetNextItemWidth(sw);
+ if (ui::SliderInside("##qm_z", &z, 1.0f, 100.0f, smooth ? "Smooth Z Intensity %.0f" : "Z Intensity %.0f"))
+ zValue = z / 100.0f;
+ ui::HelpText("Z Intensity", "U", "How strongly the brush changes the surface.", "QuickMenu");
+ float rgb = rgbIntensity_ * 100.0f;
+ ImGui::SetNextItemWidth(sw);
+ if (ui::SliderInside("##qm_rgb", &rgb, 1.0f, 100.0f, "RGB Intensity %.0f")) rgbIntensity_ = rgb / 100.0f;
+ ui::HelpText("RGB Intensity", "I", "How strongly painting colours the surface.", "QuickMenu");
+ ImGui::EndGroup();
+ ui::Segmented(*this, {"draw.zadd", "draw.zsub"}, 2 * tile + ImGui::GetStyle().ItemSpacing.x);
+ ImGui::SameLine();
+ ui::Segmented(*this, {"draw.sculpt", "draw.paint"}, 2 * tile + ImGui::GetStyle().ItemSpacing.x);
+ ImGui::SameLine();
+ ui::ActionButton(*this, "draw.rgb");
+ ImGui::SameLine();
+ ui::ActionButton(*this, "transform.symmetry_x");
+ const bool clicked = ImGui::IsMouseClicked(ImGuiMouseButton_Left) || ImGui::IsMouseClicked(ImGuiMouseButton_Right);
+ const bool hovered = ImGui::IsWindowHovered(ImGuiHoveredFlags_ChildWindows | ImGuiHoveredFlags_AllowWhenBlockedByActiveItem);
+ if (clicked && !hovered && ImGui::GetFrameCount() > quickMenu_.openedFrame + 1) close = true;
+ // Space was let go while pointing at it: moving off it closes it.
+ if (quickMenu_.untilLeave && !hovered && !ImGui::IsAnyItemActive()) close = true;
+ if (ImGui::IsKeyPressed(ImGuiKey_Escape, false)) close = true;
+ }
+ ImGui::End();
+ ImGui::PopStyleColor();
+ ImGui::PopStyleVar(2);
+ if (close) quickMenu_.open = false;
+}
+
+} // namespace sf
diff --git a/src/app/LightBox.cpp b/src/app/LightBox.cpp
index b4049644..9b70dbaf 100644
--- a/src/app/LightBox.cpp
+++ b/src/app/LightBox.cpp
@@ -993,10 +993,8 @@ void App::initLightBox() {
[] { openPicker(Picker::Material, ImVec2(-1, -1)); });
add("ui.size_popup", "Draw Size at cursor", ICON_LC_CIRCLE, "Draw", "S",
"A Draw Size slider under the cursor: drag it, or type a number and press Enter.",
- [this] { PickerUi::sizePopup(*this, false); });
- add("ui.strength_popup", "Strength at cursor", ICON_LC_CIRCLE_DOT, "Draw", "I",
- "A Strength slider under the cursor: drag it, or type a number and press Enter.",
- [this] { PickerUi::sizePopup(*this, true); });
+ [this] { PickerUi::sizePopup(*this, PickerUi::Slider::DrawSize); });
+ // U / I / O (Z Intensity, RGB Intensity, Focal Shift) are in Input.cpp.
add("file.quicksave", "QuickSave", ICON_LC_SAVE, "File", "",
"Save a timestamped copy of the whole scene to the QuickSave folder of your library (the last 10 are kept). "
"Your project file is not changed. Find them in the LightBox QuickSave tab.",
@@ -1019,7 +1017,6 @@ bool App::lightBoxKey(SDL_Keycode key, SDL_Keymod mod) {
: key == SDLK_B ? "ui.picker.brush"
: key == SDLK_M ? "ui.picker.material"
: key == SDLK_S ? "ui.size_popup"
- : key == SDLK_I ? "ui.strength_popup"
: nullptr;
const Action* a = id ? actions_.find(id) : nullptr;
if (!a || !a->run) return false;
diff --git a/src/app/Palettes.cpp b/src/app/Palettes.cpp
index 62614b9f..780d82d0 100644
--- a/src/app/Palettes.cpp
+++ b/src/app/Palettes.cpp
@@ -173,8 +173,18 @@ void App::drawPalette_Draw() {
ui::SliderInside("##drawsize", &radiusPx_, 2.0f, 800.0f, "Draw Size %.0f", ImGuiSliderFlags_Logarithmic);
ui::HelpText("Draw Size", "S", "Brush radius in screen pixels. [ and ] change it by 10%.", "Draw");
ImGui::SetNextItemWidth(-1);
- ui::SliderInside("##strength", &strength_, 0.01f, 1.0f, "Strength %.2f");
- ui::HelpText("Strength", "I", "How strongly each dab changes the surface (ZBrush Z Intensity).", "Draw");
+ drawZIntensitySlider("##strength");
+ ImGui::SetNextItemWidth(-1);
+ float rgb = rgbIntensity_ * 100.0f;
+ if (ui::SliderInside("##rgbintensity", &rgb, 1.0f, 100.0f, "RGB Intensity %.0f")) rgbIntensity_ = rgb / 100.0f;
+ ui::HelpText("RGB Intensity", "I", "How strongly painting colours the surface (1-100); Ctrl+click to type.", "Draw");
+ ImGui::SetNextItemWidth(-1);
+ float focal = focalShift_ * 100.0f;
+ if (ui::SliderInside("##focalshift", &focal, -100.0f, 100.0f, "Focal Shift %.0f")) focalShift_ = focal / 100.0f;
+ ui::HelpText("Focal Shift", "O",
+ "The brush falloff: below 0 a broad, hard tip, above 0 a soft point. The brush cursor's inner ring shows "
+ "where the brush works at half strength.",
+ "Draw");
segmented(*this, {"draw.sculpt", "draw.paint"});
segmented(*this, {"draw.zadd", "draw.zsub"});
actionRow(*this, {"draw.rgb", "draw.front_faces"});
@@ -281,6 +291,7 @@ void App::drawPalette_Preferences() {
}
}
if (subpalette("preferences.interface", "Interface")) config::drawInterfaceSection(*this);
+ if (subpalette("preferences.input", "Input")) drawInputSection();
if (subpalette("preferences.hotkeys", "Hotkeys")) config::drawHotkeysSection(*this);
if (subpalette("preferences.lightbox", "LightBox")) config::drawLightBoxSection(*this);
if (subpalette("preferences.tablet", "Tablet")) drawTabletSection();
diff --git a/src/app/PanelBrushes.cpp b/src/app/PanelBrushes.cpp
index f3ea0f93..d7631cd6 100644
--- a/src/app/PanelBrushes.cpp
+++ b/src/app/PanelBrushes.cpp
@@ -95,6 +95,7 @@ void App::snakeHookTo(float x, float y) {
p.strength = strength_;
p.pressure = pressureStrength_ ? pressure : 1.0f;
p.invert = strokeInvert_;
+ p.focal = focalShift_;
p.alpha = &doc_.brushAlpha;
p.alphaUp = screenUpVector(0.0f);
// Small steps keep the tip under the cursor and the pulled surface even.
@@ -125,6 +126,7 @@ void App::dragRectTo(float x, float y) {
p.pressure = pressureStrength_ ? pressure : 1.0f;
p.invert = strokeInvert_;
p.frontFacesOnly = frontFacesOnly_;
+ p.focal = focalShift_;
p.alpha = &doc_.brushAlpha;
p.alphaUp = glm::normalize(q * glm::vec3(drag.x, -drag.y, 0.0f)); // the alpha's top follows the drag
if (strokePaint_) paintAt(p); // restoreStroke reverted the previous stamp's colours too
diff --git a/src/app/PanelMasking.cpp b/src/app/PanelMasking.cpp
index 40c2b5da..ed8ef333 100644
--- a/src/app/PanelMasking.cpp
+++ b/src/app/PanelMasking.cpp
@@ -17,6 +17,8 @@ namespace {
constexpr float kMaskDragThresholdPx = 4.0f; // movement that turns a Ctrl+click into a drag
+bool ctrlDown(SDL_Keymod mod) { return (mod & (SDL_KMOD_CTRL | SDL_KMOD_GUI)) != 0; }
+
bool anyMasked(const Mesh& mesh) {
return std::any_of(mesh.mask.begin(), mesh.mask.end(), [](float m) { return m > 0.0f; });
}
@@ -40,17 +42,29 @@ void App::beginMaskStroke(float x, float y) {
lastY_ = y;
residual_ = 0.0f;
lazyMouse_.reset(glm::vec2(x, y));
- firstDab(x, y);
+ // ZBrush: a Ctrl+click on the model blurs the mask (Ctrl+Alt+click sharpens it); only a drag paints. The
+ // pen's eraser end set to Erase mask paints straight away.
+ maskClickPending_ = ctrlDown(inputMods());
+ maskClickX_ = x;
+ maskClickY_ = y;
+ if (!maskClickPending_) firstDab(x, y);
+}
+
+void App::maskClickRelease() {
+ maskClickPending_ = false;
+ const bool sharpen = strokeInvert_;
+ endStroke(); // nothing was dabbed: no undo step
+ if (anyMasked(doc_.mesh)) runCommand(sharpen ? "mask_sharpen" : "mask_blur");
}
-// ZBrush convention: Ctrl+drag on the background clears the mask. With
-// nothing masked the drag zooms instead, as it did before masking existed.
+// ZBrush convention: Ctrl+drag on the background clears the mask. With nothing masked the SculptForge input
+// style zooms instead, as it did before masking existed; the ZBrush style does nothing.
void App::maskCanvasMove(float x, float y) {
if (maskCanvasMoved_) return;
if (std::hypot(x - maskCanvasX_, y - maskCanvasY_) < kMaskDragThresholdPx) return;
maskCanvasMoved_ = true;
if (anyMasked(doc_.mesh)) runCommand("mask_clear");
- else drag_ = Drag::Zoom;
+ else if (!zbrushStyle()) drag_ = Drag::Zoom;
}
void App::maskCanvasRelease() {
diff --git a/src/app/PanelPolygroups.cpp b/src/app/PanelPolygroups.cpp
index a686ebe7..79325c46 100644
--- a/src/app/PanelPolygroups.cpp
+++ b/src/app/PanelPolygroups.cpp
@@ -31,8 +31,9 @@ bool App::polygroupMouseDown(float x, float y, SDL_Keymod mod) {
void App::polygroupMouseUp() {
const bool alt = (inputMods() & SDL_KMOD_ALT) != 0;
if (!selectMoved_) {
- // Click: isolate the group under the cursor (again: invert), Alt hides it,
- // empty canvas shows everything.
+ // Click, as in ZBrush: on a fully visible mesh show only the group under the cursor; on a partly
+ // hidden one hide it (the group that is all that's left: invert the visibility). Alt always hides it,
+ // the empty canvas shows everything.
doc_.syncBvh();
RayHit hit;
if (!pick(selectPath_.front().x, selectPath_.front().y, hit)) {
@@ -40,13 +41,15 @@ void App::polygroupMouseUp() {
return;
}
const uint32_t group = doc_.mesh.polygroupAt(hit.triangle);
- if (alt) runCommand("hide_polygroup", {{"group", double(group)}});
- else if (polygroupIsolated(doc_.mesh, group)) runCommand("invert_visibility");
+ if (polygroupIsolated(doc_.mesh, group)) runCommand("invert_visibility");
+ else if (alt || doc_.mesh.hasHidden()) runCommand("hide_polygroup", {{"group", double(group)}});
else runCommand("isolate_polygroup", {{"group", double(group)}});
return;
}
- // Drag: keep the inside of the rectangle or lasso, or with Alt hide it.
- runSelection("hide_rect", "hide_lasso", {{"inside", alt}});
+ // Drag: keep the inside of the rectangle or lasso, or with Alt hide it. A shape around nothing (dragged on
+ // the background) reverses the visibility instead (ZBrush).
+ if (runSelection("hide_rect", "hide_lasso", {{"inside", alt}}) && !lastCommandOk_ && !alt && doc_.mesh.hasHidden())
+ runCommand("invert_visibility");
}
void App::drawPolygroupsSection() {
diff --git a/src/app/PanelPolypaint.cpp b/src/app/PanelPolypaint.cpp
index 9141648d..89a18f76 100644
--- a/src/app/PanelPolypaint.cpp
+++ b/src/app/PanelPolypaint.cpp
@@ -43,7 +43,9 @@ const BrushRecipe* App::strokeRecipe() const {
return strokeBrush_ == BrushType::Smooth || !strokeSculpt_ || strokeMask_ ? nullptr : activeRecipe();
}
-void App::paintAt(const DabParams& p) {
+void App::paintAt(const DabParams& dab) {
+ DabParams p = dab;
+ p.strength = rgbIntensity_ * dabStrengthScale_; // paint has its own strength (ZBrush RGB Intensity)
if (texturePainter_.active()) texturePainter_.dab(doc_.mesh, doc_.bvh, p, doc_.paintColor, symmetry_);
else if (!paintsTexture(doc_.mesh)) paintDab(doc_.sculptor, doc_.mesh, doc_.bvh, p, doc_.paintColor, symmetry_);
}
diff --git a/src/app/PanelProject.cpp b/src/app/PanelProject.cpp
index 6a3d124e..cf0eda16 100644
--- a/src/app/PanelProject.cpp
+++ b/src/app/PanelProject.cpp
@@ -223,6 +223,9 @@ void App::storeProjectSettings() {
brush.set("type", brushName(brush_));
brush.set("radius_px", double(radiusPx_));
brush.set("strength", double(strength_));
+ brush.set("smooth_strength", double(smoothStrength_));
+ brush.set("rgb_intensity", double(rgbIntensity_));
+ brush.set("focal_shift", double(focalShift_));
brush.set("invert", invertToggle_);
brush.set("front_faces_only", frontFacesOnly_);
brush.set("pressure_strength", pressureStrength_);
@@ -281,8 +284,14 @@ void App::applyProjectSettings() {
if (b["type"].asString() == brushName(BrushType(i))) brush_ = BrushType(i);
readFloat(b, "radius_px", radiusPx_);
readFloat(b, "strength", strength_);
+ readFloat(b, "smooth_strength", smoothStrength_);
+ readFloat(b, "rgb_intensity", rgbIntensity_);
+ readFloat(b, "focal_shift", focalShift_);
radiusPx_ = std::clamp(radiusPx_, 2.0f, 800.0f);
strength_ = std::clamp(strength_, 0.0f, 1.0f);
+ smoothStrength_ = std::clamp(smoothStrength_, 0.0f, 1.0f);
+ rgbIntensity_ = std::clamp(rgbIntensity_, 0.0f, 1.0f);
+ focalShift_ = std::clamp(focalShift_, -1.0f, 1.0f);
readBool(b, "invert", invertToggle_);
readBool(b, "front_faces_only", frontFacesOnly_);
readBool(b, "pressure_strength", pressureStrength_);
diff --git a/src/app/Pickers.cpp b/src/app/Pickers.cpp
index 634f63cd..a6eff97c 100644
--- a/src/app/Pickers.cpp
+++ b/src/app/Pickers.cpp
@@ -80,8 +80,9 @@ struct State {
// Material hover preview: the material to go back to.
bool previewing = false;
int savedMatcap = -1;
- // Draw Size / Strength at the cursor.
- int slider = -1; // 0 = size, 1 = strength
+ // Draw Size / Z Intensity / RGB Intensity / Focal Shift at the cursor.
+ int slider = -1; // PickerUi::Slider, -1 = closed
+ bool sliderSmooth = false; // Z Intensity of the Smooth brush (Shift was held)
ImVec2 sliderAt{0, 0};
int sliderFrame = -1;
std::string sliderTyped;
@@ -854,9 +855,10 @@ void openBrushPickerForShelf(ImVec2 anchor) {
bool pickerOpen() { return st().open || st().slider >= 0; }
-void PickerUi::sizePopup(App&, bool strength) {
+void PickerUi::sizePopup(App& app, Slider which) {
State& s = st();
- s.slider = strength ? 1 : 0;
+ s.slider = int(which);
+ s.sliderSmooth = app.activeBrush() == BrushType::Smooth;
s.sliderAt = ImGui::GetIO().MousePos;
s.sliderFrame = ImGui::GetFrameCount();
s.sliderTyped.clear();
@@ -934,10 +936,40 @@ void drawPickers(App& app) {
s.previewing = false;
}
- // Draw Size (S) / Strength (I) at the cursor.
+ // Draw Size (S), Z Intensity (U), RGB Intensity (I) and Focal Shift (O) at the cursor.
if (s.slider >= 0) {
ImGui::SetNextFrameWantCaptureKeyboard(true);
- const bool size = s.slider == 0;
+ const auto which = PickerUi::Slider(s.slider);
+ // The value as shown: Draw Size in pixels, the intensities 0-100 and Focal Shift -100..100, as in ZBrush.
+ struct Def {
+ const char* name;
+ const char* key;
+ const char* help;
+ float* value;
+ float lo, hi, shownScale;
+ };
+ float* z = s.sliderSmooth ? &app.smoothStrength_ : &app.strength_;
+ const Def d = which == PickerUi::Slider::DrawSize
+ ? Def{"Draw Size", "S",
+ "Brush radius in screen pixels. Drag, or type a number and press Enter. [ and ] also "
+ "change it.",
+ &app.radiusPx_, 2.0f, 800.0f, 1.0f}
+ : which == PickerUi::Slider::ZIntensity
+ ? Def{s.sliderSmooth ? "Smooth Z Intensity" : "Z Intensity", "U",
+ s.sliderSmooth ? "How strongly Smooth works (it keeps its own value, as in ZBrush: hold "
+ "Shift and press U to set it). Type a number and press Enter."
+ : "How strongly the brush changes the surface (1-100). Drag, or type a "
+ "number and press Enter.",
+ z, 0.01f, 1.0f, 100.0f}
+ : which == PickerUi::Slider::RgbIntensity
+ ? Def{"RGB Intensity", "I",
+ "How strongly painting colours the surface (1-100). Drag, or type a number and press "
+ "Enter.",
+ &app.rgbIntensity_, 0.01f, 1.0f, 100.0f}
+ : Def{"Focal Shift", "O",
+ "The brush falloff: below 0 a broad, hard tip, above 0 a soft point (-100..100). The "
+ "inner ring of the cursor shows it.",
+ &app.focalShift_, -1.0f, 1.0f, 100.0f};
const float w = 200.0f * app.uiScale_;
ImGui::SetNextWindowPos(ImVec2(s.sliderAt.x - w * 0.5f, s.sliderAt.y + 14.0f), ImGuiCond_Appearing);
if (s.sliderFrame == ImGui::GetFrameCount()) ImGui::SetNextWindowFocus();
@@ -945,10 +977,10 @@ void drawPickers(App& app) {
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(8, 8));
ImGui::PushStyleColor(ImGuiCol_WindowBg, kPanelBg);
bool close = false;
- if (ImGui::Begin(size ? "Draw Size##cursor" : "Strength##cursor", nullptr,
+ if (ImGui::Begin((std::string(d.name) + "##cursor").c_str(), nullptr,
ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoSavedSettings |
ImGuiWindowFlags_AlwaysAutoResize)) {
- const bool first = ImGui::GetFrameCount() < s.sliderFrame + 2; // the S / I key itself
+ const bool first = ImGui::GetFrameCount() < s.sliderFrame + 2; // the S / U / I / O key itself
// Typing a number sets it (Enter applies, Esc cancels); dragging the slider works too.
if (!first) {
for (int k = 0; k <= 9; ++k)
@@ -957,14 +989,19 @@ void drawPickers(App& app) {
s.sliderTyped += char('0' + k);
if (ImGui::IsKeyPressed(ImGuiKey_Period, false) || ImGui::IsKeyPressed(ImGuiKey_KeypadDecimal, false))
s.sliderTyped += '.';
+ if ((ImGui::IsKeyPressed(ImGuiKey_Minus, false) || ImGui::IsKeyPressed(ImGuiKey_KeypadSubtract, false)) &&
+ s.sliderTyped.empty() && d.lo < 0.0f)
+ s.sliderTyped += '-';
if (ImGui::IsKeyPressed(ImGuiKey_Backspace) && !s.sliderTyped.empty()) s.sliderTyped.pop_back();
if (ImGui::IsKeyPressed(ImGuiKey_Enter) || ImGui::IsKeyPressed(ImGuiKey_KeypadEnter)) {
if (!s.sliderTyped.empty()) {
- const float v = std::strtof(s.sliderTyped.c_str(), nullptr);
- if (size)
- app.radiusPx_ = std::clamp(v, 2.0f, 800.0f);
- else
- app.strength_ = std::clamp(v > 1.0f ? v / 100.0f : v, 0.01f, 1.0f);
+ float v = std::strtof(s.sliderTyped.c_str(), nullptr);
+ // Intensities: 0-100 as in ZBrush (a fraction up to 1 still works).
+ if (which == PickerUi::Slider::ZIntensity || which == PickerUi::Slider::RgbIntensity)
+ v = v > 1.0f ? v / 100.0f : v;
+ else if (which == PickerUi::Slider::FocalShift)
+ v /= 100.0f;
+ *d.value = std::clamp(v, d.lo, d.hi);
}
close = true;
}
@@ -973,19 +1010,18 @@ void drawPickers(App& app) {
ImGui::SetNextItemWidth(w);
char fmt[64];
if (!s.sliderTyped.empty())
- std::snprintf(fmt, sizeof fmt, "%s %s_", size ? "Draw Size" : "Strength", s.sliderTyped.c_str());
+ std::snprintf(fmt, sizeof fmt, "%s %s_", d.name, s.sliderTyped.c_str());
else
- std::snprintf(fmt, sizeof fmt, "%s", size ? "Draw Size %.0f" : "Strength %.2f");
- if (size)
- ImGui::SliderFloat("##cursorvalue", &app.radiusPx_, 2.0f, 800.0f, fmt, ImGuiSliderFlags_Logarithmic);
- else
- ImGui::SliderFloat("##cursorvalue", &app.strength_, 0.01f, 1.0f, fmt);
- ImGui::LogText(size ? "Draw Size %.0f" : "Strength %.2f", size ? app.radiusPx_ : app.strength_);
- ui::HelpText(
- size ? "Draw Size" : "Strength", size ? "S" : "I",
- size ? "Brush radius in screen pixels. Drag, or type a number and press Enter. [ and ] also change it."
- : "How strongly the brush works (0.01-1). Drag, or type a number and press Enter.",
- "Draw");
+ std::snprintf(fmt, sizeof fmt, "%s %%.0f", d.name);
+ if (which == PickerUi::Slider::DrawSize) {
+ ImGui::SliderFloat("##cursorvalue", d.value, d.lo, d.hi, fmt, ImGuiSliderFlags_Logarithmic);
+ } else {
+ float shown = *d.value * d.shownScale;
+ if (ImGui::SliderFloat("##cursorvalue", &shown, d.lo * d.shownScale, d.hi * d.shownScale, fmt))
+ *d.value = std::clamp(shown / d.shownScale, d.lo, d.hi);
+ }
+ ImGui::LogText("%s %.0f", d.name, double(*d.value * d.shownScale));
+ ui::HelpText(d.name, d.key, d.help, "Draw");
if (ImGui::IsItemActive())
s.sliderWasActive = true;
else if (s.sliderWasActive)
diff --git a/src/app/Pickers.h b/src/app/Pickers.h
index d9a8d76a..7b312211 100644
--- a/src/app/Pickers.h
+++ b/src/app/Pickers.h
@@ -49,7 +49,10 @@ struct PickerUi {
static bool isActive(const App& app, const BrushItem& item);
static void select(App& app, const BrushItem& item);
static ImTextureID thumbnail(App& app, const BrushItem& item);
- static void sizePopup(App& app, bool strength); // opens the S / I slider under the mouse
+ // Opens a slider under the mouse (ZBrush S / U / I / O): Draw Size, Z Intensity (Smooth's own while Shift is
+ // held or Smooth is the brush), RGB Intensity or Focal Shift.
+ enum class Slider { DrawSize, ZIntensity, RgbIntensity, FocalShift };
+ static void sizePopup(App& app, Slider which);
};
// Action id of a brush for the shelves ("brush.clay", "brush.paint", "brush.recipe.<name>").
diff --git a/src/app/Shell.cpp b/src/app/Shell.cpp
index c193fba2..4053a63a 100644
--- a/src/app/Shell.cpp
+++ b/src/app/Shell.cpp
@@ -1197,9 +1197,7 @@ void App::drawShelfItem(int shelf, int index, const std::string& item, bool vert
ui::SliderInside("##drawsize", &radiusPx_, 2.0f, 800.0f, "Draw Size %.0f", ImGuiSliderFlags_Logarithmic);
ui::HelpText("Draw Size", "S", "Brush radius in screen pixels. [ and ] change it by 10%; Ctrl+click to type.", "Draw");
} else {
- ui::SliderInside("##strength", &strength_, 0.01f, 1.0f, "Strength %.2f");
- ui::HelpText("Strength", "I", "How strongly each dab changes the surface (ZBrush Z Intensity); Ctrl+click to type.",
- "Draw");
+ drawZIntensitySlider("##strength");
}
ImGui::PopStyleVar();
} else if (item == "widget.points") {
diff --git a/src/app/UiTest.cpp b/src/app/UiTest.cpp
index 0bbab85d..33c32223 100644
--- a/src/app/UiTest.cpp
+++ b/src/app/UiTest.cpp
@@ -8,7 +8,7 @@
//
// click LABEL / double_click LABEL / right_click LABEL / hover LABEL
// type LABEL TEXT click a text field and type into it
-// key COMBO e.g. enter, escape, ctrl+z, ctrl+shift+z, 3, comma, backtick, tab, f3
+// key COMBO e.g. enter, escape, ctrl+z, ctrl+shift+z, 3, comma, backtick, tab, f3, space, minus
// hold MODS ctrl / shift / alt / ctrl+shift ... or none (for strokes and drags)
// stroke U0 V0 U1 V1 [S] brush stroke across the model (fractions of its on-screen bounds)
// drag X0 Y0 X1 Y1 [S] [release] left-drag in window fractions (rectangle hide, sliders...); release:
@@ -67,6 +67,9 @@
// antialiasing (Preferences > Performance: 1, 2, 4, 8), view_samples (what the interactive
// view draws with now: 1 while Fast Navigation moves a big scene), multithreading (1 on),
// last_stroke_dabs (dabs of the last finished stroke)
+// z_intensity, smooth_intensity, rgb_intensity (0-100), focal_shift (-100..100), draw_size,
+// quickmenu_open, lazy_mouse, input_style (0 ZBrush, 1 SculptForge), brush_type (BrushType
+// index, -1 for a custom brush or Paint), last_dab_x / last_dab_y (window pixels), paint_r
// gizmo_mode (0 Draw, 1 Move, 2 Scale, 3 Rotate), gizmo_hover (handle under the cursor,
// 0 = none, in gizmo_drag's order from 1), gizmo_falloff, pivot_x / pivot_y / pivot_z,
// center_x / center_y / center_z and size_x / size_y / size_z (active mesh bounds)
@@ -264,6 +267,19 @@ double Demo::query(const std::string& name, bool& known) const {
const int k = name.back() == 'r' ? 0 : name.back() == 'g' ? 1 : 2;
return sum[k] / double(px.size() / 4);
}
+ // ZBrush feel (Input.cpp): the intensities and Focal Shift as shown (0-100, -100..100).
+ if (name == "z_intensity") return std::round(app_.strength_ * 100.0f);
+ if (name == "smooth_intensity") return std::round(app_.smoothStrength_ * 100.0f);
+ if (name == "rgb_intensity") return std::round(app_.rgbIntensity_ * 100.0f);
+ if (name == "focal_shift") return std::round(app_.focalShift_ * 100.0f);
+ if (name == "draw_size") return std::round(app_.radiusPx_);
+ if (name == "quickmenu_open") return app_.quickMenu_.open ? 1.0 : 0.0;
+ if (name == "lazy_mouse") return app_.strokeType_ == StrokeType::LazyMouse ? 1.0 : 0.0;
+ if (name == "input_style") return double(app_.uiPrefs_.inputStyle);
+ if (name == "brush_type") return app_.doc_.activeBrush >= 0 || app_.paintMode_ ? -1.0 : double(int(app_.brush_));
+ if (name == "last_dab_x") return app_.lastDabScreen_.x;
+ if (name == "last_dab_y") return app_.lastDabScreen_.y;
+ if (name == "paint_r") return std::round(255.0f * linearToSrgb(app_.doc_.paintColor).x);
if (name == "gizmo_mode") return double(int(app_.gizmo_.mode));
if (name == "gizmo_hover") return double(int(app_.gizmo_.hover));
if (name == "gizmo_falloff") return app_.gizmo_.falloff;
@@ -440,6 +456,8 @@ void Demo::testKey(int line, const std::string& combo) {
else if (lower == "backtick" || lower == "grave") keyName = "`";
else if (lower == "tab") keyName = "Tab";
else if (lower == "f3") keyName = "F3";
+ else if (lower == "space") keyName = "Space";
+ else if (lower == "minus") keyName = "-";
const SDL_Keycode key = SDL_GetKeyFromName(keyName.c_str());
if (key == SDLK_UNKNOWN) {
run([this, line, keyName] { fail(line, "unknown key \"" + keyName + "\""); });
diff --git a/src/core/Masking.cpp b/src/core/Masking.cpp
index 436164df..8ed72942 100644
--- a/src/core/Masking.cpp
+++ b/src/core/Masking.cpp
@@ -187,7 +187,7 @@ void Sculptor::dabMask(Mesh& mesh, const BVH& bvh, const DabParams& p, Symmetry
const uint32_t v = verts_[i];
weights_[i] = -1.0f; // unchanged
if (p.frontFacesOnly && glm::dot(mesh.normals[v], viewDir) > 0.0f) continue;
- const float a = s * brushFalloff(glm::distance(mesh.positions[v], center), p.radius);
+ const float a = s * brushFalloff(glm::distance(mesh.positions[v], center), p.radius, p.focal);
if (a <= 0.0f) continue;
const float m = p.invert ? mask[v] * (1.0f - a) : mask[v] + (1.0f - mask[v]) * a;
if (m != mask[v]) weights_[i] = m;
diff --git a/src/core/Polypaint.cpp b/src/core/Polypaint.cpp
index ce9d5cc7..1b6245d3 100644
--- a/src/core/Polypaint.cpp
+++ b/src/core/Polypaint.cpp
@@ -123,7 +123,7 @@ size_t paintDab(Sculptor& sculptor, Mesh& mesh, const BVH& bvh, const DabParams&
brushVertices(mesh, bvh, center, p.radius, verts);
for (uint32_t v : verts) {
if (p.frontFacesOnly && v < mesh.normals.size() && glm::dot(mesh.normals[v], viewDir) > 0.0f) continue;
- const float w = brushFalloff(glm::distance(mesh.positions[v], center), p.radius) * s * vertexInfluence(mesh, v);
+ const float w = brushFalloff(glm::distance(mesh.positions[v], center), p.radius, p.focal) * s * vertexInfluence(mesh, v);
if (w <= 0.0f) continue;
sculptor.recordColor(mesh, v);
paintVertex(mesh, v, color, w, p.invert); // Alt paints Base back to white, erases a layer
diff --git a/src/core/Sculpt.cpp b/src/core/Sculpt.cpp
index f1830d14..6e41f95a 100644
--- a/src/core/Sculpt.cpp
+++ b/src/core/Sculpt.cpp
@@ -31,11 +31,18 @@ const char* brushName(BrushType type) {
}
}
-float brushFalloff(float dist, float radius) {
+float brushFalloff(float dist, float radius, float focal) {
float t = std::clamp(1.0f - dist / radius, 0.0f, 1.0f);
+ if (focal != 0.0f) t = std::pow(t, std::exp2(2.0f * std::clamp(focal, -1.0f, 1.0f))); // x4 .. x1/4
return t * t * (3.0f - 2.0f * t);
}
+float focalRingFraction(float focal) {
+ // smoothstep(t') = 0.5 at t' = 0.5, and t' = t^k.
+ const float k = std::exp2(2.0f * std::clamp(focal, -1.0f, 1.0f));
+ return 1.0f - std::pow(0.5f, 1.0f / k);
+}
+
void brushVertices(const Mesh& mesh, const BVH& bvh, const glm::vec3& center, float radius, std::vector<uint32_t>& out) {
bvh.queryVertices(mesh, center, radius, out);
if (mesh.hasHidden()) std::erase_if(out, [&](uint32_t v) { return mesh.vertexHidden(v); });
@@ -320,7 +327,7 @@ void Sculptor::dabSingle(Mesh& mesh, BVH& bvh, BrushType type, const DabParams&
// Weighted area normal and centre of the brush region.
const AreaSums sums = areaSums(verts_.size(), [&](size_t i, AreaSums& acc) {
const uint32_t v = verts_[i];
- float w = brushFalloff(glm::distance(pos[v], p.center), p.radius);
+ float w = brushFalloff(glm::distance(pos[v], p.center), p.radius, p.focal);
acc.normal += nrm[v] * w;
acc.center += pos[v] * w;
acc.weight += w;
@@ -354,7 +361,7 @@ void Sculptor::dabSingle(Mesh& mesh, BVH& bvh, BrushType type, const DabParams&
const glm::vec3& x = pos[v];
const glm::vec3 o = x - p.center;
const float f = useAlpha ? p.alpha->sample(glm::dot(o, right) / r, glm::dot(o, up) / r)
- : brushFalloff(glm::length(o), r);
+ : brushFalloff(glm::length(o), r, p.focal);
glm::vec3 d(0.0f);
switch (type) {
@@ -639,7 +646,7 @@ void Sculptor::beginGrab(Mesh& mesh, BVH& bvh, const DabParams& p, Symmetry sym)
glm::vec3 c = p.center * m;
brushVertices(mesh, bvh, c, p.radius, verts_);
for (uint32_t v : verts_) {
- float w = brushFalloff(glm::distance(mesh.positions[v], c), p.radius) *
+ float w = brushFalloff(glm::distance(mesh.positions[v], c), p.radius, p.focal) *
std::clamp(p.strength * 2.0f, 0.0f, 1.0f);
if (w <= 0.0f) continue;
grabVerts_.push_back(v);
diff --git a/src/core/Sculpt.h b/src/core/Sculpt.h
index f20ddf10..7e280740 100644
--- a/src/core/Sculpt.h
+++ b/src/core/Sculpt.h
@@ -39,6 +39,7 @@ struct DabParams {
glm::vec3 strokeDelta{0.0f}; // world-space movement since the previous dab (recipe, SnakeHook, Nudge, DamStandard)
const BrushAlpha* alpha = nullptr; // stamp shaping the falloff (null/empty = round)
glm::vec3 alphaUp{0.0f, 1.0f, 0.0f}; // world direction of the alpha's top edge (screen up, or rotated)
+ float focal = 0.0f; // ZBrush Focal Shift, -1..1 (see brushFalloff); recipes keep their own tip
};
struct Symmetry {
@@ -57,8 +58,12 @@ inline float vertexInfluence(const Mesh& mesh, uint32_t v) {
}
// Vertices within `radius` of `center` that a brush may touch (fully hidden ones excluded).
void brushVertices(const Mesh& mesh, const BVH& bvh, const glm::vec3& center, float radius, std::vector<uint32_t>& out);
-// Smoothstep brush falloff: 1 at the centre, 0 at `radius`.
-float brushFalloff(float dist, float radius);
+// Smoothstep brush falloff: 1 at the centre, 0 at `radius`. `focal` is ZBrush's Focal Shift (-1..1): below 0
+// the full-strength centre widens (a harder, broader tip), above 0 it narrows to a softer point; 0 is the plain
+// smoothstep, unchanged.
+float brushFalloff(float dist, float radius, float focal = 0.0f);
+// Where brushFalloff drops to one half, as a fraction of the radius (the brush cursor's inner ring).
+float focalRingFraction(float focal);
// Where brush time goes (core/Benchmark.h, Help > Performance): milliseconds summed over dabs since the
// counters were last zeroed. kernel = finding the vertices and moving / masking / painting them.
diff --git a/src/core/Texture.cpp b/src/core/Texture.cpp
index 090dd7bc..a3c7f885 100644
--- a/src/core/Texture.cpp
+++ b/src/core/Texture.cpp
@@ -656,7 +656,7 @@ size_t TexturePainter::dab(Mesh& mesh, const BVH& bvh, const DabParams& p, const
const glm::vec3 N = normals ? N0 * b.x + N1 * b.y + N2 * b.z : faceN;
if (glm::dot(N, viewDir) > 0.0f) return;
const float f = useAlpha ? p.alpha->sample(glm::dot(o, aRight) / r, glm::dot(o, aUp) / r)
- : brushFalloff(std::sqrt(d2), r);
+ : brushFalloff(std::sqrt(d2), r, p.focal);
const float wgt = f * s * (1.0f - std::clamp(m0 * b.x + m1 * b.y + m2 * b.z, 0.0f, 1.0f));
if (wgt <= 0.0f) return;
const uint32_t ti2 = uint32_t(y / kTextureTile) * uint32_t(tilesX_) + uint32_t(x / kTextureTile);
diff --git a/tests/test_lightbox.cpp b/tests/test_lightbox.cpp
index 8269fc83..8d6bf680 100644
--- a/tests/test_lightbox.cpp
+++ b/tests/test_lightbox.cpp
@@ -196,7 +196,7 @@ TEST(brush_popup_letter_keys) {
if (names[i] == brush) return c;
return '\0';
};
- // B, then S: Standard is T, Smooth M, SnakeHook N (ZBrush's B S T = Standard).
+ // B, then S: Standard is T, Smooth M, SnakeHook H (ZBrush's B S T, B S M, B S H).
bool substring = true;
auto kept = filterByTyped(names, "s", &substring);
CHECK(!substring);
@@ -204,15 +204,21 @@ TEST(brush_popup_letter_keys) {
auto badges = letterBadges(names, kept, "s");
CHECK(keyOf(badges, "Standard") == 't');
CHECK(keyOf(badges, "Smooth") == 'm');
- CHECK(keyOf(badges, "SnakeHook") == 'n');
- // C: Clay L, Crease R, ClayBuildup A, and the custom "Clay Buildup" the next free letter (Y).
+ CHECK(keyOf(badges, "SnakeHook") == 'h');
+ // C: Clay L, Crease R, ClayBuildup B (ZBrush's B C B), and the custom "Clay Buildup" the first free letter (A).
kept = filterByTyped(names, "c");
badges = letterBadges(names, kept, "c");
CHECK(kept.size() == 4);
CHECK(keyOf(badges, "Clay") == 'l');
CHECK(keyOf(badges, "Crease") == 'r');
- CHECK(keyOf(badges, "ClayBuildup") == 'a');
- CHECK(keyOf(badges, "Clay Buildup") == 'y');
+ CHECK(keyOf(badges, "ClayBuildup") == 'b');
+ CHECK(keyOf(badges, "Clay Buildup") == 'a');
+ // ZBrush's keys for the brushes both apps have: B D S, B M V, B I N, B P I.
+ CHECK(keyOf(letterBadges(names, filterByTyped(names, "d"), "d"), "DamStandard") == 's');
+ CHECK(keyOf(letterBadges(names, filterByTyped(names, "m"), "m"), "Move") == 'v');
+ CHECK(keyOf(letterBadges(names, filterByTyped(names, "i"), "i"), "Inflate") == 'n');
+ CHECK(keyOf(letterBadges(names, filterByTyped(names, "p"), "p"), "Pinch") == 'i');
+ CHECK(keyOf(letterBadges(names, filterByTyped(names, "s"), "s"), "SnakeHook") == 'h');
// Every key is unique.
for (size_t i = 0; i < badges.size(); ++i)
for (size_t j = i + 1; j < badges.size(); ++j)
diff --git a/tests/ui/lightbox.sfui b/tests/ui/lightbox.sfui
index b411d22c..9db80443 100644
--- a/tests/ui/lightbox.sfui
+++ b/tests/ui/lightbox.sfui
@@ -1,6 +1,6 @@
# LightBox (comma key): tabs, history, loading models, appending SubTools, materials,
# brushes, QuickSave; then the ZBrush-style pickers: the brush pop-up (B, type letters,
-# press the orange key), the material pop-up (M) and Draw Size / Strength at the cursor (S / I).
+# press the orange key), the material pop-up (M) and Draw Size / Z Intensity at the cursor (S / U).
run new_plane resolution=8
expect_value triangles == 128
expect_value lightbox_open == 0 # (the window; "LightBox" is also the top-shelf button)
@@ -102,7 +102,7 @@ expect_status Brush: Standard
# Backspace undoes a letter, Esc closes without picking.
key b
key s
-key n
+key h
expect_status Brush: SnakeHook
key b
key z
@@ -125,7 +125,7 @@ click "Materials/Bronze"
expect_status Material: Bronze
expect_not "Materials/Red Wax"
-# Draw Size / Strength at the cursor: type a number and press Enter.
+# Draw Size / Z Intensity at the cursor: type a number and press Enter.
key s
expect "##cursorvalue"
expect_text Draw Size 60
@@ -136,9 +136,9 @@ key enter
key s
expect_text Draw Size 120
key escape
-key i
+key u
expect "##cursorvalue"
-expect_text Strength 0.50
+expect_text Z Intensity 50
shot strength-popup
key escape
-expect_not "##cursorvalue" # (the top shelf always shows its own Strength slider)
+expect_not "##cursorvalue" # (the top shelf always shows its own Z Intensity slider)
diff --git a/tests/ui/multires.sfui b/tests/ui/multires.sfui
index f2904709..682aad4c 100644
--- a/tests/ui/multires.sfui
+++ b/tests/ui/multires.sfui
@@ -51,8 +51,10 @@ click "Display##tool.display"
click "Wireframe##display"
click "Geometry##tool.geometry"
-# Fine detail at the top level.
-key 1
+# Fine detail at the top level (B S T: Standard).
+key b
+key s
+key t
snapshot
stroke 0.25 0.35 0.75 0.4
stroke 0.3 0.5 0.7 0.55
diff --git a/tests/ui/tablet.sfui b/tests/ui/tablet.sfui
index dce88ecb..41ed41f4 100644
--- a/tests/ui/tablet.sfui
+++ b/tests/ui/tablet.sfui
@@ -109,6 +109,9 @@ click "##Eraser"
click "Erase mask##Eraser"
expect_text Erase mask
key escape
+# (The mouse paints the mask: the pen leaves first, or its proximity would keep the mouse's moves out, and a
+# Ctrl+click that never moves blurs the mask instead of painting it.)
+pen_out
hold ctrl
stroke 0.2 0.5 0.8 0.5
hold none
diff --git a/tests/ui/zbrush_feel.sfui b/tests/ui/zbrush_feel.sfui
new file mode 100644
index 00000000..95351551
--- /dev/null
+++ b/tests/ui/zbrush_feel.sfui
@@ -0,0 +1,234 @@
+# The ZBrush feel (docs/zbrush-parity.md): U / I / O at the cursor, Smooth's own Z Intensity, ZBrush's brush
+# letters, L, V, Space QuickMenu, the mask keys (Ctrl+A, Ctrl+Shift+A, Ctrl+I, Ctrl+H), Ctrl+click to blur and
+# Ctrl+Alt+click to sharpen the mask, Ctrl+W, Ctrl+Shift+click on a partly hidden mesh, Shift-constrained
+# straight strokes, Shift+click / release Shift / drag to roll, and the ZBrush / SculptForge input styles.
+run new_sphere subdivisions=5
+expect_value input_style == 0
+
+# --- U / I / O: Z Intensity, RGB Intensity and Focal Shift at the cursor (typed in ZBrush's 0-100) ---
+mouse_move 0.5 0.5
+key u
+expect_text Z Intensity 50
+key 2
+key 5
+key enter
+expect_value z_intensity == 25
+key i
+expect_text RGB Intensity 100
+shot rgb-popup
+key escape
+expect_value rgb_intensity == 100
+key o
+expect_text Focal Shift 0
+key minus
+key 6
+key 0
+key enter
+expect_value focal_shift == -60
+mouse_move 0.5 0.5
+shot focal-hard-ring
+key o
+key 6
+key 0
+key enter
+expect_value focal_shift == 60
+mouse_move 0.5 0.5
+shot focal-soft-ring
+key o
+key 0
+key enter
+expect_value focal_shift == 0
+
+# Smooth keeps its own Z Intensity: with Shift held, U shows and sets Smooth's value.
+hold shift
+key u
+expect_text Smooth Z Intensity 50
+key 8
+key 0
+key enter
+hold none
+expect_value smooth_intensity == 80
+expect_value z_intensity == 25
+
+# The Draw palette shows the new sliders, with Ctrl-hover help.
+click "Draw##palette.draw"
+expect_text RGB Intensity 100
+expect_text Focal Shift 0
+hold ctrl
+hover "##focalshift"
+expect_help "soft point"
+hold none
+shot draw-palette
+
+# --- ZBrush's brush letters: B C B ClayBuildup, B D S DamStandard, B M V Move, B I N Inflate, B S T Standard ---
+key b
+key c
+shot picker-c
+key b
+expect_value brush_type == 9
+key b
+key d
+key s
+expect_value brush_type == 8
+key b
+key m
+key v
+expect_value brush_type == 3
+key b
+key i
+key n
+expect_value brush_type == 4
+key b
+key s
+key t
+expect_value brush_type == 0
+# In the ZBrush style the number keys don't pick brushes.
+key 3
+expect_value brush_type == 0
+
+# --- L: LazyMouse on and off; V: swap the main and secondary colour ---
+key l
+expect_value lazy_mouse == 1
+key l
+expect_value lazy_mouse == 0
+remember paint_r red0
+key v
+expect_value paint_r != $red0
+key v
+expect_value paint_r == $red0
+
+# --- Space: the QuickMenu under the cursor (a tap keeps it open; Esc closes) ---
+mouse_move 0.5 0.5
+key space
+expect_value quickmenu_open == 1
+expect "##qm_drawsize"
+expect_text Focal Shift 0
+shot quickmenu
+key escape
+expect_value quickmenu_open == 0
+
+# --- The mask keys ---
+key ctrl+a
+expect_value masked > 5000
+key ctrl+shift+a
+expect_value masked == 0
+key ctrl+i
+expect_value masked > 5000
+expect_value show_mask == 1
+key ctrl+h
+expect_value show_mask == 0
+key ctrl+h
+expect_value show_mask == 1
+key ctrl+shift+a
+
+# --- Ctrl+click on the model blurs the mask, Ctrl+Alt+click sharpens it; a Ctrl+drag still paints ---
+hold ctrl
+stroke 0.2 0.5 0.8 0.5
+hold none
+expect_value masked > 100
+remember masked painted
+hold ctrl
+drag_path 0.5 0.3 0.5 0.3
+hold none
+expect_value masked != $painted
+remember masked blurred
+shot mask-blurred
+hold ctrl+alt
+drag_path 0.5 0.3 0.5 0.3
+hold none
+expect_value masked != $blurred
+shot mask-sharpened
+
+# --- Ctrl+W: the masked part becomes a polygroup and the mask is cleared ---
+remember groups g0
+key ctrl+w
+expect_value groups > $g0
+expect_value masked == 0
+expect_value show_polygroups == 1
+shot group-masked
+
+# ZBrush style: Ctrl+drag on the background with nothing masked does nothing (SculptForge's zoom is a preference).
+remember camera_distance d0
+hold ctrl
+drag 0.12 0.3 0.12 0.7
+hold none
+expect_value camera_distance == $d0
+
+# --- Visibility: Ctrl+Shift+click on a partly hidden mesh hides the group clicked ---
+# Hide the top with Ctrl+Shift+Alt+drag, then Ctrl+Shift+click the equator band (the new group).
+hold ctrl+shift+alt
+drag_path -0.2 -0.2 1.2 0.2
+hold none
+expect_value hidden > 0
+remember hidden h1
+hold ctrl+shift
+drag_path 0.5 0.5 0.5 0.5
+hold none
+expect_value hidden > $h1
+shot group-hidden
+# A Ctrl+Shift rectangle dragged around nothing (on the background) reverses the visibility.
+remember hidden h2
+hold ctrl+shift
+drag_path 1.3 0.1 1.6 0.4
+hold none
+expect_value hidden != $h2
+shot visibility-reversed
+hold ctrl+shift
+drag_path 1.5 0.5 1.5 0.5
+hold none
+expect_value hidden == 0
+
+# --- Shift pressed after a stroke starts: a straight line, snapped to 45 degrees ---
+key ctrl+shift+a
+drag_path 0.25 0.6 0.3 0.6 keep
+remember last_dab_y y0
+hold shift
+mouse_move 0.5 0.66
+mouse_move 0.7 0.55
+mouse_move 0.75 0.62
+expect_value last_dab_y == $y0
+expect_value last_dab_x > 0
+release
+hold none
+shot straight-line
+
+# --- Shift+click the background, let go of Shift, drag: roll the view about its axis ---
+key f
+expect_value camera_roll == 0
+hold shift
+drag_path 1.5 0.2 1.5 0.2 keep
+hold none
+mouse_move 1.5 0.8
+mouse_move 1.4 1.0
+release
+expect_value camera_roll != 0
+shot rolled
+key f
+
+# --- Preferences > Input: the SculptForge style brings back 1-0 brushes, I = Z Intensity, Ctrl+drag zoom ---
+click "Preferences##palette.preferences"
+click "Input##preferences.input"
+hold ctrl
+hover "SculptForge##input.style_sculptforge"
+expect_help "1-9 and 0"
+hold none
+shot preferences-input
+click "SculptForge##input.style_sculptforge"
+expect_value input_style == 1
+key 3
+expect_value brush_type == 2
+key i
+# 3 picked Smooth, so U shows its own value.
+expect_text Smooth Z Intensity 80
+key escape
+remember camera_distance d1
+hold ctrl
+drag 0.12 0.3 0.12 0.7
+hold none
+expect_value camera_distance != $d1
+key f
+click "Preferences##palette.preferences"
+click "ZBrush##input.style_zbrush"
+expect_value input_style == 0
+key 1
+expect_value brush_type == 2