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
Perf moonshots 0.10.8 slice: Live Move and Background Preview as Experimental preferences, tests, paused report
islandmed197773a1a463
diff --git a/CMakeLists.txt b/CMakeLists.txtindex cfce8798..52358647 100644--- a/CMakeLists.txt+++ b/CMakeLists.txt@@ -665,6 +665,15 @@ if(SCULPTFORGE_BUILD_TESTS)add_test(NAME ui_stroke_background COMMAND sculptforge --run "new_sphere" --measure-stroke 1.5)set_tests_properties(ui_stroke_background PROPERTIES LABELS ui TIMEOUT 60ENVIRONMENT "SF_NO_UPDATE_CHECK=1;SF_MEASURE_VERIFY=1;SF_BACKGROUND_DABS=1")+ # The same with Background Preview (experimental): the preview never changes the mesh and the frame no longer waits+ # for a batch; the stroke still replays bit for bit.+ add_test(NAME ui_stroke_background_preview COMMAND sculptforge --run "new_sphere" --measure-stroke 1.5)+ set_tests_properties(ui_stroke_background_preview PROPERTIES LABELS ui TIMEOUT 60+ ENVIRONMENT "SF_NO_UPDATE_CHECK=1;SF_MEASURE_VERIFY=1;SF_BACKGROUND_DABS=1;SF_BG_GHOST=1")+ # And with the persistent upload (experimental, SF_PERSISTENT_UPLOAD): staging buffers instead of glBufferSubData.+ add_test(NAME ui_stroke_persistent_upload COMMAND sculptforge --run "new_sphere" --measure-stroke 1.5)+ set_tests_properties(ui_stroke_persistent_upload PROPERTIES LABELS ui TIMEOUT 60+ ENVIRONMENT "SF_NO_UPDATE_CHECK=1;SF_MEASURE_VERIFY=1;SF_BACKGROUND_DABS=1;SF_BG_GHOST=1;SF_PERSISTENT_UPLOAD=1")# Predictive strokes with the brush size changing every frame mid-stroke: each batch of dabs keeps the size it# was handed (no data race with the solver thread), replaying the stroke without the thread gives the same# mesh, bit for bit, and its undo the mesh it started from.diff --git a/REPORT.md b/REPORT.mdnew file mode 100644index 00000000..d6fa0a32--- /dev/null+++ b/REPORT.md@@ -0,0 +1,10 @@+# research/perf-moonshots: PAUSED (usage stop), not pushed, NOT green-verified+Status: 0.10.8 slice built (Release build OK), committed locally; no full ctest, no benchmarks yet (load never < 2).+Done: three flagged prototypes on top of perf/bigbrush-p99 (merged in): Live Move (Prefs > Performance "Live Move (Experimental)", SF_LIVE_MOVE; GPU draws the Move drag via GhostKind::Move, one exact grab at release), Background Preview (Prefs toggle, SF_BG_GHOST; ghost on the background-dab path, frame no longer waits), Persistent upload (SF_PERSISTENT_UPLOAD only; GL_ARB_buffer_storage staging + glCopyBufferSubData + fences). Prefs saved in ui.json, Spanish strings, UiTest values live_move/background_preview.+Tests: unit live_move_matches_the_grab passes (preview 1e-5, single grab vs per-frame 1e-6); ghost tests pass. NOT yet run: tests/ui/live_move.sfui, ui_stroke_background_preview, ui_stroke_persistent_upload (CMakeLists.txt), full ctest.+Doc: docs/design/perf-moonshots.md (research with citations, ideas 1-8 incl. Focus Detail, ZBrush public-docs comparison); MEASUREMENTS and RECOMMENDATION placeholders still to fill.+Next steps to resume:+1. `cd build && SDL_APP_ID=sculptforge-agent nice -n 19 ionice -c3 ctest -R "ui_live_move|ui_stroke_background|ui_stroke_persistent|ghost" --output-on-failure`; fix, then full ctest -j3 (one machine-wide).+2. At load < 2: scratchpad bench.sh pattern = `--benchmark standard-33m --benchmark-no-video` for A (no env), SF_BG_GHOST=1, SF_LIVE_MOVE=1, SF_PERSISTENT_UPLOAD=1, all; interleave A/all twice. Fill docs MEASUREMENTS/RECOMMENDATION (expect: Move fps, preview_lag_px vs lag_px, commit ms). Keep persistent upload env-only unless it gains.+3. CHANGELOG [Unreleased] + What's New 0.10.8 lines (two Experimental toggles, off by default), push branch when green, update this report with numbers + SHA, message coordinator.+Coordination: focusdetail agent (research/focus-detail) owns idea 8 data side; asked it to expose FocusDetail::tileLevel(tri) and report promotion latency/RSS/GPU MB at 1B.diff --git a/src/app/App.h b/src/app/App.hindex ece9f7d6..f18d62e5 100644--- a/src/app/App.h+++ b/src/app/App.h@@ -349,7 +349,7 @@ private:BrushType strokeBrush_ = BrushType::Standard;bool strokeInvert_ = false;glm::vec3 grabPlanePoint_{0.0f}, grabLast_{0.0f};- // Live Move (SF_LIVE_MOVE=1, a research prototype, docs/design/perf-moonshots.md): a Move drag on a plain mesh+ // Live Move (Preferences > Performance, experimental; docs/design/perf-moonshots.md): a Move drag on a plain mesh// isn't applied frame by frame; the GPU draws it (render/Ghost.h, GhostKind::Move) from the grab's start, and// the whole move is applied once when the stroke ends (finishStrokeNow): one grab instead of one a frame.struct LiveMove {@@ -357,7 +357,7 @@ private:glm::vec3 center{0.0f}, delta{0.0f};float radius = 0.0f, scale = 0.0f;} liveMove_;- static bool liveMoveEnabled();+ bool liveMoveEnabled() const; // the Live Move preference (and SF_LIVE_MOVE)void commitLiveMove();// Along the normal (from the discussions): Move, Tendril, Elastic Tendril and KelvinGrab strokes that began with// the invert key held (Preferences > Input > Along the normal) slide along the average normal under the brushdiff --git a/src/app/AsyncStroke.cpp b/src/app/AsyncStroke.cppindex 633e3cc7..0b9e13a7 100644--- a/src/app/AsyncStroke.cpp+++ b/src/app/AsyncStroke.cpp@@ -153,13 +153,14 @@ bool App::backgroundDabs() const {}bool App::previewStrokes() const {- // SF_BG_GHOST=1 (a research prototype, docs/design/perf-moonshots.md): background dabs draw the predictive- // preview too (it never changes the mesh: the solver's dabs are the same), and the frame doesn't wait for them.- static const bool bgGhost = [] {+ // Background Preview (Preferences > Performance, experimental; SF_BG_GHOST=0 / 1 overrides): background dabs+ // draw the predictive preview too (it never changes the mesh: the solver's dabs are the same), and the frame+ // doesn't wait for them.+ static const int env = [] {const char* v = std::getenv("SF_BG_GHOST");- return v && *v == '1';+ return v && *v ? (*v == '0' ? 0 : 1) : -1;}();- return predictiveStrokes() || (bgGhost && backgroundDabs());+ return predictiveStrokes() || ((env >= 0 ? env == 1 : uiPrefs_.backgroundPreview) && backgroundDabs());}bool App::asyncStrokeAllowed() const {@@ -309,12 +310,12 @@ void App::pumpStroke() {commitSolverBatch();}-bool App::liveMoveEnabled() {- static const bool on = [] {+bool App::liveMoveEnabled() const {+ static const int env = [] {const char* v = std::getenv("SF_LIVE_MOVE");- return v && *v == '1';+ return v && *v ? (*v == '0' ? 0 : 1) : -1;}();- return on;+ return env >= 0 ? env == 1 : uiPrefs_.liveMove;}void App::commitLiveMove() {diff --git a/src/app/Config.cpp b/src/app/Config.cppindex 7174c9cf..92ca2523 100644--- a/src/app/Config.cpp+++ b/src/app/Config.cpp@@ -100,6 +100,8 @@ Json toJson(const UiPrefs& p) {j.set("multithreading", p.multithreading);j.set("predictiveStrokes", p.predictiveStrokes);j.set("draftStrokes", p.draftStrokes);+ j.set("liveMove", p.liveMove);+ j.set("backgroundPreview", p.backgroundPreview);j.set("dyntopoConstantDetail", p.dyntopoConstantDetail);j.set("flatShading", p.flatShading);j.set("viewportCursor", double(p.viewportCursor));@@ -162,6 +164,8 @@ void fromJson(const Json& j, UiPrefs& p) {p.multithreading = j["multithreading"].asBool(p.multithreading);p.predictiveStrokes = j["predictiveStrokes"].asBool(p.predictiveStrokes);p.draftStrokes = j["draftStrokes"].asBool(p.draftStrokes);+ p.liveMove = j["liveMove"].asBool(p.liveMove);+ p.backgroundPreview = j["backgroundPreview"].asBool(p.backgroundPreview);p.dyntopoConstantDetail = j["dyntopoConstantDetail"].asBool(p.dyntopoConstantDetail);p.flatShading = j["flatShading"].asBool(p.flatShading);p.viewportCursor = std::clamp(int(j["viewportCursor"].asNumber(p.viewportCursor)), 0, 1);diff --git a/src/app/Config.h b/src/app/Config.hindex 72e0a278..7c473018 100644--- a/src/app/Config.h+++ b/src/app/Config.h@@ -85,6 +85,11 @@ struct UiPrefs {// bounds of what they touched are worked out once, when the pen lifts (Sculptor::draftStrokes). Off by// default; meant for laptops and battery (a hardware tier will turn it on).bool draftStrokes = false;+ // Experimental (docs/design/perf-moonshots.md), off by default. Live Move: the GPU draws a Move drag and the+ // move is applied once when the pen lifts (SF_LIVE_MOVE=0 / 1 overrides). Background Preview: heavy meshes'+ // background dabs draw the predictive preview too (SF_BG_GHOST=0 / 1 overrides).+ bool liveMove = false;+ bool backgroundPreview = false;// Dynamic topology (Draw palette): false = the detail follows the brush size on screen (Sculptris Pro);// true = one detail size for the whole mesh.bool dyntopoConstantDetail = false;diff --git a/src/app/I18nSpanish.cpp b/src/app/I18nSpanish.cppindex 64f74029..04041969 100644--- a/src/app/I18nSpanish.cpp+++ b/src/app/I18nSpanish.cpp@@ -637,6 +637,8 @@ constexpr Entry kSpanish[] = {{"Multithreading", "Multihilo"},{"Predictive Strokes", "Trazos predictivos"},{"Draft Strokes", "Trazos de borrador"},+ {"Live Move (Experimental)", "Mover en vivo (experimental)"},+ {"Background Preview (Experimental)", "Vista previa en segundo plano (experimental)"},{"%d threads", "%d hilos"},{"Memory", "Memoria"},{"Hardware profile", "Perfil de hardware"},diff --git a/src/app/PanelPerformance.cpp b/src/app/PanelPerformance.cppindex e7d46e95..42ef8edc 100644--- a/src/app/PanelPerformance.cpp+++ b/src/app/PanelPerformance.cpp@@ -99,6 +99,25 @@ void App::registerPerformanceUiActions() {"the dabs still being worked out as a preview on the surface, with the cursor and the stroke's head drawn ""where the pen is about to be. On a heavy mesh the surface moves under the pen at once and lifting the pen ""is instant. The finished sculpt is exactly the same either way.");+ add("perf.live_move", "Live Move (Experimental)",+ [this] {+ uiPrefs_.liveMove = !uiPrefs_.liveMove;+ status_ = uiPrefs_.liveMove ? "Live Move on" : "Live Move off";+ },+ [this] { return uiPrefs_.liveMove; },+ "Experimental. The Move brush's drag is drawn by the graphics card from where the surface started, so it "+ "follows the pen at the view's frame rate whatever the mesh size; the move itself is applied once, exactly, "+ "when you lift the pen. Not with masks, hidden parts, sculpt layers, micro levels, Connected Only or View "+ "falloff (Move works as before there).");+ add("perf.background_preview", "Background Preview (Experimental)",+ [this] {+ uiPrefs_.backgroundPreview = !uiPrefs_.backgroundPreview;+ status_ = uiPrefs_.backgroundPreview ? "Background preview on" : "Background preview off";+ },+ [this] { return uiPrefs_.backgroundPreview; },+ "Experimental. On meshes of 2 million vertices or more, big brushes are worked out on their own thread; "+ "with this on, the dabs still being worked out are shown as a preview on the surface (as Predictive "+ "Strokes does), so the stroke stays under the pen. The finished sculpt is exactly the same either way.");add("perf.draft_strokes", "Draft Strokes",[this] {uiPrefs_.draftStrokes = !uiPrefs_.draftStrokes;@@ -171,6 +190,12 @@ void App::drawPerformanceSection() {bool draft = uiPrefs_.draftStrokes;if (ImGui::Checkbox(tr("Draft Strokes"), &draft)) actions_.find("perf.draft_strokes")->run();ui::HelpAction(*this, "perf.draft_strokes");+ bool liveMove = uiPrefs_.liveMove;+ if (ImGui::Checkbox(tr("Live Move (Experimental)"), &liveMove)) actions_.find("perf.live_move")->run();+ ui::HelpAction(*this, "perf.live_move");+ bool bgPreview = uiPrefs_.backgroundPreview;+ if (ImGui::Checkbox(tr("Background Preview (Experimental)"), &bgPreview)) actions_.find("perf.background_preview")->run();+ ui::HelpAction(*this, "perf.background_preview");// --- Threads ---bool threads = !ThreadPool::shared().serial();diff --git a/src/app/UiTest.cpp b/src/app/UiTest.cppindex fcef8be5..58bca4ce 100644--- a/src/app/UiTest.cpp+++ b/src/app/UiTest.cpp@@ -390,6 +390,8 @@ double Demo::query(const std::string& name, bool& known) const {if (name == "view_samples") return double(app_.perf_.samplesWanted);if (name == "multithreading") return ThreadPool::shared().serial() ? 0.0 : 1.0;if (name == "predictive_strokes") return app_.predictiveStrokes() ? 1.0 : 0.0;+ if (name == "live_move") return app_.liveMoveEnabled() ? 1.0 : 0.0;+ if (name == "background_preview") return app_.uiPrefs_.backgroundPreview ? 1.0 : 0.0;if (name == "last_stroke_dabs") return double(app_.perf_.lastStroke.dabs);if (name == "texture_size") return hasTexture(m) ? double(m.texture->width) : 0.0;if (name == "paint_texture") return paintsTexture(m) ? 1.0 : 0.0;diff --git a/tests/ui/live_move.sfui b/tests/ui/live_move.sfuinew file mode 100644index 00000000..a1bbb34f--- /dev/null+++ b/tests/ui/live_move.sfui@@ -0,0 +1,62 @@+# Live Move (Preferences > Performance, experimental): the graphics card draws a Move drag and the move is applied+# once when the pen lifts. The same drag leaves the same surface as plain Move (one grab with the whole move is the+# sum of the per-frame grabs) and undo puts it back.+run ui_look look=classic layout=zbrush # written for the Classic look and the ZBrush-style palette bar and shelves+run new_sphere subdivisions=5+camera 0 0+click "Move##brush.move"+expect_value live_move == 0++# Plain Move.+snapshot+stroke 0.86 0.5 0.98 0.38+remember moved_sum plain+remember moved_max plainMax+expect_value moved_sum > 0+key ctrl+z+expect_value moved == 0++# Live Move on (Ctrl-hover help first).+click "Preferences##palette.preferences"+click "Performance##preferences.performance"+hold ctrl+hover "Live Move (Experimental)"+expect_help "lift the pen"+hover "Background Preview (Experimental)"+expect_help "exactly the same"+hold none+click "Live Move (Experimental)"+expect_value live_move == 1+expect_status "Live Move on"+click "Preferences##palette.preferences"++# The same drag: the same surface.+snapshot+stroke 0.86 0.5 0.98 0.38+expect_value moved_sum > $plain*0.999+expect_value moved_sum < $plain*1.001+expect_value moved_max > $plainMax*0.999+expect_value moved_max < $plainMax*1.001+shot live_move+key ctrl+z+expect_value moved == 0++# Twice in a row, then both undone.+stroke 0.86 0.5 0.98 0.38+stroke 0.80 0.6 0.90 0.7+expect_value moved > 0+key ctrl+z+key ctrl+z+expect_value moved == 0++# Background Preview: on and off again; Live Move off again.+click "Preferences##palette.preferences"+click "Performance##preferences.performance"+expect_value background_preview == 0+click "Background Preview (Experimental)"+expect_value background_preview == 1+click "Background Preview (Experimental)"+expect_value background_preview == 0+click "Live Move (Experimental)"+expect_value live_move == 0+click "Preferences##palette.preferences"