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
Custom and Community brushes show the whole alpha at Focal Shift -100 (#75)
islandmedaf224a341deb
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 1ecdb731..199933fc 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -6,6 +6,11 @@ All notable changes to SculptForge are listed here. The format follows## [Unreleased]+### Fixed+- Custom and Community brushes (Clay Slab and other presets) show the whole alpha at Focal Shift -100, as the+ built-in brushes do since #60: the stamp reaches its square's corners instead of being cut by the preset's round+ tip (#75, reported by rodrigomoretto). At the default Focal Shift presets look as before; saved presets are unchanged.+## [0.10.6] - 2026-11-01### Addeddiff --git a/docs/guide/whats-new.md b/docs/guide/whats-new.mdindex 0c1e5091..d52ea61d 100644--- a/docs/guide/whats-new.md+++ b/docs/guide/whats-new.md@@ -5,6 +5,11 @@ chapter opens by itself the first time you start a new version; you can always f**Help > What's New**. Every detail is in the[changelog](https://github.com/islandmed/SculptForge/blob/main/CHANGELOG.md).+## Version 0.10.7++- **Full alphas on custom brushes**: at Focal Shift -100, Clay Slab and the other custom and Community brushes now+ show the whole alpha to its corners, as the built-in brushes do (#75).+## Version 0.10.6- **PBR viewport** (**Material > Viewport Shading > PBR**): see the texture's material as a game engine shows it,diff --git a/src/core/Sculpt.cpp b/src/core/Sculpt.cppindex 13704ad6..2a9a07c4 100644--- a/src/core/Sculpt.cpp+++ b/src/core/Sculpt.cpp@@ -993,7 +993,8 @@ void Sculptor::dabRecipe(Mesh& mesh, BVH& bvh, const BrushRecipe& recipe, constdab(mesh, bvh, BrushType::Standard, p, sym);return;}- remeshDab(mesh, bvh, p, sym, 1.0f, 1.0f);+ const bool useAlpha = p.alpha && !p.alpha->empty(); // (an alpha reaches its square's corners, #75)+ remeshDab(mesh, bvh, p, sym, 1.0f, useAlpha ? kAlphaReach : 1.0f);DabParams base = p;base.pressure = std::pow(std::clamp(p.pressure, 0.0f, 1.0f), recipe.pressureCurve);base.frontFacesOnly = p.frontFacesOnly || recipe.frontFacesOnly;@@ -1012,13 +1013,16 @@ void Sculptor::dabRecipe(Mesh& mesh, BVH& bvh, const BrushRecipe& recipe, constvoid Sculptor::dabRecipeSingle(Mesh& mesh, BVH& bvh, const BrushRecipe& r, const DabParams& p) {auto clock = std::chrono::steady_clock::now();- brushRegion(mesh, bvh, p.center, p.viewDir, p.radius, p.connectedOnly, p.viewFalloff, verts_, connected_);+ // An alpha (if any) modulates the recipe's tip, oriented on the view-facing plane. Focal Shift shifts the tip+ // (0 keeps the recipe's own Hardness / Tip Sharpness), and so the alpha with it. With an alpha the region+ // reaches the stamp's corners and, below 0, the round tip opens up toward 1 as alphaFalloff does, so at -100+ // the whole alpha shows (#75; the built-in brushes got this in #60).+ const bool useAlpha = p.alpha && !p.alpha->empty();+ brushRegion(mesh, bvh, p.center, p.viewDir, p.radius * (useAlpha ? kAlphaReach : 1.0f), p.connectedOnly,+ p.viewFalloff, verts_, connected_);if (verts_.empty()) return;const auto& pos = mesh.positions;const auto& nrm = mesh.normals;- // An alpha (if any) modulates the recipe's tip, oriented on the view-facing plane. Focal Shift shifts the tip- // (0 keeps the recipe's own Hardness / Tip Sharpness), and so the alpha with it.- const bool useAlpha = p.alpha && !p.alpha->empty();glm::vec3 aUp = projectOnPlane(p.alphaUp, p.viewDir);aUp = glm::length(aUp) > 1e-6f ? glm::normalize(aUp) : glm::vec3(0, 1, 0);const glm::vec3 aRight = glm::cross(aUp, -p.viewDir);@@ -1045,6 +1049,7 @@ void Sculptor::dabRecipeSingle(Mesh& mesh, BVH& bvh, const BrushRecipe& r, constfloat t = std::clamp((1.0f - brushDistance(p, pos[v]) / rad) / edge, 0.0f, 1.0f);if (p.focal != 0.0f) t = std::pow(t, std::exp2(2.0f * std::clamp(p.focal, -1.0f, 1.0f))); // (brushFalloff's)float w = std::pow(t * t * (3.0f - 2.0f * t), exponent);+ if (useAlpha && p.focal < 0.0f) w += (1.0f - w) * std::min(-p.focal, 1.0f); // (alphaFalloff's)acc.normal += nrm[v] * w;acc.center += pos[v] * w;acc.weight += w;diff --git a/tests/test_brushes.cpp b/tests/test_brushes.cppindex 77de51af..54920037 100644--- a/tests/test_brushes.cpp+++ b/tests/test_brushes.cpp@@ -6,6 +6,7 @@#include "TestHarness.h"#include "core/BrushAlpha.h"+#include "core/BrushRecipe.h"#include "core/Commands.h"#include "core/Primitives.h"#include "core/Sculpt.h"@@ -443,6 +444,57 @@ TEST(focal_shift_reaches_clay_buildup_and_recipes) {CHECK(a.mesh.positions == b.mesh.positions);}+// #75: custom and Community (recipe) brushes show the whole alpha at Focal Shift -100, as the built-ins do (#60):+// a DragRect-style single stamp of a corner-reaching alpha with Clay Slab displaces the square's corners, not+// only the round tip inside the brush circle. At 0 the preset keeps its own round tip.+TEST(custom_brush_full_alpha_at_focal_minus_100) {+ BrushRecipe slab;+ bool found = false;+ for (const BrushRecipe& r : builtinBrushRecipes())+ if (r.name == "Clay Slab") slab = r, found = true;+ CHECK(found);+ BrushAlpha full;+ full.name = "Full";+ full.width = full.height = 8;+ full.values.assign(64, 1.0f); // (white to its corners)+ BrushAlpha bark;+ CHECK(BrushAlpha::builtin("bark", bark));++ const float radius = 0.3f;+ const glm::vec3 corner(0.26f, 0, 0.26f); // (0.37 out: past the brush circle, inside the stamp's square)+ auto stampWith = [&](const BrushAlpha& alpha, float focal) {+ Document d = planeDoc();+ DabParams p = dabAt(glm::vec3(0), radius);+ p.alpha = α+ p.alphaUp = glm::vec3(0, 0, -1);+ p.focal = focal;+ d.sculptor.beginStroke(d.mesh, slab.name);+ d.sculptor.dabRecipe(d.mesh, d.bvh, slab, p, kNoSymmetry);+ d.undo.push(d.sculptor.endStroke());+ return d;+ };+ // Movement summed over the stamp's four corner regions (outside the circle, inside the square).+ auto cornerSum = [&](const Document& d) {+ float sum = 0.0f;+ for (const glm::vec3& v : d.mesh.positions) {+ const float cheb = std::max(std::abs(v.x), std::abs(v.z));+ if (glm::length(glm::vec2(v.x, v.z)) > radius * 1.05f && cheb < radius * 0.98f) sum += std::abs(v.y);+ }+ return sum;+ };++ const Document hard = stampWith(full, -1.0f), soft = stampWith(full, 0.0f);+ const float centre = hard.mesh.positions[nearest(hard.mesh, glm::vec3(0))].y;+ CHECK(centre > 0.0f);+ for (glm::vec3 c : {corner, glm::vec3(-corner.x, 0, corner.z), glm::vec3(corner.x, 0, -corner.z), -corner})+ CHECK(hard.mesh.positions[nearest(hard.mesh, c)].y > 0.5f * centre); // the corner texels are displaced+ CHECK(soft.mesh.positions[nearest(soft.mesh, corner)].y == 0.0f); // (0: the preset's own round tip)+ CHECK(cornerSum(soft) == 0.0f && cornerSum(hard) > 0.0f);++ // Bark reaches its corners too; at -100 they move, at 0 they don't.+ CHECK(cornerSum(stampWith(bark, -1.0f)) > 0.0f && cornerSum(stampWith(bark, 0.0f)) == 0.0f);+}+TEST(brush_set_alpha_command) {CommandRegistry reg;Document d = planeDoc();