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.
C++ 3d3d-sculptingcppdear-imguidigital-sculptingfbxgame-developmentgaussian-splattinggltfimage-to-3dmcpopenglopenusdsculptingtext-to-3dunreal-engine
v0.2 integration: cross-feature tests, docs for the merged features
islandmed21dbfc9be555
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 140ef8d6..7be32d01 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -4,6 +4,49 @@ All notable changes to SculptForge are listed here. The format follows[Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and the project uses[Semantic Versioning](https://semver.org/).+## [Unreleased]++### Sculpting+- New brushes: Dam Standard, Clay Buildup, Snake Hook, Trim (dynamic; Alt fills), Layer and Nudge. Keys 1-9 and 0+ select the first ten brushes.+- Stroke types: dots, drag-rect, spray and lazy mouse.+- Brush alphas: round, square, noise or any grayscale image (`brush_set_alpha`).+- Mesh attributes shared by every tool: mask, polypaint, polygroups, hidden faces and UVs.++### Masking+- Hold Ctrl while stroking to paint the mask, Ctrl+Alt to erase it. Ctrl+click the background inverts it and+ Ctrl+drag there clears it. Every brush and polypaint leave masked areas alone.+- Commands `mask_clear`, `mask_all`, `mask_invert`, `mask_blur`, `mask_sharpen`, `mask_grow`, `mask_shrink`,+ `mask_by_cavity` and `mask_by_polygroup`, plus a Masking section in the Tools panel.++### Polygroups and visibility+- `polygroup_auto_by_normals`, `polygroup_by_connectivity`, `polygroup_from_mask`, `polygroup_clear`,+ `polygroup_merge_visible`.+- ZBrush-style visibility: Ctrl+Shift+click isolates a polygroup (click again to invert), Ctrl+Shift+Alt+click+ hides it, Ctrl+Shift+click on the background shows everything, Ctrl+Shift+drag hides outside a rectangle (Alt:+ inside). Commands `hide_polygroup`, `isolate_polygroup`, `show_all`, `invert_visibility`, `hide_rect` and+ `delete_hidden`. Brushes, polypaint and mask operations skip hidden faces.++### Polypaint and materials+- Paint brush (P), "RGB while sculpting", colour pick (C), and the `set_color`, `paint_fill`, `paint_clear` and+ `paint_from_cavity` commands. Fills respect the mask by default.+- Six built-in MatCap materials (Red Wax, Clay, Skin, Chrome, White, Bronze) in a new Polypaint & Materials panel.+- Vertex colours are exported to PLY (`export_ply`), USD (`displayColor`), glTF, OBJ and GoZ.++### Projects+- Native `.sfproj` project files (`save_project`, `open_project`, and `open`) hold the mesh, sculpt layers, mask,+ polypaint, polygroups, visibility, UVs, splats, the brush library and view settings.+- Ctrl+S / Ctrl+Shift+S save a project; OBJ export moved to File > Export OBJ.+- Save / Don't Save / Cancel prompt before losing unsaved changes, unsaved marker in the title bar, recent files,+ and autosave with an offer to restore after a crash.++### Interchange+- ZBrush GoZ: `.GoZ` import and export with polygroups, mask, polypaint and UVs (quads are kept), and the GoZ+ bridge (`goz_send`, `goz_receive`, File > ZBrush (GoZ)) on Windows and macOS. The format follows the open-source+ GoB add-on; the live bridge has not yet been tested against a running ZBrush. See [docs/goz.md](docs/goz.md).+- STL import and export (binary and ASCII). Opening a `.ZTL`/`.ZPR` file now explains that the format is+ proprietary and suggests GoZ or OBJ/FBX.+## [0.1.0] - 2026-10-20First public release.@@ -37,4 +80,5 @@ First public release.- Rez package (`packaging/rez`).- Headless thumbnail/turntable rendering and scripted demo recording.+[Unreleased]: https://github.com/islandmed/SculptForge/compare/v0.1.0...HEAD[0.1.0]: https://github.com/islandmed/SculptForge/releases/tag/v0.1.0diff --git a/README.md b/README.mdindex 212a02c6..a4194142 100644--- a/README.md+++ b/README.md@@ -48,19 +48,30 @@ Plug in Claude, fal.ai or Meshy, or run models entirely on your own machine.| Image or text → sculptable 3D model | **Built in** (free models) | No || Gaussian splats, OpenUSD / USDZ | **Built in** | No || AI agents (MCP), headless scripting | **Built in** | ZScript |-| Multiresolution (subdivision levels), ZRemesher-class retopology, polypaint, UVs | Not yet ([roadmap](ROADMAP.md)) | Yes |+| Masking, polygroups, visibility (Ctrl / Ctrl+Shift), polypaint, MatCaps | **Yes** (development version) | Yes |+| GoZ exchange with ZBrush | **Yes** (development version; not yet tested against a live ZBrush) | Yes |+| Multiresolution (subdivision levels), dynamic topology, ZRemesher-class retopology, UV unwrapping | Not yet ([roadmap](ROADMAP.md)) | Yes |-SculptForge doesn't read ZBrush's proprietary `.ZTL`/`.ZPR` files; bring models over as OBJ, FBX or GLB.+SculptForge doesn't read ZBrush's proprietary `.ZTL`/`.ZPR` files; bring models over with GoZ (`.GoZ` files+keep polygroups, mask and polypaint) or as OBJ, FBX or GLB.> **Status: early release (v0.1).** The core sculpting, pipeline and AI features work and are tested on every-> commit. Multiresolution sculpting, masking, retopology, UVs and texture painting are still on the-> [roadmap](ROADMAP.md).+> commit. The development version on `main` adds masking, polygroups, polypaint, project files and GoZ (see the+> [changelog](CHANGELOG.md)). Multiresolution sculpting, dynamic topology, retopology, UV unwrapping and texture+> painting are still on the [roadmap](ROADMAP.md).## Features**Sculpting**-- Standard, Clay, Smooth, Move, Inflate, Crease, Flatten and Pinch brushes; X/Y/Z symmetry; tablet pressure;- ZBrush-style modifiers and navigation.+- Standard, Clay, Smooth, Move, Inflate, Crease, Flatten, Pinch, Dam Standard, Clay Buildup, Snake Hook, Trim,+ Layer and Nudge brushes; X/Y/Z symmetry; tablet pressure; ZBrush-style modifiers and navigation.+- Stroke types (dots, drag-rect, spray, lazy mouse) and brush alphas (built-in or any grayscale image).+- **Masking** (Ctrl to paint, invert, blur, sharpen, grow/shrink, mask by cavity or polygroup) that every brush+ respects.+- **Polygroups and visibility** the ZBrush way: auto groups, Ctrl+Shift isolate / hide, rectangle hide, delete+ hidden.+- **Polypaint** (Paint brush, RGB while sculpting, fills, cavity paint) and six MatCap materials.+- **Project files** (`.sfproj`) that keep everything, with an unsaved-changes prompt, recent files and autosave.- Unlimited undo, Loop subdivision, **voxel remesh** (DynaMesh-style) and quadric decimation.- **Sculpt layers** that work as blend shapes, with live weights and playback.@@ -84,7 +95,11 @@ SculptForge doesn't read ZBrush's proprietary `.ZTL`/`.ZPR` files; bring modelsanother one on your network, with no plugin to install. Static meshes come with LODs, skeletal meshes withmorph targets. See [docs/unreal.md](docs/unreal.md).- **FBX** (binary 7.4, LOD groups, blend shapes), **glTF/GLB** (morph targets), **OpenUSD** USDA/USDZ (UsdSkel- blend shapes), OBJ and PLY. Exports are checked with the Khronos glTF validator and OpenUSD's `usdchecker`.+ blend shapes), OBJ, PLY and STL. Exports are checked with the Khronos glTF validator and OpenUSD's `usdchecker`.++**ZBrush interchange**+- `.GoZ` import/export with polygroups, mask, polypaint and UVs, and a GoZ bridge (Send / Receive) on Windows and+ macOS. See [docs/goz.md](docs/goz.md); the live bridge hasn't been tested against a running ZBrush yet.**Gaussian splats**- Open phone captures (Polycam, Luma, Postshot, Scaniverse and others) as a sculpting reference, convert them@@ -196,14 +211,20 @@ argument `--mcp`. The agent gets every command as a tool and works on one live s| Smooth | Hold **Shift** || Rotate | Left-drag background, or right-drag || Pan | Alt + left-drag background, or middle-drag |-| Zoom | Mouse wheel, or Ctrl + left-drag background |+| Zoom | Mouse wheel, Ctrl + middle-drag, or Ctrl + left-drag background when nothing is masked |+| Paint / erase mask | Hold **Ctrl** / **Ctrl+Alt** while stroking |+| Invert / clear mask | Ctrl + click / Ctrl + drag on the background |+| Isolate / hide polygroup | Ctrl+Shift + click / Ctrl+Shift+Alt + click |+| Show all | Ctrl+Shift + click on the background |+| Hide outside / inside a rectangle | Ctrl+Shift + drag / Ctrl+Shift+Alt + drag || Brush size | `[` / `]` |-| Select brush | `1`–`8` |+| Select brush | `1`–`9`, `0` |+| Paint brush / pick colour | `P` / `C` || Toggle X symmetry / wireframe | `X` / `W` || Frame model | `F` || Subdivide | Ctrl+D || Undo / Redo | Ctrl+Z / Ctrl+Shift+Z |-| Open / Save | Ctrl+O / Ctrl+S |+| Open / Save project / Save as | Ctrl+O / Ctrl+S / Ctrl+Shift+S || Export GLB | Ctrl+E || Send to Unreal | Ctrl+U |diff --git a/ROADMAP.md b/ROADMAP.mdindex b0026381..a5052479 100644--- a/ROADMAP.md+++ b/ROADMAP.md@@ -17,7 +17,7 @@| Unreal Engine | FBX export / GoZ-style bridges | FBX export | No | No | **Send to Unreal (live, no plugin), LODs + morph targets in one FBX** || Agent control (MCP) | No | Add-ons only | No | No | **Built in: `sculptforge-cli --mcp`** || Blend shapes / LODs / GLB | Via export plugins | Yes (general 3D) | Partial | No | **Built in, one click** |-| Open file formats | Proprietary .ZTL | .blend | Proprietary | OBJ | **OBJ, FBX, glTF, PLY, USD/USDZ** |+| Open file formats | Proprietary .ZTL | .blend | Proprietary | OBJ | **OBJ, FBX, glTF, PLY, STL, USD/USDZ, GoZ** |Where SculptForge aims to win:@@ -74,13 +74,22 @@ retopology, a full ZBrush feature list, rendering/animation (use Blender).## Phase 2 — Detail & workflow (v0.2–0.3)-- 📋 Masking (paint, invert, blur, mask-by-cavity) with brushes respecting masks+- ✅ Masking: Ctrl paints / Ctrl+Alt erases the mask, invert, clear, blur, sharpen, grow, shrink,+ mask by cavity and by polygroup; every brush and polypaint respect the mask+- ✅ Polygroups (auto by normals, by connectivity, from mask, merge visible) and ZBrush-style visibility:+ Ctrl+Shift isolate / hide a group, rectangle hide, show all, invert, delete hidden- 📋 Multiresolution: subdivision levels you can step up/down while keeping detail- 📋 Dynamic topology (local remeshing under the brush)-- 📋 Alphas / stencils and stroke types (drag-rect, spray, lazy mouse)-- 📋 More brushes: Clay Buildup, Dam Standard, Snake Hook, Trim, Layer, Nudge-- 📋 MatCap materials, cavity/AO shading-- 📋 Quit-with-unsaved-changes prompt, recent files, project file format+- ✅ Alphas (round, square, noise or any grayscale image) and stroke types (dots, drag-rect, spray, lazy mouse)+- 📋 Stencils; marquee / lasso masking and lasso hiding+- ✅ More brushes: Clay Buildup, Dam Standard, Snake Hook, Trim (dynamic), Layer, Nudge+- ✅ MatCap materials (six built in), with the existing cavity shading on top+- 📋 Ambient occlusion shading+- ✅ Project file format (`.sfproj`: mesh, layers, mask, polypaint, polygroups, visibility, UVs, splats, brushes,+ view settings), quit-with-unsaved-changes prompt, recent files, autosave with restore+- ✅ ZBrush GoZ interchange: `.GoZ` import/export with polygroups, mask, polypaint and UVs, plus the GoZ bridge+ (Send / Receive) on Windows and macOS. The format follows the GoB add-on; the live bridge has not yet been+ tested against a running ZBrush- 📋 Multithreaded brush evaluation, partial GPU uploads per BVH node- 📋 Benchmarks: brush latency at 1M / 5M / 20M triangles in CI@@ -101,8 +110,11 @@ retopology, a full ZBrush feature list, rendering/animation (use Blender).- 📋 Boolean merge/subtract on the voxel pipeline; sharper voxel remesh (signed distance instead of occupancy)- 📋 Retopology tools and quad remeshing- 📋 Multiple subtools/objects, layers-- 📋 Vertex painting (polypaint), UVs, texture baking (normal/displacement)-- 📋 STL, binary USD (usdc), SPZ-compressed splats, USD references/payloads+- ✅ Polypaint: Paint brush, RGB while sculpting, colour pick, fill (respecting the mask), cavity paint;+ exported to PLY, glTF, OBJ, USD and GoZ+- 📋 UV unwrapping and editing, texture baking (normal/displacement)+- ✅ STL import/export (binary and ASCII)+- 📋 Binary USD (usdc), SPZ-compressed splats, USD references/payloads- 📋 Splat editing: crop box, paint-select, sculpt deforming nearby splats## Phase 5 — Ecosystem (v1.0)diff --git a/src/app/App.cpp b/src/app/App.cppindex aad17cba..e4693779 100644--- a/src/app/App.cpp+++ b/src/app/App.cpp@@ -970,7 +970,7 @@ void App::drawUi() {"Frame model F\n""Subdivide Ctrl+D\n""Undo / Redo Ctrl+Z / Ctrl+Shift+Z\n"- "Open / Save Ctrl+O / Ctrl+S\n"+ "Open / Save Ctrl+O / Ctrl+S (project; Shift: Save As)\n""Tablet pressure is used automatically when a pen is detected.\n""Drop a model (.obj/.glb), brush (.sfbrush) or image onto the window.");}@@ -1822,8 +1822,8 @@ void App::drawBrushCursor() {: 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- const glm::vec3 c = linearToSrgb(inverted ? glm::vec3(1.0f) : doc_.paintColor);- col = ImGui::GetColorU32(ImVec4(c.x, c.y, c.z, 0.9f));+ 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);diff --git a/tests/test_integration_v02.cpp b/tests/test_integration_v02.cppnew file mode 100644index 00000000..e8f842b8--- /dev/null+++ b/tests/test_integration_v02.cpp@@ -0,0 +1,273 @@+// SculptForge - open source digital sculpting+// SPDX-License-Identifier: GPL-3.0-or-later+//+// v0.2 cross-feature checks: masking, polygroups/visibility, the new brushes+// and alphas, polypaint, project files and GoZ working on the same mesh.+#include "TestHarness.h"++#include "core/Commands.h"+#include "core/Masking.h"+#include "core/Polygroups.h"+#include "core/Polypaint.h"+#include "core/Primitives.h"+#include "core/Project.h"+#include "core/Sculpt.h"+#include "io/GozIO.h"++#include <cmath>+#include <filesystem>++using namespace sf;++namespace {++const CommandRegistry& registry() {+ static CommandRegistry r;+ return r;+}++bool run(Document& d, const std::string& name, const Args& args = {}) {+ const CommandResult r = registry().execute(d, name, args);+ if (!r.ok) std::printf(" %s: %s\n", name.c_str(), r.message.c_str());+ return r.ok;+}++// Plane (y = 0, normal +y) with the left half (x < 0) masked by a mask stroke+// the way the app does it, so every later step works on a "real" mask.+Document maskedPlane() {+ Document d = makeDoc(makePlane(48));+ DabParams p;+ p.center = glm::vec3(-0.5f, 0.0f, 0.0f);+ p.viewDir = glm::vec3(0.0f, -1.0f, 0.0f);+ p.radius = 0.2f;+ p.strength = 1.0f;+ CHECK(d.sculptor.beginStroke(d.mesh, "Mask"));+ d.sculptor.dabMask(d.mesh, d.bvh, p, Symmetry{});+ UndoRecord r = d.sculptor.endStroke();+ CHECK(!r.empty());+ d.undo.push(std::move(r));+ // Then the whole left half, as Ctrl+painting over it would.+ for (uint32_t v = 0; v < d.mesh.vertexCount(); ++v) d.mesh.mask[v] = d.mesh.positions[v].x < -0.02f ? 1.0f : 0.0f;+ return d;+}++DabParams dabOn(const glm::vec3& c, float radius) {+ DabParams p;+ p.center = c;+ p.viewDir = glm::vec3(0.0f, -1.0f, 0.0f);+ p.radius = radius;+ p.strength = 1.0f;+ p.strokeDelta = glm::vec3(0.02f, 0.0f, 0.02f);+ return p;+}++// Left-half vertices well inside the mask / hidden area (away from the seam).+bool leftUnchanged(const Mesh& m, const std::vector<glm::vec3>& before) {+ for (uint32_t v = 0; v < m.vertexCount(); ++v)+ if (before[v].x < -0.1f && m.positions[v] != before[v]) return false;+ return true;+}++bool rightChanged(const Mesh& m, const std::vector<glm::vec3>& before) {+ for (uint32_t v = 0; v < m.vertexCount(); ++v)+ if (before[v].x > 0.1f && glm::distance(m.positions[v], before[v]) > 1e-5f) return true;+ return false;+}++} // namespace++// Every brush (old and new) with every built-in alpha, mirrored by X symmetry+// onto the masked half, leaves the mask and the masked vertices alone.+TEST(v02_every_brush_and_alpha_respects_painted_mask) {+ for (const char* alpha : {"round", "square", "noise"}) {+ for (int i = 0; i < int(BrushType::Count); ++i) {+ const auto type = BrushType(i);+ if (type == BrushType::Move) continue; // grab, not a dab brush+ Document d = maskedPlane();+ CHECK(run(d, "brush_set_alpha", {{"name", std::string(alpha)}}));+ const auto before = d.mesh.positions;+ const auto mask = d.mesh.mask;+ DabParams p = dabOn(glm::vec3(0.5f, 0.0f, 0.0f), 0.3f);+ p.alpha = &d.brushAlpha;+ if (type == BrushType::Trim) p.invert = true; // fill: a flat plane has nothing to cut+ CHECK(d.sculptor.beginStroke(d.mesh, brushName(type)));+ for (int k = 0; k < 3; ++k) d.sculptor.dab(d.mesh, d.bvh, type, p, Symmetry{true, false, false});+ d.undo.push(d.sculptor.endStroke());+ CHECK(leftUnchanged(d.mesh, before));+ // A flat plane has nothing to smooth or flatten.+ if (type != BrushType::Smooth && type != BrushType::Flatten) {+ const bool changed = rightChanged(d.mesh, before);+ if (!changed) std::printf(" %s (%s alpha) did not sculpt\n", brushName(type), alpha);+ CHECK(changed);+ }+ CHECK(d.mesh.mask == mask);+ }+ }+}++// The mask stroke, polygroups built from it and visibility: brushes, polypaint+// and the mask commands all leave the hidden half alone.+TEST(v02_hidden_polygroup_is_untouched_by_brushes_paint_and_mask) {+ Document d = maskedPlane();+ CHECK(run(d, "polygroup_from_mask"));+ const uint32_t leftGroup = d.mesh.polygroupAt(0) != 0 ? d.mesh.polygroupAt(0) : nextPolygroupId(d.mesh) - 1;+ CHECK(run(d, "mask_clear"));+ CHECK(!d.mesh.hasMask());+ CHECK(run(d, "hide_polygroup", {{"group", double(leftGroup)}}));+ CHECK(d.mesh.hasHidden());+ size_t hiddenVerts = 0;+ for (uint32_t v = 0; v < d.mesh.vertexCount(); ++v) {+ if (!d.mesh.vertexHidden(v)) continue;+ ++hiddenVerts;+ CHECK(d.mesh.positions[v].x < 0.0f);+ }+ CHECK(hiddenVerts > 100);++ // New brushes mirrored onto the hidden half.+ const auto before = d.mesh.positions;+ for (BrushType type : {BrushType::DamStandard, BrushType::ClayBuildup, BrushType::Layer, BrushType::Nudge}) {+ CHECK(d.sculptor.beginStroke(d.mesh, brushName(type)));+ d.sculptor.dab(d.mesh, d.bvh, type, dabOn(glm::vec3(0.5f, 0.0f, 0.0f), 0.3f), Symmetry{true, false, false});+ d.undo.push(d.sculptor.endStroke());+ }+ for (uint32_t v = 0; v < d.mesh.vertexCount(); ++v)+ if (d.mesh.vertexHidden(v)) CHECK(d.mesh.positions[v] == before[v]);+ CHECK(rightChanged(d.mesh, before));++ // Paint brush and fills.+ glm::vec3 red;+ CHECK(parseColor("red", red));+ CHECK(d.sculptor.beginStroke(d.mesh, "Paint"));+ paintDab(d.sculptor, d.mesh, d.bvh, dabOn(glm::vec3(0.5f, 0.0f, 0.0f), 0.3f), red, Symmetry{true, false, false});+ d.undo.push(d.sculptor.endStroke());+ CHECK(run(d, "paint_fill", {{"color", std::string("0,0,1")}, {"strength", 0.5}}));+ CHECK(run(d, "mask_all"));+ for (uint32_t v = 0; v < d.mesh.vertexCount(); ++v) {+ if (!d.mesh.vertexHidden(v)) continue;+ CHECK(d.mesh.colorAt(v) == glm::vec3(1.0f));+ CHECK(d.mesh.mask[v] == 0.0f);+ }++ // show_all brings both groups back; undoing everything restores the plane.+ CHECK(run(d, "show_all"));+ CHECK(visiblePolygroupCount(d.mesh) == 2);+ const Mesh plane = makePlane(48);+ while (d.undo.canUndo()) d.undo.undo(d.mesh, d.bvh);+ CHECK(d.mesh.positions == plane.positions);+ bool anyHidden = false;+ for (uint32_t t = 0; t < d.mesh.triangleCount(); ++t) anyHidden |= d.mesh.triangleHidden(t);+ CHECK(!anyHidden);+}++// RGB-while-sculpting: a sculpt dab and a paint dab inside one stroke undo+// together, and a DragRect-style restoreStroke reverts the paint as well.+TEST(v02_sculpt_and_paint_share_one_stroke) {+ Document d = makeDoc(makePlane(32));+ d.mesh.ensureColors();+ const auto pos = d.mesh.positions;+ const auto col = d.mesh.colors;+ glm::vec3 green;+ CHECK(parseColor("00ff00", green));+ const DabParams p = dabOn(glm::vec3(0.0f), 0.4f);+ CHECK(d.sculptor.beginStroke(d.mesh, "Standard"));+ paintDab(d.sculptor, d.mesh, d.bvh, p, green, Symmetry{});+ d.sculptor.dab(d.mesh, d.bvh, BrushType::ClayBuildup, p, Symmetry{});+ CHECK(d.mesh.colors != col && d.mesh.positions != pos);+ d.sculptor.restoreStroke(d.mesh, d.bvh);+ CHECK(d.mesh.colors == col && d.mesh.positions == pos);+ paintDab(d.sculptor, d.mesh, d.bvh, p, green, Symmetry{});+ d.sculptor.dab(d.mesh, d.bvh, BrushType::ClayBuildup, p, Symmetry{});+ d.undo.push(d.sculptor.endStroke());+ CHECK(d.dirty());+ CHECK(d.undo.undo(d.mesh, d.bvh));+ CHECK(d.mesh.colors == col && d.mesh.positions == pos);+ CHECK(!d.undo.canUndo());+}++// A project saved after masking, painting, grouping and hiding reopens with+// all of it, through the commands the CLI/Python/MCP use.+TEST(v02_project_keeps_attributes_made_by_the_features) {+ Document d = maskedPlane();+ CHECK(run(d, "polygroup_from_mask"));+ CHECK(run(d, "mask_blur", {{"iterations", 2.0}}));+ CHECK(run(d, "paint_fill", {{"color", std::string("skin")}}));+ CHECK(run(d, "paint_from_cavity"));+ CHECK(run(d, "hide_polygroup", {{"group", double(nextPolygroupId(d.mesh) - 1)}}));+ CHECK(d.mesh.hasMask() && d.mesh.hasColors() && d.mesh.hasPolygroups() && d.mesh.hasHidden());+ CHECK(d.dirty());++ const std::string path = tempPath("sf_v02_integration.sfproj");+ CHECK(run(d, "save_project", {{"path", path}}));+ CHECK(!d.dirty());++ Document back = makeDoc(makeIcosphere(1));+ CHECK(run(back, "open", {{"path", path}}));+ CHECK(back.mesh.positions == d.mesh.positions);+ CHECK(back.mesh.mask == d.mesh.mask);+ CHECK(back.mesh.colors == d.mesh.colors);+ CHECK(back.mesh.polygroups == d.mesh.polygroups);+ CHECK(back.mesh.hidden == d.mesh.hidden);+ CHECK(!back.dirty());+ // The reopened scene keeps working: commands still honour the hidden part.+ CHECK(run(back, "mask_invert"));+ CHECK(back.dirty());+ for (uint32_t v = 0; v < back.mesh.vertexCount(); ++v)+ if (back.mesh.vertexHidden(v)) CHECK(back.mesh.mask[v] == d.mesh.mask[v]);+ std::error_code ec;+ std::filesystem::remove(path, ec);+}++// GoZ carries mask, polypaint and polygroups made by the new tools (but has+// no hidden flag), and delete_hidden keeps the attributes aligned for export.+TEST(v02_goz_keeps_mask_paint_and_groups) {+ Document d = maskedPlane();+ CHECK(run(d, "polygroup_from_mask"));+ CHECK(run(d, "paint_fill", {{"color", std::string("#336699")}, {"area", std::string("masked")}}));+ const std::string path = tempPath("sf_v02_integration.GoZ");+ CHECK(run(d, "goz_export", {{"path", path}, {"name", std::string("Plane")}}));++ Document back;+ CHECK(run(back, "goz_import", {{"path", path}}));+ CHECK(back.gozName == "Plane");+ CHECK(back.mesh.vertexCount() == d.mesh.vertexCount());+ CHECK(back.mesh.triangleCount() == d.mesh.triangleCount());+ CHECK(back.mesh.hasMask() && back.mesh.hasColors() && back.mesh.hasPolygroups());+ float maskErr = 0.0f, colorErr = 0.0f;+ for (uint32_t v = 0; v < d.mesh.vertexCount() && v < back.mesh.vertexCount(); ++v) {+ maskErr = std::max(maskErr, std::abs(back.mesh.mask[v] - d.mesh.mask[v]));+ colorErr = std::max(colorErr, glm::length(back.mesh.colors[v] - d.mesh.colors[v]));+ }+ CHECK(maskErr < 0.01f); // GoZ stores the mask as 16 bits+ CHECK(colorErr < 0.02f); // and polypaint as 8-bit sRGB+ size_t groupsDiffer = 0;+ for (uint32_t t = 0; t < d.mesh.triangleCount() && t < back.mesh.triangleCount(); ++t)+ groupsDiffer += (back.mesh.polygroupAt(t) == back.mesh.polygroupAt(0)) != (d.mesh.polygroupAt(t) == d.mesh.polygroupAt(0));+ CHECK(groupsDiffer == 0);++ // Deleting the hidden half compacts every attribute, and the result still exports.+ CHECK(run(back, "hide_polygroup", {{"group", double(back.mesh.polygroupAt(0))}}));+ CHECK(run(back, "delete_hidden"));+ CHECK(back.mesh.triangleCount() > 0 && back.mesh.triangleCount() < d.mesh.triangleCount());+ CHECK(back.mesh.mask.size() == back.mesh.vertexCount());+ CHECK(back.mesh.colors.size() == back.mesh.vertexCount());+ CHECK(back.mesh.polygroups.empty() || back.mesh.polygroups.size() == back.mesh.triangleCount());+ CHECK(run(back, "goz_export", {{"path", path}}));+ Mesh again;+ std::string err;+ CHECK(loadGoz(path, again, err));+ CHECK(again.triangleCount() == back.mesh.triangleCount());+ std::error_code ec;+ std::filesystem::remove(path, ec);+}++// The new commands are all in one registry (what the CLI, Python and MCP list).+TEST(v02_commands_registered_together) {+ for (const char* name :+ {"mask_clear", "mask_all", "mask_invert", "mask_blur", "mask_sharpen", "mask_grow", "mask_shrink",+ "mask_by_cavity", "mask_by_polygroup", "polygroup_auto_by_normals", "polygroup_by_connectivity",+ "polygroup_from_mask", "polygroup_clear", "polygroup_merge_visible", "hide_polygroup", "isolate_polygroup",+ "show_all", "invert_visibility", "hide_rect", "delete_hidden", "brush_set_alpha", "set_color", "paint_fill",+ "paint_clear", "paint_from_cavity", "export_ply", "goz_import", "goz_export", "goz_send", "goz_receive",+ "export_stl", "save_project", "open_project"})+ CHECK(registry().find(name) != nullptr);+}diff --git a/website/index.html b/website/index.htmlindex b30d3d65..9cdeae9d 100644--- a/website/index.html+++ b/website/index.html@@ -284,9 +284,11 @@ verts = doc.vertices # NumPy (N, 3)</code></pre><details><summary>Can SculptForge replace ZBrush for me?</summary><p>For many sculpting and game-asset jobs, yes. Blocking out, sculpting forms and detail, blend shapes,LODs and getting assets into Unreal, glTF or USD all work today, with familiar brushes and controls.- SculptForge doesn't yet have multiresolution subdivision levels, ZRemesher-class retopology, polypaint- or UVs, and it can't open ZBrush's .ZTL files (export OBJ or FBX from ZBrush instead). It's an- independent project, not affiliated with Maxon.</p></details>+ Masking, polygroups and visibility, polypaint, MatCaps, project files and GoZ exchange with ZBrush are+ in the development version and will ship in the next release. SculptForge doesn't yet have+ multiresolution subdivision levels, dynamic topology, ZRemesher-class retopology or UV unwrapping, and+ it can't open ZBrush's .ZTL files (use GoZ, or export OBJ or FBX from ZBrush). It's an independent+ project, not affiliated with Maxon.</p></details><details><summary>How can I help?</summary><p>Try it, report bugs, share brushes, and send pull requests. See<a href="https://github.com/islandmed/SculptForge/blob/main/CONTRIBUTING.md">CONTRIBUTING.md</a>.</p></details>