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
Big brushes take the analytic normals by default; fused batches stay with Fast Big Brushes
islandmed887a086fb550
diff --git a/src/app/App.cpp b/src/app/App.cppindex fc031144..33c44b5d 100644--- a/src/app/App.cpp+++ b/src/app/App.cpp@@ -1947,6 +1947,11 @@ 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');+ }();+ doc_.sculptor.analyticNormals = analyticNormals;if (!doc_.sculptor.beginStroke(doc_.mesh,!strokeSculpt_ ? std::string("Paint") : recipe ? recipe->name : brushLabel(strokeBrush_),strokeSculpt_ ? doc_.activeLayer : -1)) {diff --git a/src/core/Sculpt.cpp b/src/core/Sculpt.cppindex 87f3b155..19a4a6a7 100644--- a/src/core/Sculpt.cpp+++ b/src/core/Sculpt.cpp@@ -947,7 +947,7 @@ void Sculptor::dabSingle(Mesh& mesh, BVH& bvh, BrushType type, const DabParams&}// Scale-adaptive dabs (Sculpt.h, adaptiveDabs): a big region's plane from an even sample of its vertices.- adaptiveDab_ = adaptiveDabs && !dynTopo_.active() && !draft_ && verts_.size() >= kAdaptiveMinVertices &&+ adaptiveDab_ = (adaptiveDabs || analyticNormals) && !dynTopo_.active() && !draft_ && verts_.size() >= kAdaptiveMinVertices &&type != BrushType::Smooth && type != BrushType::Layer && type != BrushType::Morph &&// (an alpha's fine pattern or Clay Block's square tip, which turn with the area normal, and the brushes that move along each vertex's own normal amplify a// hair's difference in the normals the next dabs read)diff --git a/src/core/Sculpt.h b/src/core/Sculpt.hindex 1ad18098..f6737aad 100644--- a/src/core/Sculpt.h+++ b/src/core/Sculpt.h@@ -266,6 +266,10 @@ public:// endStroke). Brushes whose offset depends on more than the vertex's place (Smooth, Layer, Morph) and the// remesher always take the exact path, and so do regions below the threshold (small brushes are unchanged).bool adaptiveDabs = false;+ // The same adaptive path (sampled plane, normals from the brush's own derivative, exact ones behind the brush and+ // at the end) without fused batches: on by default (perf plan item 2: the normals were half of a big brush's+ // time). Fused batches stay with adaptiveDabs (Fast Big Brushes, Experimental).+ bool analyticNormals = true;static constexpr size_t kAdaptiveMinVertices = 150'000;static constexpr size_t kAreaSamples = 65'536;// Whether adaptive dabs moved leaves whose exact normals are still to come, and catching up with up todiff --git a/tests/test_beta_boost.cpp b/tests/test_beta_boost.cppindex 54a9132e..1181385e 100644--- a/tests/test_beta_boost.cpp+++ b/tests/test_beta_boost.cpp@@ -46,6 +46,7 @@ StrokeResult strokeOn(const Mesh& head, BrushType type, float radius, bool adaptfor (int x = 0; x < 64; ++x) stamp.values[size_t(y) * 64 + x] = 0.5f + 0.5f * std::sin(0.3f * float(x)) * std::cos(0.2f * float(y));}d.sculptor.adaptiveDabs = adaptive;+ d.sculptor.analyticNormals = adaptive; // (the exact path: neither)d.sculptor.beginStroke(d.mesh, brushName(type));StrokeResult out;const auto t0 = std::chrono::steady_clock::now();@@ -223,6 +224,7 @@ TEST(adaptive_dabs_normals_during_the_stroke) {auto run = [&](bool adaptive) {Document d = makeDoc(head);d.sculptor.adaptiveDabs = adaptive;+ d.sculptor.analyticNormals = adaptive;d.sculptor.beginStroke(d.mesh, "Clay");for (int i = 0; i < 8; ++i) {DabParams p;