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.

Analytic normals only where the CPU has room: off on the floor tier and under 6 threads

islandmed7c191113f951
diff --git a/changes/perf-analytic-normals.md b/changes/perf-analytic-normals.md
new file mode 100644
index 00000000..f0e6e785
--- /dev/null
+++ b/changes/perf-analytic-normals.md
@@ -0,0 +1,10 @@
+---
+changed: **Big brushes keep up better on 6+ core machines**: a large brush's lighting now follows the brush's own
+ shape while you drag, and the exact shading lands behind it and at pen-up, so big strokes stay closer to the pen.
+ Machines with fewer cores keep the previous behaviour.
+testers:
+ - A desktop or a recent laptop (6+ cores): a 15M+ mesh, Clay at 240 px, long strokes. The stroke stays near the
+ pen and the shading looks right after release (no faceting, no seams).
+---
+Perf plan item 2. Gate: !simulatedFloorTier() && hardware_concurrency() >= 6; SF_ANALYTIC_NORMALS=0/1 forces it.
+Scoreboard A/B in docs/design/perf-scoreboard.md (floor tier: identical to main by construction; laptop + 3060 measured).
diff --git a/src/app/App.cpp b/src/app/App.cpp
index 33c44b5d..79dd873f 100644
--- a/src/app/App.cpp
+++ b/src/app/App.cpp
@@ -3,6 +3,7 @@
#include "app/App.h"
#include "io/BridgeProtocol.h"
#include "core/LayerStack.h"
+#include "core/HardwareProfile.h"
#include "app/ShellQuote.h"
#include "app/SpaceCamera.h"
#include "app/UiScale.h"
@@ -1947,9 +1948,12 @@ void App::beginStroke(float x, float y, const RayHit& hit) {
haveLastDab_ = false;
doc_.sculptor.draftStrokes = draftStrokes() && asyncStrokeAllowed(); // (AsyncStroke.cpp)
doc_.sculptor.adaptiveDabs = fastBigBrushes();
- static const bool analyticNormals = [] { // SF_ANALYTIC_NORMALS=0: every dab's normals from the rings (A/B)
- const char* e = std::getenv("SF_ANALYTIC_NORMALS");
- return !(e && e[0] == '0');
+ // Where the CPU has room: the exact normals the analytic ones defer land at the pen-up, which on a 4-core floor
+ // machine cost more than they saved (E-core floor, 120 px release 0.5 -> 1.3 s); 6+ threads won (laptop 240 px
+ // p50 247 -> 156 ms). SF_ANALYTIC_NORMALS=0/1 forces it (A/B).
+ static const bool analyticNormals = [] {
+ if (const char* e = std::getenv("SF_ANALYTIC_NORMALS")) return e[0] != '0';
+ return !simulatedFloorTier() && std::thread::hardware_concurrency() >= 6;
}();
doc_.sculptor.analyticNormals = analyticNormals;
if (!doc_.sculptor.beginStroke(doc_.mesh,