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
Analytic normals from 160 px brushes only: at 120 px the deferred exact normals cost the 3060 more at pen-up than they saved
islandmed4c09f70b43c6
diff --git a/changes/perf-analytic-normals.md b/changes/perf-analytic-normals.mdindex f0e6e785..342d053a 100644--- a/changes/perf-analytic-normals.md+++ b/changes/perf-analytic-normals.md@@ -1,10 +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.+changed: **Big brushes keep up better on 6+ core machines**: with a brush of 160 px or more, the 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 thepen 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.+Perf plan item 2. Gate: !simulatedFloorTier() && hardware_concurrency() >= 6 && brush >= 160 px; 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.cppindex 79dd873f..16e8e488 100644--- a/src/app/App.cpp+++ b/src/app/App.cpp@@ -1948,14 +1948,15 @@ void App::beginStroke(float x, float y, const RayHit& hit) {haveLastDab_ = false;doc_.sculptor.draftStrokes = draftStrokes() && asyncStrokeAllowed(); // (AsyncStroke.cpp)doc_.sculptor.adaptiveDabs = fastBigBrushes();- // 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;+ // Big brushes where the CPU has room: the exact normals the analytic ones defer land at the pen-up. On a 4-core+ // floor machine that cost more than it saved (E-core floor, 120 px release 0.5 -> 1.3 s), and at 120 px even on+ // the 3060 (release +190 ms for -45 ms lag); from 160 px on 6+ threads it wins (3060 240 px p50 428 -> 283 ms,+ // release +50). SF_ANALYTIC_NORMALS=0/1 forces it (A/B).+ static const int analyticNormals = [] {+ if (const char* e = std::getenv("SF_ANALYTIC_NORMALS")) return e[0] != '0' ? 1 : 0;+ return !simulatedFloorTier() && std::thread::hardware_concurrency() >= 6 ? -1 : 0; // -1: by brush size}();- doc_.sculptor.analyticNormals = analyticNormals;+ doc_.sculptor.analyticNormals = analyticNormals == 1 || (analyticNormals == -1 && radiusPx_ >= 160.0f);if (!doc_.sculptor.beginStroke(doc_.mesh,!strokeSculpt_ ? std::string("Paint") : recipe ? recipe->name : brushLabel(strokeBrush_),strokeSculpt_ ? doc_.activeLayer : -1)) {