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.

Community brush gallery: in-app browser, gallery repo content, previews, website page

islandmed29155316a6be
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4e157fb6..3d378fcc 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -46,6 +46,9 @@ add_library(sculptforge_core STATIC
src/core/Masking.cpp
src/core/BrushAlpha.cpp
src/core/Stroke.cpp
+ src/core/PathStroke.cpp
+ src/core/Sha256.cpp
+ src/core/BrushGallery.cpp
src/core/Polypaint.cpp
src/core/Matcap.cpp
src/core/Project.cpp
@@ -79,7 +82,7 @@ endif()
# --- Bring-your-own-AI (brush assistant). HTTPS via WinHTTP or libcurl. ---
add_library(sculptforge_ai STATIC src/ai/Http.cpp src/ai/BrushAssistant.cpp src/ai/Generator3D.cpp
- src/ai/ImageTo3DService.cpp src/ai/GradioClient.cpp src/ai/AiCommands.cpp src/link/Socket.cpp src/link/UnrealLink.cpp)
+ src/ai/ImageTo3DService.cpp src/ai/GradioClient.cpp src/ai/AiCommands.cpp src/ai/BrushGalleryClient.cpp src/link/Socket.cpp src/link/UnrealLink.cpp)
find_package(Threads REQUIRED)
target_link_libraries(sculptforge_ai PUBLIC sculptforge_core Threads::Threads)
if(WIN32)
@@ -120,6 +123,7 @@ if(SCULPTFORGE_BUILD_APP)
src/app/PanelMasking.cpp
src/app/PanelPolygroups.cpp
src/app/PanelBrushes.cpp
+ src/app/PanelBrushGallery.cpp
src/app/PanelPolypaint.cpp
src/app/PanelGoz.cpp
src/app/PanelProject.cpp
@@ -289,6 +293,15 @@ if(SCULPTFORGE_BUILD_TESTS)
endif()
add_test(NAME sculptforge_tests COMMAND sculptforge_tests)
+ # The seeded community brush gallery (tools/brush-gallery/repo) must stay valid
+ # and its index.json current: every brush is round-tripped through sculptforge-cli.
+ find_package(Python3 COMPONENTS Interpreter QUIET)
+ if(Python3_Interpreter_FOUND)
+ add_test(NAME brush_gallery_index
+ COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/tools/brush-gallery/build_index.py
+ ${CMAKE_CURRENT_SOURCE_DIR}/tools/brush-gallery/repo --check --cli $<TARGET_FILE:sculptforge-cli>)
+ endif()
+
# UI tests: each tests/ui/*.sfui script drives the real app headless (needs an
# OpenGL 3.3 context; CI runs them on Linux under Xvfb with Mesa). Label "ui".
if(SCULPTFORGE_BUILD_APP)
diff --git a/docs/brushes.md b/docs/brushes.md
new file mode 100644
index 00000000..7c8096e4
--- /dev/null
+++ b/docs/brushes.md
@@ -0,0 +1,158 @@
+# Sharing brushes
+
+SculptForge's custom brushes are *recipes*: a few numbers and names that describe how a brush moves the
+surface. A recipe is data, never code, so brushes are safe to swap with anyone. This guide covers the ways to
+share them: files, brush codes, studio folders and the community gallery, plus the file and index formats.
+
+## Brush files (`.sfbrush`)
+
+In **Brush Lab**, select a brush and click *Save .sfbrush...*; *Load .sfbrush...* (or dragging the file onto the
+window) loads one. From scripts and AI agents use the same commands:
+
+```sh
+sculptforge-cli -c 'brush_create name="Bark" depth=0.4 pattern=ridges patternAmount=1; brush_save path=bark.sfbrush'
+sculptforge-cli -c 'brush_load path=bark.sfbrush; brush_list'
+```
+
+A `.sfbrush` file is a JSON object:
+
+```json
+{
+ "name": "Snake Scales",
+ "description": "Tight rows of small, smooth scales for snakes, lizards and fish.",
+ "direction": "normal", "depth": 0.35, "plane": "none", "planeAmount": 0.5, "pinch": 0, "drag": 0, "smooth": 0,
+ "hardness": 0.55, "tipSharpness": 0, "pattern": "scales", "patternScale": 0.18, "patternAmount": 1,
+ "spacing": 0.2, "jitter": 0, "pressureCurve": 1, "frontFacesOnly": false, "cavityMask": 0,
+ "format": "sfbrush", "version": 1
+}
+```
+
+| Key | Range | What it does |
+|---|---|---|
+| `direction` | `normal` `inflate` `view` `stroke` | Which way the surface moves |
+| `depth` | -1 … 1 | Adds (positive) or carves (negative) |
+| `plane`, `planeAmount` | `none` `clay` `flatten` `fill` `scrape`; 0 … 1 | Planar behaviour and its strength |
+| `pinch` | -1 … 1 | Pulls the surface toward the stroke for crisp creases |
+| `drag` | 0 … 1 | Smears the surface along the stroke |
+| `smooth` | 0 … 1 | Relaxes the surface after each dab |
+| `hardness` | 0 … 1 | Soft airbrush edge to hard stamp |
+| `tipSharpness` | 0 … 1 | Round tip to needle point |
+| `pattern`, `patternScale`, `patternAmount` | `none` `noise` `scales` `ridges` `pores` `cracks`; 0.03 … 2; 0 … 1 | Surface texture, its size relative to the brush, and strength |
+| `spacing` | 0.02 … 2 | Dab spacing relative to brush size |
+| `jitter` | 0 … 1 | Random scatter of dabs |
+| `pressureCurve` | 0.3 … 3 | Tablet response |
+| `frontFacesOnly` | `true` / `false` | Protects the far side of thin parts |
+| `cavityMask` | -1 … 1 | Only cavities (positive) or only ridges (negative) |
+
+Missing keys take neutral defaults, out-of-range values are clamped, and unknown keys are ignored when loading
+(the gallery is stricter, see below). `sculptforge-cli --list` shows the same parameters under `brush_create`.
+
+## Brush codes
+
+A brush also fits in a single line of text you can paste into a chat, an issue or a forum post:
+`sfbrush1:` followed by the compact JSON recipe in base64url (no padding), at most 8 KB. Pasting a code into
+SculptForge decodes it with the same validation and clamping as a file. Codes are handled by the brush
+library (`brush_install code=...`).
+
+## Your library and studio folders
+
+Installed brushes live in your user library, `<app data>/brushes` (next to `ai.json`: `~/.local/share/SculptForge/SculptForge`
+on Linux, `~/Library/Application Support/SculptForge/SculptForge` on macOS, `%APPDATA%\SculptForge\SculptForge` on
+Windows). `brush_install path=FILE | code=TEXT | json=TEXT` writes the brush there, loads it and makes it active;
+installing a brush with the same name again updates it.
+
+Studios can share brushes read-only from network folders: every directory in `SCULPTFORGE_BRUSH_PATH`
+(separated by `:`, or `;` on Windows) is loaded at start-up. Each brush records where it came from (built-in,
+user, studio, project or gallery). Projects (`.sfproj`) also embed the brushes they use, so a scene opens with
+its brushes on any machine.
+
+## Community gallery
+
+The community gallery, [islandmed/sculptforge-brushes](https://github.com/islandmed/sculptforge-brushes), is a
+GitHub repository of CC0 brushes with matching preview images. Browse it:
+
+- **In the app:** *View > Community brushes*. Search, filter by tag, click **Install**. The index and previews
+ are cached, so the window still opens offline (with a notice); brushes you installed always work.
+- **On the web:** <https://islandmed.github.io/SculptForge/brushes.html>.
+- **From scripts and AI agents:**
+
+ ```sh
+ sculptforge-cli -c 'brush_gallery_search tag=skin'
+ sculptforge-cli -c 'brush_gallery_install name="Snake Scales"; stroke points="-0.5,0,0 0.5,0.2,0"'
+ ```
+
+Every download is checked against the SHA-256 the index lists and refused if it differs; it is then installed
+with `brush_install`.
+
+### Using another gallery
+
+The gallery is just an `index.json` next to `brushes/` and `previews/` folders, so a studio can mirror it or run
+its own on any web server or shared drive. Point SculptForge at it with, in order of precedence:
+
+1. the environment variable `SCULPTFORGE_BRUSH_GALLERY`, or
+2. the *Gallery* field at the bottom of the Community brushes window (saved in `<app data>/brush-gallery.json`),
+3. otherwise the official gallery,
+ `https://raw.githubusercontent.com/islandmed/sculptforge-brushes/main/index.json`.
+
+The value can be an `https://` or `http://` URL, a `file://` URL or a local folder, pointing at `index.json` or at the
+folder that holds it (`/mnt/studio/brushes` means `/mnt/studio/brushes/index.json`). Commands take the same value
+as `gallery=`.
+
+### Index format
+
+```json
+{
+ "format": "sculptforge-brush-gallery",
+ "version": 1,
+ "brushes": [
+ {
+ "name": "Snake Scales",
+ "description": "Tight rows of small, smooth scales for snakes, lizards and fish.",
+ "author": "SculptForge",
+ "tags": ["creature", "scales", "texture"],
+ "file": "brushes/snake-scales.sfbrush",
+ "preview": "previews/snake-scales.png",
+ "sha256": "9f0c…",
+ "added": "2026-10-21"
+ }
+ ]
+}
+```
+
+| Field | Rules |
+|---|---|
+| `format`, `version` | Must be `sculptforge-brush-gallery` and `1`. A newer version asks the user to update SculptForge. |
+| `name` | Unique (case-insensitive), at most 64 characters. |
+| `description`, `author` | Shown in the window; at most 500 and 64 characters. |
+| `tags` | Lowercase words for the tag filter. |
+| `file`, `preview` | Paths relative to the index: letters, digits, `.`, `_`, `-` and `/` only, no `..`. `file` ends in `.sfbrush`, `preview` in `.png` (512 x 384). |
+| `sha256` | Lowercase hex SHA-256 of the `.sfbrush` file. |
+| `added` | Date the brush joined the gallery, `YYYY-MM-DD`. |
+
+SculptForge skips (and logs) entries that break these rules instead of rejecting the whole index.
+
+### Gallery tools
+
+The gallery's tooling lives in this repository under `tools/brush-gallery/` (Python, standard library only):
+
+| Tool | What it does |
+|---|---|
+| `render_previews.py` | Renders the preview for each `.sfbrush`: `sculptforge --render` sculpts three S-curves of the brush on a sphere with the `stroke` command and shoots it with the Clay MatCap at a fixed camera. Brushes masked to cavities or ridges get raised forms or grooves to work on first. |
+| `build_index.py` | Validates every brush (only recipe keys plus `name`, `description`, `author`, `tags`, `format`, `version`; values in range, checked by round-tripping through `sculptforge-cli`; file named after the brush; a 512 x 384 preview) and writes `index.json`. `--validate-only` for pull requests, `--check` to verify the index is current (a ctest test runs it on `tools/brush-gallery/repo`). |
+| `sync_website.py` | Copies the gallery into `website/gallery/` and writes the cards into `website/brushes.html`. |
+| `repo/` | The content of the gallery repository: README with the submission rules, CC0 licence, seed brushes, previews, index and its GitHub Actions workflows (`validate.yml` checks pull requests; `publish.yml` renders missing previews and rebuilds `index.json` on `main`). |
+
+### The `stroke` command
+
+Previews use `stroke`, which is useful on its own for scripted detailing and AI agents: it applies a brush along
+a path on the active SubTool as one undoable stroke.
+
+```sh
+sculptforge-cli -c 'new_sphere subdivisions=7; brush_load path=bark.sfbrush;
+ stroke points="-0.8,0.3,0 -0.2,0.5,0 0.4,0.2,0 0.8,0.4,0" radius=0.1; export_glb path=bark.glb'
+```
+
+Each point is projected onto the surface along `view` (default `0,0,-1`, the front view), so a path drawn in the
+camera's plane behaves like a screen-space stroke; `curve` (default on) passes a smooth curve through the
+points. `brush` picks a library brush or a built-in (`Clay`, `Crease`, `Move`...); `radius`, `strength`,
+`pressure`, `invert`, `spacing`, `symmetry` and `seed` work as in the viewport.
diff --git a/src/ai/AiCommands.cpp b/src/ai/AiCommands.cpp
index 412144bd..a100d0ea 100644
--- a/src/ai/AiCommands.cpp
+++ b/src/ai/AiCommands.cpp
@@ -2,6 +2,7 @@
// SPDX-License-Identifier: GPL-3.0-or-later
#include "ai/AiCommands.h"
+#include "ai/BrushGalleryClient.h"
#include "ai/ImageTo3DService.h"
#include "core/EnginePresets.h"
#include "core/Voxel.h"
@@ -15,6 +16,7 @@ namespace sf::ai {
void registerAiCommands(CommandRegistry& registry, std::function<AiSettings()> settings) {
using T = ParamSpec::Type;
+ registerBrushGalleryCommands(registry); // brush_gallery_search, brush_gallery_install (BrushGalleryClient.cpp)
registry.add({"brush_ai",
"Design a brush from a description. Free by default (a hosted open model, no key); or "
"provider=anthropic (ANTHROPIC_API_KEY), or provider=openai-compatible endpoint=... model=... "
diff --git a/src/ai/BrushGalleryClient.cpp b/src/ai/BrushGalleryClient.cpp
new file mode 100644
index 00000000..3eacddfa
--- /dev/null
+++ b/src/ai/BrushGalleryClient.cpp
@@ -0,0 +1,252 @@
+// SculptForge - open source digital sculpting
+// SPDX-License-Identifier: GPL-3.0-or-later
+#include "ai/BrushGalleryClient.h"
+
+#include "ai/BrushAssistant.h"
+#include "ai/Http.h"
+#include "core/Json.h"
+#include "core/Sha256.h"
+
+#include <algorithm>
+#include <cctype>
+#include <cstdlib>
+#include <filesystem>
+#include <fstream>
+#include <iterator>
+
+namespace sf::ai {
+
+namespace {
+
+namespace fs = std::filesystem;
+
+constexpr size_t kMaxIndexBytes = 8u << 20;
+constexpr size_t kMaxPreviewBytes = 2u << 20;
+constexpr size_t kMaxBrushBytes = 64u << 10;
+
+fs::path utf8Path(const std::string& s) { return fs::path(std::u8string(s.begin(), s.end())); }
+std::string pathUtf8(const fs::path& p) {
+ const auto u = p.u8string();
+ return std::string(u.begin(), u.end());
+}
+
+// <app data>, the folder that holds ai.json.
+fs::path appDataDir() { return utf8Path(defaultAiSettingsPath()).parent_path(); }
+
+bool readFile(const fs::path& path, std::string& out, size_t limit) {
+ std::error_code ec;
+ const auto size = fs::file_size(path, ec);
+ if (ec || size > limit) return false;
+ std::ifstream f(path, std::ios::binary);
+ if (!f) return false;
+ out.assign(std::istreambuf_iterator<char>(f), std::istreambuf_iterator<char>());
+ return true;
+}
+
+bool writeFile(const fs::path& path, const std::string& data) {
+ std::error_code ec;
+ fs::create_directories(path.parent_path(), ec);
+ const fs::path tmp = path.string() + ".part";
+ {
+ std::ofstream f(tmp, std::ios::binary | std::ios::trunc);
+ if (!f || !(f << data)) return false;
+ }
+ fs::rename(tmp, path, ec);
+ return !ec;
+}
+
+// Reads a gallery file from disk (file:// or a path) or over HTTP(S).
+GalleryFetch fetch(const std::string& location, size_t limit) {
+ GalleryFetch r;
+ const std::string local = galleryLocalPath(location);
+ if (!local.empty()) {
+ r.ok = readFile(utf8Path(local), r.data, limit);
+ if (!r.ok) r.error = "Cannot read " + local;
+ return r;
+ }
+ const HttpResponse resp = httpRequest("GET", location, {"Accept: */*"}, {}, 30);
+ if (resp.status == 0) {
+ r.error = resp.error.empty() ? "No connection" : resp.error;
+ } else if (resp.status != 200) {
+ r.error = "The gallery answered HTTP " + std::to_string(resp.status);
+ } else if (resp.body.size() > limit) {
+ r.error = "The download is too large";
+ } else {
+ r.ok = true;
+ r.data = resp.body;
+ }
+ return r;
+}
+
+std::string fileName(const std::string& relative) {
+ const size_t slash = relative.find_last_of('/');
+ return slash == std::string::npos ? relative : relative.substr(slash + 1);
+}
+
+} // namespace
+
+std::string brushGallerySetting() {
+ std::string text;
+ if (!readFile(appDataDir() / "brush-gallery.json", text, 64 << 10)) return {};
+ Json j;
+ std::string err;
+ return Json::parse(text, j, err) ? j["url"].asString() : std::string();
+}
+
+bool saveBrushGallerySetting(const std::string& location, std::string& error) {
+ Json j = Json::object();
+ j.set("url", location);
+ const fs::path path = appDataDir() / "brush-gallery.json";
+ if (!writeFile(path, j.dump(true) + "\n")) {
+ error = "Cannot write " + pathUtf8(path);
+ return false;
+ }
+ return true;
+}
+
+bool brushGalleryFromEnvironment() {
+ const char* env = std::getenv("SCULPTFORGE_BRUSH_GALLERY");
+ return env && *env;
+}
+
+std::string brushGalleryLocation() {
+ if (brushGalleryFromEnvironment()) return galleryIndexLocation(std::getenv("SCULPTFORGE_BRUSH_GALLERY"));
+ return galleryIndexLocation(brushGallerySetting());
+}
+
+std::string brushGalleryCacheDir(const std::string& indexLocation) {
+ return pathUtf8(appDataDir() / "brush-gallery-cache" / sha256Hex(indexLocation).substr(0, 16));
+}
+
+GalleryFetch fetchGalleryIndex(const std::string& indexLocation) {
+ const fs::path cached = utf8Path(brushGalleryCacheDir(indexLocation)) / "index.json";
+ GalleryFetch r = fetch(indexLocation, kMaxIndexBytes);
+ GalleryIndex parsed;
+ std::string parseError;
+ if (r.ok && !parseGalleryIndex(r.data, parsed, parseError)) {
+ r.ok = false;
+ r.error = parseError;
+ return r; // a broken index is reported, never replaced by an old copy silently
+ }
+ if (r.ok) {
+ writeFile(cached, r.data);
+ return r;
+ }
+ GalleryFetch old;
+ if (readFile(cached, old.data, kMaxIndexBytes)) {
+ old.ok = true;
+ old.fromCache = true;
+ old.error = r.error;
+ return old;
+ }
+ return r;
+}
+
+GalleryFetch fetchGalleryPreview(const std::string& indexLocation, const GalleryBrush& brush) {
+ GalleryFetch r;
+ if (brush.preview.empty()) {
+ r.error = "No preview";
+ return r;
+ }
+ const fs::path cached = utf8Path(brushGalleryCacheDir(indexLocation)) / "previews" /
+ (brush.sha256.substr(0, 16) + "-" + fileName(brush.preview));
+ if (readFile(cached, r.data, kMaxPreviewBytes)) {
+ r.ok = true;
+ return r;
+ }
+ r = fetch(resolveGalleryPath(indexLocation, brush.preview), kMaxPreviewBytes);
+ if (r.ok) writeFile(cached, r.data);
+ return r;
+}
+
+bool downloadGalleryBrush(const std::string& indexLocation, const GalleryBrush& brush, std::string& localPath,
+ std::string& error) {
+ const GalleryFetch r = fetch(resolveGalleryPath(indexLocation, brush.file), kMaxBrushBytes);
+ if (!r.ok) {
+ error = r.error;
+ return false;
+ }
+ if (!galleryHashMatches(r.data, brush.sha256)) {
+ error = "'" + brush.name + "' does not match the gallery's checksum - not installed";
+ return false;
+ }
+ const fs::path path = utf8Path(brushGalleryCacheDir(indexLocation)) / "brushes" / fileName(brush.file);
+ if (!writeFile(path, r.data)) {
+ error = "Cannot write " + pathUtf8(path);
+ return false;
+ }
+ localPath = pathUtf8(path);
+ return true;
+}
+
+CommandResult installGalleryBrushFile(const CommandRegistry& registry, Document& doc, const std::string& path) {
+ const bool library = registry.find("brush_install") != nullptr;
+ return registry.execute(doc, library ? "brush_install" : "brush_load", {{"path", path}});
+}
+
+void registerBrushGalleryCommands(CommandRegistry& registry) {
+ using T = ParamSpec::Type;
+ // Reads and parses the configured gallery's index (or `gallery`, if given).
+ auto loadIndex = [](const Args& a, std::string& location, GalleryIndex& index, std::string& error) {
+ const std::string given = argString(a, "gallery");
+ location = given.empty() ? brushGalleryLocation() : galleryIndexLocation(given);
+ const GalleryFetch r = fetchGalleryIndex(location);
+ if (!r.ok) {
+ error = "Cannot reach the brush gallery (" + r.error + ")";
+ return false;
+ }
+ return parseGalleryIndex(r.data, index, error);
+ };
+ const ParamSpec galleryParam{"gallery", T::String,
+ "Gallery index URL or folder (default: $SCULPTFORGE_BRUSH_GALLERY or the community "
+ "gallery).",
+ false};
+
+ registry.add({"brush_gallery_search",
+ "Search the community brush gallery (shared, CC0 sculpting brushes). Lists name, tags and "
+ "description; install one with brush_gallery_install.",
+ {{"query", T::String, "Words to look for in names, descriptions and tags (default: all).", false},
+ {"tag", T::String, "Only brushes with this tag, e.g. skin, stone, creature.", false},
+ galleryParam},
+ [loadIndex](Document&, const Args& a) -> CommandResult {
+ std::string location, error;
+ GalleryIndex index;
+ if (!loadIndex(a, location, index, error)) return {false, error};
+ std::string out;
+ int n = 0;
+ for (const auto& b : index.brushes) {
+ if (!galleryBrushMatches(b, argString(a, "query"), argString(a, "tag"))) continue;
+ std::string tags;
+ for (const auto& t : b.tags) tags += (tags.empty() ? "" : ", ") + t;
+ out += (n++ ? "\n" : "") + b.name + " [" + tags + "] by " + b.author + " - " + b.description;
+ }
+ if (!n) return {true, "No gallery brushes match"};
+ return {true, out};
+ }});
+
+ registry.add({"brush_gallery_install",
+ "Download a brush from the community gallery (checked against its SHA-256), add it to the "
+ "library and make it the active brush.",
+ {{"name", T::String, "Brush name as listed by brush_gallery_search.", true}, galleryParam},
+ // The registry owns this command, so it outlives the reference.
+ [loadIndex, &registry](Document& doc, const Args& a) -> CommandResult {
+ std::string location, error;
+ GalleryIndex index;
+ if (!loadIndex(a, location, index, error)) return {false, error};
+ const std::string name = argString(a, "name");
+ const GalleryBrush* found = nullptr;
+ for (const auto& b : index.brushes)
+ if (b.name.size() == name.size() &&
+ std::equal(b.name.begin(), b.name.end(), name.begin(), [](char x, char y) {
+ return std::tolower(static_cast<unsigned char>(x)) ==
+ std::tolower(static_cast<unsigned char>(y));
+ }))
+ found = &b;
+ if (!found) return {false, "The gallery has no brush called '" + name + "'"};
+ std::string path;
+ if (!downloadGalleryBrush(location, *found, path, error)) return {false, error};
+ return installGalleryBrushFile(registry, doc, path);
+ }});
+}
+
+} // namespace sf::ai
diff --git a/src/ai/BrushGalleryClient.h b/src/ai/BrushGalleryClient.h
new file mode 100644
index 00000000..5b43f572
--- /dev/null
+++ b/src/ai/BrushGalleryClient.h
@@ -0,0 +1,50 @@
+// SculptForge - open source digital sculpting
+// SPDX-License-Identifier: GPL-3.0-or-later
+//
+// Downloads from the community brush gallery (see core/BrushGallery.h): the
+// index, preview images and brushes, with an on-disk cache so the gallery
+// still opens offline. Blocking - call from a worker thread. The gallery can
+// be an https URL, a file:// URL or a local folder (tests, studio mirrors).
+#pragma once
+
+#include "core/BrushGallery.h"
+#include "core/Commands.h"
+
+#include <string>
+
+namespace sf::ai {
+
+struct GalleryFetch {
+ bool ok = false;
+ std::string data;
+ std::string error;
+ bool fromCache = false; // the network failed and this is the last good copy
+};
+
+// The gallery location: $SCULPTFORGE_BRUSH_GALLERY, else the saved setting, else the official gallery.
+std::string brushGalleryLocation();
+bool brushGalleryFromEnvironment();
+// Saves the gallery setting (empty = the official gallery) in <app data>/brush-gallery.json.
+bool saveBrushGallerySetting(const std::string& location, std::string& error);
+std::string brushGallerySetting(); // the saved setting ("" if none)
+
+// Cache folder for one gallery: <app data>/brush-gallery-cache/<hash of its location>.
+std::string brushGalleryCacheDir(const std::string& indexLocation);
+
+// The index text; falls back to the cached copy when the gallery is unreachable.
+GalleryFetch fetchGalleryIndex(const std::string& indexLocation);
+// A brush's preview PNG (cached by the brush's hash, so an edited brush gets a fresh preview).
+GalleryFetch fetchGalleryPreview(const std::string& indexLocation, const GalleryBrush& brush);
+// Downloads a brush, checks it against the index's SHA-256 and stores it in
+// the cache; `localPath` is the verified file, ready for brush_install.
+bool downloadGalleryBrush(const std::string& indexLocation, const GalleryBrush& brush, std::string& localPath,
+ std::string& error);
+
+// Installs a downloaded, verified brush file: brush_install when the registry
+// has it (adds it to the user's library), otherwise brush_load (this session only).
+CommandResult installGalleryBrushFile(const CommandRegistry& registry, Document& doc, const std::string& path);
+
+// brush_gallery_search and brush_gallery_install (scripts, AI agents).
+void registerBrushGalleryCommands(CommandRegistry& registry);
+
+} // namespace sf::ai
diff --git a/src/app/App.cpp b/src/app/App.cpp
index 3b1f65ee..a459222f 100644
--- a/src/app/App.cpp
+++ b/src/app/App.cpp
@@ -231,6 +231,7 @@ bool App::init(const AppOptions& options) {
void App::shutdown() {
if (refTexture_) gl::DeleteTextures(1, &refTexture_);
+ gallery_.reset(); // its preview textures need the GL context
ImGui_ImplOpenGL3_Shutdown();
ImGui_ImplSDL3_Shutdown();
ImGui::DestroyContext();
@@ -245,6 +246,7 @@ int App::renderHeadless() {
camera_.frame(options_.hideMesh && !doc_.splats.empty() ? doc_.splats.bounds(0.9f) : sceneBounds());
camera_.aspect = float(options_.width) / float(std::max(options_.height, 1));
camera_.pitch = glm::radians(options_.pitchDegrees);
+ camera_.distance /= options_.zoom;
RenderSettings settings = renderSettings_;
settings.wireframe = options_.wireframe;
settings.showPolygroups = settings.showPolygroups || options_.polygroups;
@@ -1025,6 +1027,7 @@ void App::drawUi() {
if (showGamePanel_) drawGameExportPanel();
drawSplatSection();
if (showBrushLab_) drawBrushLab();
+ drawBrushGallery();
if (showImageTo3D_) drawImageTo3D();
if (showPolypaintPanel_) drawPolypaintPanel();
if (previewLod_ >= 0) {
@@ -1150,6 +1153,7 @@ void App::drawMenuBar() {
ImGui::MenuItem("Game Ready Panel", nullptr, &showGamePanel_);
ImGui::MenuItem("Gaussian Splats", nullptr, &showSplatsPanel_);
ImGui::MenuItem("Brush Lab", nullptr, &showBrushLab_);
+ ImGui::MenuItem("Community brushes", nullptr, &showBrushGallery_);
ImGui::MenuItem("Polypaint & Materials", nullptr, &showPolypaintPanel_);
ImGui::MenuItem("Generate 3D", nullptr, &showImageTo3D_);
ImGui::MenuItem("Show Splats", nullptr, &renderSettings_.showSplats, !doc_.splats.empty());
diff --git a/src/app/App.h b/src/app/App.h
index 3eefa891..20cc9f50 100644
--- a/src/app/App.h
+++ b/src/app/App.h
@@ -31,6 +31,7 @@ struct AppOptions {
std::string renderPath; // headless: render a PNG and exit
int width = 1024, height = 1024;
float yawDegrees = -30.0f, pitchDegrees = -15.0f;
+ float zoom = 1.0f; // headless: camera this many times closer than the framed view
int turntable = 0; // headless: render N frames around the model (<path>_000.png ...)
bool wireframe = false;
bool polygroups = false; // headless: colour each polygroup
@@ -372,6 +373,14 @@ private:
// Split by polygroups needs more than one group; counted only when the active mesh changes.
uint64_t splitGroupsKey_ = ~uint64_t(0);
bool splitGroupsPossible_ = false;
+ // Community brushes window (PanelBrushGallery.cpp): browse, search and install shared brushes.
+ void drawBrushGallery(); // also finishes background downloads while the window is closed
+ void refreshBrushGallery();
+ void pollBrushGallery();
+ bool galleryBusy() const; // UI tests: wait_idle
+ static void destroyBrushGallery(struct BrushGalleryState* state);
+ bool showBrushGallery_ = false;
+ std::unique_ptr<struct BrushGalleryState, void (*)(struct BrushGalleryState*)> gallery_{nullptr, &destroyBrushGallery};
};
} // namespace sf
diff --git a/src/app/Demo.h b/src/app/Demo.h
index 5527a272..80534376 100644
--- a/src/app/Demo.h
+++ b/src/app/Demo.h
@@ -114,6 +114,7 @@ private:
bool testing_ = false;
std::vector<std::string> failures_;
std::string frameText_, shotRequest_, shotDir_, scriptName_, lineText_;
+ std::string scriptDir_; // folder of the .sfui script ($SCRIPT_DIR in env steps)
SDL_Keymod held_ = SDL_KMOD_NONE; // modifiers held by `hold` (Ctrl to mask, Ctrl+Shift to hide...)
};
diff --git a/src/app/PanelBrushGallery.cpp b/src/app/PanelBrushGallery.cpp
new file mode 100644
index 00000000..5ec9a557
--- /dev/null
+++ b/src/app/PanelBrushGallery.cpp
@@ -0,0 +1,391 @@
+// SculptForge - open source digital sculpting
+// SPDX-License-Identifier: GPL-3.0-or-later
+//
+// View > Community brushes: browse the shared brush gallery
+// (github.com/islandmed/sculptforge-brushes), search it, and install brushes
+// in one click. Everything that touches the network runs on worker threads;
+// the index and previews are cached on disk so the window still works offline.
+// Downloads are checked against the index's SHA-256 before brush_install.
+#include "app/App.h"
+
+#include "ai/BrushGalleryClient.h"
+#include "render/GL.h"
+
+#include <algorithm>
+#include <cctype>
+#include <cfloat>
+#include <cmath>
+#include <cstdio>
+#include <map>
+
+namespace sf {
+
+struct BrushGalleryState {
+ struct Preview {
+ Image image;
+ bool ok = false;
+ };
+ struct Loaded {
+ ai::GalleryFetch fetch;
+ GalleryIndex index;
+ std::vector<std::string> warnings;
+ std::string error;
+ };
+ struct Download {
+ std::string path, error;
+ };
+
+ std::string location; // index URL / path in use
+ std::future<Loaded> pendingIndex;
+ GalleryIndex index;
+ std::vector<std::string> tags;
+ bool loaded = false, offline = false;
+ std::string error, offlineReason;
+ int skipped = 0; // malformed index entries
+
+ std::map<std::string, std::future<Preview>> pendingPreviews; // by brush hash + file
+ std::map<std::string, GLuint> textures; // by brush hash + file (0 = no preview)
+ std::map<std::string, std::future<Download>> pendingInstalls; // by brush name
+ std::string installError;
+
+ char search[128] = "";
+ std::string tag;
+ char sourceEdit[512] = "";
+ bool sourceEditInit = false;
+
+ ~BrushGalleryState() {
+ for (auto& [file, tex] : textures)
+ if (tex) gl::DeleteTextures(1, &tex);
+ }
+};
+
+namespace {
+
+constexpr int kMaxPreviewJobs = 4;
+
+bool sameName(const std::string& a, const std::string& b) {
+ return a.size() == b.size() && std::equal(a.begin(), a.end(), b.begin(), [](char x, char y) {
+ return std::tolower(static_cast<unsigned char>(x)) == std::tolower(static_cast<unsigned char>(y));
+ });
+}
+
+template <class T> bool done(const std::future<T>& f) {
+ return f.valid() && f.wait_for(std::chrono::seconds(0)) == std::future_status::ready;
+}
+template <class T> bool running(const std::future<T>& f) { return f.valid() && !done(f); }
+
+GLuint uploadTexture(const Image& img) {
+ GLuint tex = 0;
+ gl::GenTextures(1, &tex);
+ gl::BindTexture(GL_TEXTURE_2D, tex);
+ gl::PixelStorei(GL_UNPACK_ALIGNMENT, 1);
+ gl::TexImage2D(GL_TEXTURE_2D, 0, GLint(GL_RGBA8), img.width, img.height, 0, GL_RGBA, GL_UNSIGNED_BYTE, img.rgba.data());
+ gl::TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GLint(GL_LINEAR));
+ gl::TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GLint(GL_LINEAR));
+ gl::TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GLint(GL_CLAMP_TO_EDGE));
+ gl::TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GLint(GL_CLAMP_TO_EDGE));
+ gl::BindTexture(GL_TEXTURE_2D, 0);
+ return tex;
+}
+
+void hint(const char* text) {
+ ImGui::PushStyleColor(ImGuiCol_Text, ImGui::GetStyleColorVec4(ImGuiCol_TextDisabled));
+ ImGui::TextWrapped("%s", text);
+ ImGui::PopStyleColor();
+}
+
+} // namespace
+
+void App::destroyBrushGallery(BrushGalleryState* state) { delete state; }
+
+bool App::galleryBusy() const {
+ if (!gallery_) return false;
+ if (running(gallery_->pendingIndex)) return true;
+ for (const auto& [k, f] : gallery_->pendingPreviews)
+ if (running(f)) return true;
+ for (const auto& [k, f] : gallery_->pendingInstalls)
+ if (running(f)) return true;
+ return false;
+}
+
+void App::refreshBrushGallery() {
+ if (!gallery_) gallery_ = {new BrushGalleryState, &App::destroyBrushGallery};
+ BrushGalleryState& g = *gallery_;
+ if (running(g.pendingIndex)) return;
+ const std::string location = ai::brushGalleryLocation();
+ if (location != g.location) { // another gallery: forget what the old one showed
+ for (auto& [key, tex] : g.textures)
+ if (tex) gl::DeleteTextures(1, &tex);
+ g.textures.clear();
+ g.index = {};
+ g.tags.clear();
+ g.loaded = false;
+ }
+ g.location = location;
+ g.error.clear();
+ g.installError.clear();
+ g.pendingIndex = std::async(std::launch::async, [location = g.location] {
+ BrushGalleryState::Loaded r;
+ r.fetch = ai::fetchGalleryIndex(location);
+ if (!r.fetch.ok) r.error = r.fetch.error;
+ else if (!parseGalleryIndex(r.fetch.data, r.index, r.error, &r.warnings)) r.fetch.ok = false;
+ return r;
+ });
+}
+
+void App::pollBrushGallery() {
+ if (!gallery_) return;
+ BrushGalleryState& g = *gallery_;
+ if (done(g.pendingIndex)) {
+ BrushGalleryState::Loaded r = g.pendingIndex.get();
+ if (r.fetch.ok) {
+ g.index = std::move(r.index);
+ g.tags = galleryTags(g.index);
+ g.loaded = true;
+ g.offline = r.fetch.fromCache;
+ g.offlineReason = r.fetch.error;
+ g.skipped = int(r.warnings.size());
+ for (const auto& w : r.warnings) SDL_Log("Brush gallery: %s", w.c_str());
+ if (!g.tag.empty() && std::find(g.tags.begin(), g.tags.end(), g.tag) == g.tags.end()) g.tag.clear();
+ } else {
+ g.error = r.error.empty() ? "Unknown error" : r.error;
+ }
+ }
+ for (auto it = g.pendingPreviews.begin(); it != g.pendingPreviews.end();) {
+ if (!done(it->second)) {
+ ++it;
+ continue;
+ }
+ BrushGalleryState::Preview p = it->second.get();
+ g.textures[it->first] = p.ok ? uploadTexture(p.image) : 0;
+ it = g.pendingPreviews.erase(it);
+ }
+ for (auto it = g.pendingInstalls.begin(); it != g.pendingInstalls.end();) {
+ if (!done(it->second)) {
+ ++it;
+ continue;
+ }
+ const BrushGalleryState::Download d = it->second.get();
+ if (d.error.empty()) {
+ // brush_install (the user's library) once it exists; brush_load keeps it for this session.
+ runCommand(commands_.find("brush_install") ? "brush_install" : "brush_load", {{"path", d.path}});
+ if (!lastCommandOk_) g.installError = status_;
+ } else {
+ g.installError = d.error;
+ status_ = d.error;
+ }
+ it = g.pendingInstalls.erase(it);
+ }
+}
+
+void App::drawBrushGallery() {
+ pollBrushGallery();
+ if (!showBrushGallery_) return;
+ if (!gallery_ || (!gallery_->loaded && gallery_->error.empty() && !gallery_->pendingIndex.valid())) refreshBrushGallery();
+ BrushGalleryState& g = *gallery_;
+
+ const float scale = uiScale_;
+ const ImGuiViewport* vp = ImGui::GetMainViewport();
+ ImGui::SetNextWindowSize(ImVec2(760 * scale, 640 * scale), ImGuiCond_FirstUseEver);
+ ImGui::SetNextWindowPos(vp->GetCenter(), ImGuiCond_FirstUseEver, ImVec2(0.5f, 0.5f));
+ ImGui::SetNextWindowSizeConstraints(ImVec2(360 * scale, 300 * scale), ImVec2(FLT_MAX, FLT_MAX));
+ ImGui::SetNextWindowBgAlpha(1.0f); // a browsing window: nothing behind it should show through
+ if (!ImGui::Begin("Community brushes", &showBrushGallery_, ImGuiWindowFlags_NoCollapse)) {
+ ImGui::End();
+ return;
+ }
+
+ // Toolbar: search, tag filter, refresh, share.
+ const float shareW = ImGui::CalcTextSize("Share yours").x + ImGui::GetStyle().FramePadding.x * 2;
+ const float refreshW = ImGui::CalcTextSize("Refresh").x + ImGui::GetStyle().FramePadding.x * 2;
+ const float tagW = 150 * scale;
+ const float spacing = ImGui::GetStyle().ItemSpacing.x;
+ ImGui::SetNextItemWidth(std::max(80.0f, ImGui::GetContentRegionAvail().x - tagW - refreshW - shareW - 3 * spacing));
+ ImGui::SetNextItemAllowOverlap();
+ ImGui::InputTextWithHint("##gallerysearch", "Search brushes (scales, skin, stone...)", g.search, sizeof g.search);
+ if (g.search[0]) { // a clear button inside the field's right end
+ const ImVec2 end = ImGui::GetItemRectMax(), start = ImGui::GetItemRectMin();
+ const float h = end.y - start.y;
+ ImGui::SetCursorScreenPos(ImVec2(end.x - h, start.y));
+ ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0, 0, 0, 0));
+ if (ImGui::Button("x##clearsearch", ImVec2(h, h))) g.search[0] = '\0';
+ ImGui::PopStyleColor();
+ if (ImGui::IsItemHovered()) ImGui::SetTooltip("Clear the search");
+ } // SameLine below continues after the field (the button ends where it does)
+ ImGui::SameLine();
+ ImGui::SetNextItemWidth(tagW);
+ if (ImGui::BeginCombo("##gallerytag", g.tag.empty() ? "All tags" : g.tag.c_str())) {
+ if (ImGui::Selectable("All tags", g.tag.empty())) g.tag.clear();
+ for (const auto& t : g.tags)
+ if (ImGui::Selectable(t.c_str(), g.tag == t)) g.tag = t;
+ ImGui::EndCombo();
+ }
+ ImGui::SameLine();
+ ImGui::BeginDisabled(running(g.pendingIndex));
+ if (ImGui::Button("Refresh")) refreshBrushGallery();
+ ImGui::EndDisabled();
+ ImGui::SameLine();
+ if (ImGui::Button("Share yours")) {
+ if (interactive()) SDL_OpenURL(kBrushGalleryShareUrl);
+ status_ = std::string("Share a brush: ") + kBrushGalleryShareUrl;
+ }
+ if (ImGui::IsItemHovered())
+ ImGui::SetTooltip("Save your brush from Brush Lab, then open a pull request on the gallery.\nOpens %s",
+ kBrushGalleryShareUrl);
+
+ // State line: loading, offline, error.
+ const ImVec4 warnColor(0.95f, 0.70f, 0.30f, 1.0f), errorColor(1.0f, 0.45f, 0.40f, 1.0f);
+ if (running(g.pendingIndex) && !g.loaded) {
+ hint("Loading the brush gallery...");
+ } else if (!g.error.empty() && !g.loaded) {
+ ImGui::Spacing();
+ ImGui::PushStyleColor(ImGuiCol_Text, errorColor);
+ ImGui::TextWrapped("Can't reach the brush gallery: %s", g.error.c_str());
+ ImGui::PopStyleColor();
+ hint(galleryLocalPath(g.location).empty()
+ ? "Check your internet connection and try again. Brushes you already installed keep working."
+ : "Check that the gallery folder exists and has an index.json. Brushes you already installed keep working.");
+ if (ImGui::Button("Try again")) refreshBrushGallery();
+ } else if (g.loaded) {
+ if (g.offline) {
+ ImGui::PushStyleColor(ImGuiCol_Text, warnColor);
+ ImGui::TextWrapped("Offline - showing the gallery from your last visit (%s).", g.offlineReason.c_str());
+ ImGui::PopStyleColor();
+ } else if (!g.error.empty()) {
+ ImGui::PushStyleColor(ImGuiCol_Text, errorColor);
+ ImGui::TextWrapped("Refresh failed: %s", g.error.c_str());
+ ImGui::PopStyleColor();
+ }
+ if (!g.installError.empty()) {
+ ImGui::PushStyleColor(ImGuiCol_Text, errorColor);
+ ImGui::TextWrapped("%s", g.installError.c_str());
+ ImGui::PopStyleColor();
+ }
+ }
+
+ // The grid of brushes.
+ std::vector<const GalleryBrush*> shown;
+ for (const auto& b : g.index.brushes)
+ if (galleryBrushMatches(b, g.search, g.tag)) shown.push_back(&b);
+ if (g.loaded) {
+ std::string count = std::to_string(shown.size()) + (shown.size() == 1 ? " brush" : " brushes");
+ if (shown.size() != g.index.brushes.size()) count += " of " + std::to_string(g.index.brushes.size());
+ if (g.skipped) count += " (" + std::to_string(g.skipped) + " invalid entries skipped)";
+ hint(count.c_str());
+ }
+
+ const float footer = ImGui::GetFrameHeightWithSpacing() + ImGui::GetTextLineHeightWithSpacing();
+ if (ImGui::BeginChild("##gallerygrid", ImVec2(0, -footer), ImGuiChildFlags_None)) {
+ if (g.loaded && shown.empty()) hint(g.index.brushes.empty() ? "The gallery is empty." : "No brushes match your search.");
+ const float avail = ImGui::GetContentRegionAvail().x;
+ const float minCard = 190 * scale;
+ const int columns = std::max(1, int((avail + spacing) / (minCard + spacing)));
+ const float cardW = std::floor((avail - spacing * float(columns - 1)) / float(columns));
+ const float imageH = std::floor((cardW - 2 * ImGui::GetStyle().WindowPadding.x) * 0.75f);
+ const float cardH = imageH + ImGui::GetStyle().WindowPadding.y * 2 + ImGui::GetTextLineHeightWithSpacing() * 3 +
+ ImGui::GetFrameHeight() + ImGui::GetStyle().ItemSpacing.y;
+ int column = 0;
+ int jobs = 0;
+ for (const auto& [k, f] : g.pendingPreviews) jobs += running(f) ? 1 : 0;
+ for (const GalleryBrush* b : shown) {
+ if (column > 0) ImGui::SameLine();
+ ImGui::PushID(b->file.c_str());
+ ImGui::BeginChild("##card", ImVec2(cardW, cardH), ImGuiChildFlags_Borders, ImGuiWindowFlags_NoScrollbar);
+ const float innerW = ImGui::GetContentRegionAvail().x;
+
+ // Preview: fetched lazily once the card is on screen, a few at a time.
+ const bool cardVisible = ImGui::IsRectVisible(ImVec2(innerW, imageH));
+ const std::string key = b->sha256 + b->file; // an edited brush gets its new preview
+ auto tex = g.textures.find(key);
+ if (tex == g.textures.end() && cardVisible && !g.pendingPreviews.count(key) && jobs < kMaxPreviewJobs) {
+ ++jobs;
+ g.pendingPreviews[key] = std::async(std::launch::async, [location = g.location, brush = *b] {
+ BrushGalleryState::Preview p;
+ const ai::GalleryFetch f = ai::fetchGalleryPreview(location, brush);
+ std::string err;
+ p.ok = f.ok && Image::decode(reinterpret_cast<const unsigned char*>(f.data.data()), f.data.size(),
+ p.image, err);
+ return p;
+ });
+ }
+ const ImVec2 imagePos = ImGui::GetCursorScreenPos();
+ if (tex != g.textures.end() && tex->second) {
+ ImGui::Image(ImTextureID(uintptr_t(tex->second)), ImVec2(innerW, imageH));
+ } else {
+ ImGui::Dummy(ImVec2(innerW, imageH));
+ ImDrawList* dl = ImGui::GetWindowDrawList();
+ dl->AddRectFilled(imagePos, ImVec2(imagePos.x + innerW, imagePos.y + imageH), IM_COL32(28, 29, 33, 255), 4 * scale);
+ const char* text = tex == g.textures.end() ? "Loading preview..." : "No preview";
+ const ImVec2 ts = ImGui::CalcTextSize(text);
+ dl->AddText(ImVec2(imagePos.x + (innerW - ts.x) * 0.5f, imagePos.y + (imageH - ts.y) * 0.5f),
+ ImGui::GetColorU32(ImGuiCol_TextDisabled), text);
+ }
+ if (ImGui::IsItemHovered() && !b->description.empty()) {
+ ImGui::BeginTooltip();
+ ImGui::PushTextWrapPos(ImGui::GetFontSize() * 22);
+ ImGui::TextUnformatted(b->description.c_str());
+ ImGui::PopTextWrapPos();
+ ImGui::EndTooltip();
+ }
+
+ ImGui::TextUnformatted(b->name.c_str());
+ std::string byline = b->author.empty() ? std::string() : "by " + b->author;
+ std::string tagLine;
+ for (const auto& t : b->tags) tagLine += (tagLine.empty() ? "" : " ") + t;
+ ImGui::PushStyleColor(ImGuiCol_Text, ImGui::GetStyleColorVec4(ImGuiCol_TextDisabled));
+ ImGui::TextUnformatted(byline.empty() ? " " : byline.c_str());
+ ImGui::TextUnformatted(tagLine.empty() ? " " : tagLine.c_str());
+ ImGui::PopStyleColor();
+
+ const bool installing = g.pendingInstalls.count(b->name) > 0;
+ bool installed = false;
+ for (const auto& r : doc_.brushes) installed = installed || sameName(r.name, b->name);
+ if (installing) {
+ ImGui::BeginDisabled();
+ ImGui::Button(("Installing...##" + b->name).c_str(), ImVec2(-1, 0));
+ ImGui::EndDisabled();
+ } else if (installed) {
+ ImGui::BeginDisabled();
+ ImGui::Button(("Installed##" + b->name).c_str(), ImVec2(-1, 0));
+ ImGui::EndDisabled();
+ } else if (ImGui::Button(("Install##" + b->name).c_str(), ImVec2(-1, 0))) {
+ g.installError.clear();
+ g.pendingInstalls[b->name] = std::async(std::launch::async, [location = g.location, brush = *b] {
+ BrushGalleryState::Download d;
+ ai::downloadGalleryBrush(location, brush, d.path, d.error);
+ return d;
+ });
+ }
+ ImGui::EndChild();
+ ImGui::PopID();
+ column = (column + 1) % columns;
+ }
+ }
+ ImGui::EndChild();
+
+ // Footer: where the brushes come from.
+ if (!g.sourceEditInit) {
+ std::snprintf(g.sourceEdit, sizeof g.sourceEdit, "%s", ai::brushGallerySetting().c_str());
+ g.sourceEditInit = true;
+ }
+ hint("Brushes are data only (no code), shared under CC0. Installed brushes join your library.");
+ if (ai::brushGalleryFromEnvironment()) {
+ hint(("Gallery: " + g.location + " (from SCULPTFORGE_BRUSH_GALLERY)").c_str());
+ } else {
+ ImGui::AlignTextToFramePadding();
+ ImGui::TextDisabled("Gallery");
+ ImGui::SameLine();
+ ImGui::SetNextItemWidth(-ImGui::CalcTextSize("Use").x - ImGui::GetStyle().FramePadding.x * 2 - spacing);
+ ImGui::InputTextWithHint("##gallerysource", "Community gallery (or a URL / folder for a studio mirror)",
+ g.sourceEdit, sizeof g.sourceEdit);
+ ImGui::SameLine();
+ if (ImGui::Button("Use")) {
+ std::string err;
+ if (ai::saveBrushGallerySetting(g.sourceEdit, err)) refreshBrushGallery();
+ else status_ = err;
+ }
+ }
+ ImGui::End();
+}
+
+} // namespace sf
diff --git a/src/app/UiTest.cpp b/src/app/UiTest.cpp
index 4d4e9c29..b1daf430 100644
--- a/src/app/UiTest.cpp
+++ b/src/app/UiTest.cpp
@@ -14,6 +14,7 @@
// drag X0 Y0 X1 Y1 [S] left-drag in window fractions (rectangle hide, sliders...)
// orbit DX DY right-drag on the background, in pixels
// run COMMANDS sculptforge-cli commands, e.g. run new_sphere subdivisions=4
+// env NAME VALUE set an environment variable; $SCRIPT_DIR is the script's folder
// wait SECONDS / wait_idle [TIMEOUT] (AI requests and background jobs) / wait_for LABEL [TIMEOUT]
// expect LABEL / expect_not LABEL
// expect_text TEXT / expect_no_text TEXT any text drawn this frame contains TEXT
@@ -36,6 +37,7 @@
#include <algorithm>
#include <cctype>
#include <chrono>
+#include <cstdlib>
#include <cmath>
#include <filesystem>
#include <fstream>
@@ -409,6 +411,18 @@ bool Demo::parseStep(int line, const std::vector<std::string>& w, std::string& e
} else if (verb == "orbit") {
if (!need(2)) return false;
orbit(num(1, 0), num(2, 0), 0.4f);
+ } else if (verb == "env") {
+ if (!need(2)) return false;
+ std::string value = restOf(lineText_, 2);
+ for (size_t at = value.find("$SCRIPT_DIR"); at != std::string::npos; at = value.find("$SCRIPT_DIR", at))
+ value.replace(at, 11, scriptDir_);
+ run([name = w[1], value] {
+#if defined(_WIN32)
+ _putenv_s(name.c_str(), value.c_str());
+#else
+ setenv(name.c_str(), value.c_str(), 1);
+#endif
+ });
} else if (verb == "run") {
if (!need(1)) return false;
std::vector<ScriptStatement> statements;
@@ -429,7 +443,7 @@ bool Demo::parseStep(int line, const std::vector<std::string>& w, std::string& e
const float timeout = num(1, 120.0f);
steps_.push_back([this, line, timeout](float t) {
const bool idle = !busy(app_.pendingBrush_) && !busy(app_.pendingGenerator_) && !busy(app_.pendingModels_) &&
- !busy(app_.pendingUnreal_);
+ !busy(app_.pendingUnreal_) && !app_.galleryBusy();
if (idle) return true;
SDL_Delay(10); // real work runs in real time
if (t > timeout) fail(line, "still busy after " + number(timeout) + " s");
@@ -530,6 +544,11 @@ bool Demo::loadScript(const std::string& path, std::string& error) {
}
testing_ = true;
scriptName_ = std::filesystem::path(std::u8string(path.begin(), path.end())).filename().string();
+ {
+ std::error_code ec;
+ const auto dir = std::filesystem::absolute(std::filesystem::path(std::u8string(path.begin(), path.end())), ec).parent_path().u8string();
+ scriptDir_.assign(dir.begin(), dir.end());
+ }
shotDir_ = app_.options_.uiOutDir;
if (!shotDir_.empty()) {
std::error_code ec;
diff --git a/src/app/main.cpp b/src/app/main.cpp
index efa0f836..3216c18d 100644
--- a/src/app/main.cpp
+++ b/src/app/main.cpp
@@ -4,6 +4,7 @@
#include <SDL3/SDL_main.h>
+#include <algorithm>
#include <chrono>
#include <cstdio>
#include <cstdlib>
@@ -21,6 +22,7 @@ void usage() {
" --turntable N With --render: N frames around the model (out_000.png ...)\n"
" --size WxH Render size (default 1024x1024)\n"
" --view YAW,PITCH Camera angles in degrees (default -30,-15)\n"
+ " --zoom F Move the camera F times closer than the framed view (default 1)\n"
" --wireframe Render with wireframe overlay\n"
" --polygroups Render with polygroup colours\n"
" --hide-mesh Render only the Gaussian splats\n"
@@ -72,6 +74,7 @@ int main(int argc, char** argv) {
else if (a == "--turntable") options.turntable = std::atoi(next().c_str());
else if (a == "--size") sizeGiven = std::sscanf(next().c_str(), "%dx%d", &options.width, &options.height) == 2;
else if (a == "--view") std::sscanf(next().c_str(), "%f,%f", &options.yawDegrees, &options.pitchDegrees);
+ else if (a == "--zoom") options.zoom = std::max(0.05f, float(std::atof(next().c_str())));
else if (a == "--wireframe") options.wireframe = true;
else if (a == "--polygroups") options.polygroups = true;
else if (a == "--hide-mesh") options.hideMesh = true;
diff --git a/src/core/BrushGallery.cpp b/src/core/BrushGallery.cpp
new file mode 100644
index 00000000..df9a6993
--- /dev/null
+++ b/src/core/BrushGallery.cpp
@@ -0,0 +1,212 @@
+// SculptForge - open source digital sculpting
+// SPDX-License-Identifier: GPL-3.0-or-later
+#include "core/BrushGallery.h"
+
+#include "core/Json.h"
+#include "core/Sha256.h"
+
+#include <algorithm>
+#include <cctype>
+#include <filesystem>
+#include <map>
+#include <set>
+
+namespace sf {
+
+namespace {
+
+constexpr size_t kMaxEntries = 5000;
+
+std::string lower(std::string s) {
+ std::transform(s.begin(), s.end(), s.begin(), [](unsigned char c) { return char(std::tolower(c)); });
+ return s;
+}
+
+// Case-insensitive (URL schemes).
+bool startsWith(const std::string& s, const std::string& prefix) { return lower(s.substr(0, prefix.size())) == prefix; }
+
+bool endsWith(const std::string& s, const std::string& suffix) {
+ return s.size() >= suffix.size() && lower(s.substr(s.size() - suffix.size())) == suffix;
+}
+
+bool isUrl(const std::string& s) { return startsWith(s, "http://") || startsWith(s, "https://"); }
+
+std::string trim(const std::string& s) {
+ size_t a = 0, b = s.size();
+ while (a < b && std::isspace(static_cast<unsigned char>(s[a]))) ++a;
+ while (b > a && std::isspace(static_cast<unsigned char>(s[b - 1]))) --b;
+ return s.substr(a, b - a);
+}
+
+std::string clipped(const std::string& s, size_t limit) { return s.size() > limit ? s.substr(0, limit) : s; }
+
+std::string percentDecode(const std::string& s) {
+ std::string out;
+ for (size_t i = 0; i < s.size(); ++i) {
+ if (s[i] == '%' && i + 2 < s.size() && std::isxdigit(static_cast<unsigned char>(s[i + 1])) &&
+ std::isxdigit(static_cast<unsigned char>(s[i + 2]))) {
+ out += char(std::stoi(s.substr(i + 1, 2), nullptr, 16));
+ i += 2;
+ } else {
+ out += s[i];
+ }
+ }
+ return out;
+}
+
+} // namespace
+
+bool isSafeGalleryPath(const std::string& path) {
+ if (path.empty() || path.size() > 200 || path.front() == '/' || path.back() == '/') return false;
+ size_t start = 0;
+ while (start <= path.size()) {
+ size_t end = path.find('/', start);
+ if (end == std::string::npos) end = path.size();
+ const std::string part = path.substr(start, end - start);
+ if (part.empty() || part == "." || part == "..") return false;
+ for (unsigned char c : part)
+ if (!std::isalnum(c) && c != '.' && c != '_' && c != '-') return false;
+ start = end + 1;
+ }
+ return true;
+}
+
+bool isSha256Hex(const std::string& text) {
+ return text.size() == 64 &&
+ std::all_of(text.begin(), text.end(), [](unsigned char c) { return std::isxdigit(c) != 0; });
+}
+
+bool parseGalleryIndex(const std::string& text, GalleryIndex& out, std::string& error, std::vector<std::string>* warnings) {
+ out.brushes.clear();
+ Json j;
+ if (!Json::parse(text, j, error)) {
+ error = "The gallery index is not valid JSON (" + error + ")";
+ return false;
+ }
+ if (!j.isObject() || j["format"].asString() != kBrushGalleryIndexFormat || !j["brushes"].isArray()) {
+ error = "Not a SculptForge brush gallery index";
+ return false;
+ }
+ if (j["version"].asNumber(0) != 1.0) {
+ error = j["version"].asNumber(0) > 1.0 ? "The gallery needs a newer SculptForge - please update"
+ : "Unsupported gallery index version";
+ return false;
+ }
+ auto warn = [&](const std::string& w) {
+ if (warnings) warnings->push_back(w);
+ };
+ std::set<std::string> names;
+ size_t index = 0;
+ for (const Json& e : j["brushes"].items()) {
+ ++index;
+ if (out.brushes.size() >= kMaxEntries) {
+ warn("Only the first " + std::to_string(kMaxEntries) + " brushes are listed");
+ break;
+ }
+ const std::string where = "Entry " + std::to_string(index);
+ if (!e.isObject()) {
+ warn(where + ": not an object");
+ continue;
+ }
+ GalleryBrush b;
+ b.name = clipped(trim(e["name"].asString()), 64);
+ b.file = e["file"].asString();
+ b.preview = e["preview"].asString();
+ b.sha256 = lower(e["sha256"].asString());
+ if (b.name.empty()) {
+ warn(where + ": no name");
+ continue;
+ }
+ if (!isSafeGalleryPath(b.file) || !endsWith(b.file, ".sfbrush")) {
+ warn(b.name + ": invalid file path '" + b.file + "'");
+ continue;
+ }
+ if (!isSha256Hex(b.sha256)) {
+ warn(b.name + ": missing or invalid sha256");
+ continue;
+ }
+ if (!b.preview.empty() && (!isSafeGalleryPath(b.preview) || !endsWith(b.preview, ".png"))) {
+ warn(b.name + ": invalid preview path ignored");
+ b.preview.clear();
+ }
+ if (!names.insert(lower(b.name)).second) {
+ warn(b.name + ": listed twice (the first one is kept)");
+ continue;
+ }
+ b.description = clipped(e["description"].asString(), 500);
+ b.author = clipped(e["author"].asString(), 64);
+ b.added = clipped(e["added"].asString(), 32);
+ for (const Json& t : e["tags"].items()) {
+ const std::string tag = clipped(lower(trim(t.asString())), 32);
+ if (!tag.empty() && b.tags.size() < 12 && std::find(b.tags.begin(), b.tags.end(), tag) == b.tags.end())
+ b.tags.push_back(tag);
+ }
+ out.brushes.push_back(std::move(b));
+ }
+ std::sort(out.brushes.begin(), out.brushes.end(),
+ [](const GalleryBrush& a, const GalleryBrush& b) { return lower(a.name) < lower(b.name); });
+ return true;
+}
+
+std::string galleryIndexLocation(const std::string& setting) {
+ std::string s = trim(setting);
+ if (s.empty()) return kDefaultBrushGalleryUrl;
+ if (endsWith(s, ".json")) return s;
+ while (s.size() > 1 && (s.back() == '/' || s.back() == '\\')) s.pop_back();
+ const bool backslashes = !isUrl(s) && !startsWith(s, "file://") && s.find('\\') != std::string::npos &&
+ s.find('/') == std::string::npos;
+ return s + (backslashes ? "\\" : "/") + "index.json";
+}
+
+std::string resolveGalleryPath(const std::string& indexLocation, const std::string& relative) {
+ const size_t slash = indexLocation.find_last_of(isUrl(indexLocation) || startsWith(indexLocation, "file://") ? "/" : "/\\");
+ if (slash == std::string::npos) return relative;
+ return indexLocation.substr(0, slash + 1) + relative;
+}
+
+std::string galleryLocalPath(const std::string& location) {
+ if (isUrl(location)) return {};
+ if (!startsWith(location, "file://")) return location;
+ std::string path = percentDecode(location.substr(7));
+ if (startsWith(path, "localhost/")) path = path.substr(9);
+#if defined(_WIN32)
+ // file:///C:/brushes -> C:/brushes
+ if (path.size() > 2 && path[0] == '/' && std::isalpha(static_cast<unsigned char>(path[1])) && path[2] == ':')
+ path = path.substr(1);
+#endif
+ return path;
+}
+
+bool galleryHashMatches(const std::string& data, const std::string& expectedHex) {
+ return isSha256Hex(expectedHex) && sha256Hex(data) == lower(expectedHex);
+}
+
+bool galleryBrushMatches(const GalleryBrush& brush, const std::string& query, const std::string& tag) {
+ if (!tag.empty() && std::find(brush.tags.begin(), brush.tags.end(), lower(tag)) == brush.tags.end()) return false;
+ std::string haystack = lower(brush.name + "\n" + brush.description + "\n" + brush.author);
+ for (const auto& t : brush.tags) haystack += "\n" + t;
+ // Every word of the query must appear somewhere.
+ const std::string q = lower(query);
+ size_t i = 0;
+ while (i < q.size()) {
+ while (i < q.size() && std::isspace(static_cast<unsigned char>(q[i]))) ++i;
+ size_t j = i;
+ while (j < q.size() && !std::isspace(static_cast<unsigned char>(q[j]))) ++j;
+ if (j > i && haystack.find(q.substr(i, j - i)) == std::string::npos) return false;
+ i = j;
+ }
+ return true;
+}
+
+std::vector<std::string> galleryTags(const GalleryIndex& index) {
+ std::map<std::string, int> counts;
+ for (const auto& b : index.brushes)
+ for (const auto& t : b.tags) ++counts[t];
+ std::vector<std::pair<std::string, int>> sorted(counts.begin(), counts.end());
+ std::stable_sort(sorted.begin(), sorted.end(), [](const auto& a, const auto& b) { return a.second > b.second; });
+ std::vector<std::string> out;
+ for (const auto& [tag, n] : sorted) out.push_back(tag);
+ return out;
+}
+
+} // namespace sf
diff --git a/src/core/BrushGallery.h b/src/core/BrushGallery.h
new file mode 100644
index 00000000..a915e0c6
--- /dev/null
+++ b/src/core/BrushGallery.h
@@ -0,0 +1,65 @@
+// SculptForge - open source digital sculpting
+// SPDX-License-Identifier: GPL-3.0-or-later
+//
+// The community brush gallery (github.com/islandmed/sculptforge-brushes): an
+// index.json listing shared .sfbrush files with their preview images and
+// SHA-256 hashes. This is the network-free part - parsing and validating the
+// index, resolving its relative paths, searching - so it can be tested; the
+// downloads live in ai/BrushGalleryClient.h. Format: docs/brushes.md.
+#pragma once
+
+#include <string>
+#include <vector>
+
+namespace sf {
+
+inline constexpr const char* kDefaultBrushGalleryUrl =
+ "https://raw.githubusercontent.com/islandmed/sculptforge-brushes/main/index.json";
+inline constexpr const char* kBrushGalleryShareUrl =
+ "https://github.com/islandmed/sculptforge-brushes#share-your-brush";
+inline constexpr const char* kBrushGalleryIndexFormat = "sculptforge-brush-gallery";
+
+struct GalleryBrush {
+ std::string name;
+ std::string description;
+ std::string author;
+ std::vector<std::string> tags;
+ std::string file; // .sfbrush path relative to the index
+ std::string preview; // PNG path relative to the index (may be empty)
+ std::string sha256; // lowercase hex of the .sfbrush file
+ std::string added; // YYYY-MM-DD
+};
+
+struct GalleryIndex {
+ std::vector<GalleryBrush> brushes; // sorted by name
+};
+
+// Parses an index.json. Entries that are malformed (missing name, unsafe path,
+// bad hash, ...) are skipped and described in `warnings`; the call fails only
+// when the text is not a gallery index at all or is from a newer, incompatible format.
+bool parseGalleryIndex(const std::string& text, GalleryIndex& out, std::string& error,
+ std::vector<std::string>* warnings = nullptr);
+
+// A relative path inside the gallery: no scheme, no leading '/', no '..', no
+// backslashes, only [A-Za-z0-9._-] and '/' (so an index can never point outside it).
+bool isSafeGalleryPath(const std::string& path);
+bool isSha256Hex(const std::string& text);
+
+// Normalises the gallery setting to the index location: an http(s) or file://
+// URL or a local path, either to index.json or to the folder holding it.
+std::string galleryIndexLocation(const std::string& setting);
+// `relative` resolved against the folder of `indexLocation` (URL or path).
+std::string resolveGalleryPath(const std::string& indexLocation, const std::string& relative);
+// file:// URLs and plain paths are read from disk; returns the path ("" for http/https).
+std::string galleryLocalPath(const std::string& location);
+
+// True if `data` hashes to `expectedHex` (case-insensitive).
+bool galleryHashMatches(const std::string& data, const std::string& expectedHex);
+
+// Case-insensitive search over name, description, author and tags; empty
+// `query` matches everything. `tag` (if not empty) must be one of the brush's tags.
+bool galleryBrushMatches(const GalleryBrush& brush, const std::string& query, const std::string& tag);
+// Every tag used in the index, most used first (ties alphabetical).
+std::vector<std::string> galleryTags(const GalleryIndex& index);
+
+} // namespace sf
diff --git a/src/core/Commands.cpp b/src/core/Commands.cpp
index e6aa494e..7903d68c 100644
--- a/src/core/Commands.cpp
+++ b/src/core/Commands.cpp
@@ -7,6 +7,7 @@
#include "core/EnginePresets.h"
#include "core/ImageTo3D.h"
#include "core/Masking.h"
+#include "core/PathStroke.h"
#include "core/Polygroups.h"
#include "core/SubTools.h"
#include "core/Polypaint.h"
@@ -539,6 +540,75 @@ CommandRegistry::CommandRegistry() {
}});
registerBrushCommands(*this); // brush_set_alpha (BrushAlpha.cpp)
+ add({"stroke",
+ "Apply a brush along a path on the active SubTool, like dragging the cursor in the viewport (one undo "
+ "step). Each point is projected onto the surface along the view direction, so points drawn in the "
+ "camera's plane give a screen-space stroke. Used for scripted detailing and brush preview renders.",
+ {{"points", T::String,
+ "World-space path: \"x,y,z x,y,z ...\" (or separated by '|'). One point stamps a single dab.", true},
+ {"brush", T::String,
+ "Custom brush (library name) or built-in brush (Standard, Clay, Crease, Inflate, ...). Default: the "
+ "active brush.",
+ false},
+ {"view", T::String, "Direction the path is projected along, \"x,y,z\" (default 0,0,-1: front view).", false},
+ {"radius", T::Number, "Brush radius in world units (default 4% of the mesh size).", false},
+ {"strength", T::Number, "Strength 0-1 (default 0.5).", false},
+ {"pressure", T::Number, "Constant pen pressure 0-1 (default 1).", false},
+ {"invert", T::Bool, "Invert the brush (carve instead of build, like holding Alt).", false},
+ {"curve", T::Bool, "Smooth curve through the points (default true); false = straight segments.", false},
+ {"spacing", T::Number, "Dab spacing as a fraction of the radius (default: the brush's own).", false},
+ {"symmetry", T::String, "Mirror axes, e.g. \"x\" or \"xz\" (default none).", false},
+ {"seed", T::Number, "Random seed for brush jitter (default 1).", false}},
+ [](Document& doc, const Args& a) -> CommandResult {
+ PathStroke st;
+ std::string err;
+ if (!parsePathPoints(argString(a, "points"), st.points, err)) return {false, err};
+ const std::string view = argString(a, "view");
+ if (!view.empty() && !parseVec3(view, st.view)) return {false, "Bad view '" + view + "' (expected x,y,z)"};
+ st.radius = float(argNumber(a, "radius", 0.0));
+ st.strength = float(argNumber(a, "strength", 0.5));
+ st.pressure = float(argNumber(a, "pressure", 1.0));
+ st.invert = argBool(a, "invert", false);
+ st.curve = argBool(a, "curve", true);
+ st.spacing = float(argNumber(a, "spacing", -1.0));
+ st.seed = uint32_t(std::max(argNumber(a, "seed", 1.0), 0.0));
+ for (char c : argString(a, "symmetry")) {
+ const char l = char(std::tolower(static_cast<unsigned char>(c)));
+ if (l == 'x') st.symmetry.x = true;
+ else if (l == 'y') st.symmetry.y = true;
+ else if (l == 'z') st.symmetry.z = true;
+ else return {false, "symmetry takes the axes x, y and z"};
+ }
+
+ // Resolve the brush: a library recipe (exact name, then any case), then a built-in type.
+ const std::string name = argString(a, "brush");
+ auto lower = [](std::string s) {
+ std::transform(s.begin(), s.end(), s.begin(), [](unsigned char c) { return char(std::tolower(c)); });
+ return s;
+ };
+ const BrushRecipe* recipe = nullptr;
+ BrushType type = BrushType::Standard;
+ if (name.empty()) {
+ if (doc.activeBrush >= 0 && doc.activeBrush < int(doc.brushes.size())) recipe = &doc.brushes[doc.activeBrush];
+ } else {
+ for (const auto& b : doc.brushes)
+ if (b.name == name) recipe = &b;
+ for (const auto& b : doc.brushes)
+ if (!recipe && lower(b.name) == lower(name)) recipe = &b;
+ if (!recipe) {
+ int found = -1;
+ for (int i = 0; i < int(BrushType::Count); ++i)
+ if (lower(brushName(BrushType(i))) == lower(name)) found = i;
+ if (found < 0) return {false, "No such brush: " + name};
+ type = BrushType(found);
+ }
+ }
+ const int dabs = strokePath(doc, recipe, type, st, err);
+ if (dabs < 0) return {false, err};
+ if (dabs == 0) return {false, "The path never crosses the surface (check the points and view)"};
+ return {true, "Stroked " + std::to_string(dabs) + " dabs with " + (recipe ? recipe->name : brushName(type))};
+ }});
+
add({"splat_info", "Report the loaded Gaussian splats.", {},
[](Document& doc, const Args&) -> CommandResult {
if (doc.splats.empty()) return {true, "No splats loaded"};
diff --git a/src/core/PathStroke.cpp b/src/core/PathStroke.cpp
new file mode 100644
index 00000000..b29ae074
--- /dev/null
+++ b/src/core/PathStroke.cpp
@@ -0,0 +1,176 @@
+// SculptForge - open source digital sculpting
+// SPDX-License-Identifier: GPL-3.0-or-later
+#include "core/PathStroke.h"
+
+#include <algorithm>
+#include <cctype>
+#include <cmath>
+#include <cstdlib>
+
+namespace sf {
+
+bool parseVec3(const std::string& text, glm::vec3& out) {
+ const char* s = text.c_str();
+ for (int i = 0; i < 3; ++i) {
+ char* end = nullptr;
+ const float v = std::strtof(s, &end);
+ if (end == s || !std::isfinite(v)) return false;
+ out[i] = v;
+ s = end;
+ if (i < 2) {
+ if (*s != ',') return false;
+ ++s;
+ }
+ }
+ return *s == '\0';
+}
+
+bool parsePathPoints(const std::string& text, std::vector<glm::vec3>& out, std::string& error) {
+ out.clear();
+ size_t i = 0;
+ while (i < text.size()) {
+ while (i < text.size() && (std::isspace(static_cast<unsigned char>(text[i])) || text[i] == '|')) ++i;
+ if (i >= text.size()) break;
+ size_t j = i;
+ while (j < text.size() && !std::isspace(static_cast<unsigned char>(text[j])) && text[j] != '|') ++j;
+ glm::vec3 p;
+ if (!parseVec3(text.substr(i, j - i), p)) {
+ error = "Bad point '" + text.substr(i, j - i) + "' (expected x,y,z)";
+ return false;
+ }
+ out.push_back(p);
+ i = j;
+ }
+ if (out.empty()) {
+ error = "No points given (expected \"x,y,z x,y,z ...\")";
+ return false;
+ }
+ return true;
+}
+
+std::vector<glm::vec3> samplePath(const std::vector<glm::vec3>& points, bool curve, float step) {
+ std::vector<glm::vec3> out;
+ if (points.empty()) return out;
+ if (points.size() == 1 || step <= 0.0f) return {points.front()};
+
+ // Dense polyline first (a centripetal-free uniform Catmull-Rom is plenty for hand-placed points).
+ std::vector<glm::vec3> line;
+ const size_t n = points.size();
+ for (size_t i = 0; i + 1 < n; ++i) {
+ const glm::vec3 p0 = points[i ? i - 1 : 0], p1 = points[i], p2 = points[i + 1], p3 = points[std::min(i + 2, n - 1)];
+ const int sub = curve && n > 2 ? 32 : 1;
+ for (int k = 0; k < sub; ++k) {
+ const float t = float(k) / float(sub), t2 = t * t, t3 = t2 * t;
+ line.push_back(0.5f * (2.0f * p1 + (p2 - p0) * t + (2.0f * p0 - 5.0f * p1 + 4.0f * p2 - p3) * t2 +
+ (3.0f * p1 - p0 - 3.0f * p2 + p3) * t3));
+ }
+ }
+ line.push_back(points.back());
+
+ // Then points at even arc length along it.
+ out.push_back(line.front());
+ float carry = 0.0f; // distance walked since the last sample
+ for (size_t i = 0; i + 1 < line.size(); ++i) {
+ const glm::vec3 a = line[i], b = line[i + 1];
+ const float len = glm::length(b - a);
+ float at = step - carry;
+ while (at <= len) {
+ out.push_back(a + (b - a) * (at / len));
+ at += step;
+ }
+ carry = len - (at - step);
+ }
+ return out;
+}
+
+int strokePath(Document& doc, const BrushRecipe* recipe, BrushType type, const PathStroke& stroke, std::string& error) {
+ Mesh& mesh = doc.mesh;
+ if (mesh.triangleCount() == 0) {
+ error = "The active SubTool is empty";
+ return -1;
+ }
+ if (stroke.points.empty()) {
+ error = "No points given";
+ return -1;
+ }
+ const float viewLen = glm::length(stroke.view);
+ if (!(viewLen > 1e-6f)) {
+ error = "The view direction must not be zero";
+ return -1;
+ }
+ const glm::vec3 view = stroke.view / viewLen;
+ doc.syncBvh();
+
+ const AABB box = mesh.bounds();
+ const float diag = std::max(glm::length(box.extent()), 1e-4f);
+ const float radius = stroke.radius > 0.0f ? stroke.radius : diag * 0.04f;
+ const float spacing = std::max(stroke.spacing >= 0.0f ? stroke.spacing : recipe ? recipe->spacing : 0.15f, 0.02f);
+ const std::vector<glm::vec3> samples = samplePath(stroke.points, stroke.curve, radius * spacing);
+
+ // Screen axes of the projection: jitter scatters in them, alphas point "up" along `up`.
+ const glm::vec3 helper = std::abs(view.y) > 0.9f ? glm::vec3(0.0f, 0.0f, -1.0f) : glm::vec3(0.0f, 1.0f, 0.0f);
+ const glm::vec3 right = glm::normalize(glm::cross(view, helper));
+ const glm::vec3 up = glm::cross(right, view);
+
+ const std::string label = recipe ? recipe->name : brushName(type);
+ if (!doc.sculptor.beginStroke(mesh, label, doc.activeLayer)) {
+ error = "Active layer weight is 0 - raise it to sculpt into the layer";
+ return -1;
+ }
+
+ uint32_t rng = stroke.seed ? stroke.seed : 1u;
+ auto rnd = [&rng] { // -1..1, same xorshift as viewport strokes
+ rng ^= rng << 13;
+ rng ^= rng >> 17;
+ rng ^= rng << 5;
+ return float(rng & 0xffff) / 65535.0f * 2.0f - 1.0f;
+ };
+ auto project = [&](glm::vec3 p, RayHit& hit) {
+ const glm::vec3 origin = p - view * (glm::dot(p - box.center(), view) + diag);
+ return doc.bvh.raycast(mesh, origin, view, hit);
+ };
+
+ DabParams base;
+ base.viewDir = view;
+ base.radius = radius;
+ base.strength = std::clamp(stroke.strength, 0.0f, 1.0f);
+ base.pressure = std::clamp(stroke.pressure, 0.0f, 1.0f);
+ base.invert = stroke.invert;
+ base.frontFacesOnly = recipe && recipe->frontFacesOnly;
+ base.alpha = &doc.brushAlpha;
+ base.alphaUp = up;
+
+ int dabs = 0;
+ if (type == BrushType::Move && !recipe) {
+ // Move grabs the region under the first point and drags it along the path.
+ RayHit hit;
+ if (project(samples.front(), hit)) {
+ DabParams p = base;
+ p.center = hit.position;
+ doc.sculptor.beginGrab(mesh, doc.bvh, p, stroke.symmetry);
+ for (size_t i = 1; i < samples.size(); ++i) doc.sculptor.grab(mesh, doc.bvh, samples[i] - samples[i - 1]);
+ dabs = int(samples.size());
+ }
+ } else {
+ glm::vec3 last{0.0f};
+ bool haveLast = false;
+ for (glm::vec3 s : samples) {
+ if (recipe && recipe->jitter > 0.0f) s += (right * rnd() + up * rnd()) * (recipe->jitter * radius);
+ RayHit hit;
+ if (!project(s, hit)) continue;
+ DabParams p = base;
+ p.center = hit.position;
+ p.strokeDelta = haveLast ? hit.position - last : glm::vec3(0.0f);
+ last = hit.position;
+ haveLast = true;
+ if (recipe) doc.sculptor.dabRecipe(mesh, doc.bvh, *recipe, p, stroke.symmetry);
+ else doc.sculptor.dab(mesh, doc.bvh, type, p, stroke.symmetry);
+ ++dabs;
+ }
+ }
+ UndoRecord record = doc.sculptor.endStroke();
+ if (!record.empty()) doc.undo.push(std::move(record));
+ return dabs;
+}
+
+} // namespace sf
diff --git a/src/core/PathStroke.h b/src/core/PathStroke.h
new file mode 100644
index 00000000..2106d0a0
--- /dev/null
+++ b/src/core/PathStroke.h
@@ -0,0 +1,44 @@
+// SculptForge - open source digital sculpting
+// SPDX-License-Identifier: GPL-3.0-or-later
+//
+// Headless strokes: applies a brush along a path of world-space points, the
+// way a cursor drag does in the viewport. Each dab lands where a ray along the
+// view direction through the path point meets the active SubTool, so a path
+// drawn in the camera's plane behaves like a screen-space stroke. Used by the
+// `stroke` command (scripts, AI agents, brush preview renders) and tests.
+#pragma once
+
+#include "core/Document.h"
+
+#include <cstdint>
+#include <string>
+#include <vector>
+
+namespace sf {
+
+struct PathStroke {
+ std::vector<glm::vec3> points; // the path (2+ points; 1 stamps a single dab)
+ glm::vec3 view{0.0f, 0.0f, -1.0f}; // projection / camera direction (into the scene)
+ float radius = 0.0f; // world units; <= 0: 4% of the mesh's bounding box diagonal
+ float strength = 0.5f; // 0..1
+ float pressure = 1.0f; // constant pen pressure, 0..1
+ bool invert = false;
+ bool curve = true; // pass a smooth Catmull-Rom curve through the points (else straight segments)
+ float spacing = -1.0f; // dab spacing as a fraction of the radius; < 0: the recipe's (0.15 for built-ins)
+ uint32_t seed = 1; // recipe jitter is deterministic per seed
+ Symmetry symmetry{false, false, false};
+};
+
+// Parses "x,y,z x,y,z ..." (points separated by spaces or '|'). False on malformed input.
+bool parsePathPoints(const std::string& text, std::vector<glm::vec3>& out, std::string& error);
+// Parses "x,y,z".
+bool parseVec3(const std::string& text, glm::vec3& out);
+
+// Samples the path at even `step` distance (curved through the points when `curve` is set).
+std::vector<glm::vec3> samplePath(const std::vector<glm::vec3>& points, bool curve, float step);
+
+// Strokes the active SubTool with `recipe` (when not null) or the built-in brush `type`,
+// as one undoable step. Returns the number of dabs that hit the surface, or -1 on error.
+int strokePath(Document& doc, const BrushRecipe* recipe, BrushType type, const PathStroke& stroke, std::string& error);
+
+} // namespace sf
diff --git a/src/core/Sha256.cpp b/src/core/Sha256.cpp
new file mode 100644
index 00000000..eb1778dc
--- /dev/null
+++ b/src/core/Sha256.cpp
@@ -0,0 +1,83 @@
+// SculptForge - open source digital sculpting
+// SPDX-License-Identifier: GPL-3.0-or-later
+#include "core/Sha256.h"
+
+#include <array>
+
+namespace sf {
+
+namespace {
+
+constexpr uint32_t kRound[64] = {
+ 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, 0xd807aa98, 0x12835b01,
+ 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc,
+ 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147,
+ 0x06ca6351, 0x14292967, 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,
+ 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070, 0x19a4c116, 0x1e376c08,
+ 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3, 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208,
+ 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2};
+
+constexpr uint32_t rotr(uint32_t x, int n) { return (x >> n) | (x << (32 - n)); }
+
+void compress(std::array<uint32_t, 8>& h, const uint8_t* block) {
+ uint32_t w[64];
+ for (int i = 0; i < 16; ++i)
+ w[i] = uint32_t(block[i * 4]) << 24 | uint32_t(block[i * 4 + 1]) << 16 | uint32_t(block[i * 4 + 2]) << 8 |
+ uint32_t(block[i * 4 + 3]);
+ for (int i = 16; i < 64; ++i) {
+ const uint32_t s0 = rotr(w[i - 15], 7) ^ rotr(w[i - 15], 18) ^ (w[i - 15] >> 3);
+ const uint32_t s1 = rotr(w[i - 2], 17) ^ rotr(w[i - 2], 19) ^ (w[i - 2] >> 10);
+ w[i] = w[i - 16] + s0 + w[i - 7] + s1;
+ }
+ uint32_t a = h[0], b = h[1], c = h[2], d = h[3], e = h[4], f = h[5], g = h[6], hh = h[7];
+ for (int i = 0; i < 64; ++i) {
+ const uint32_t t1 = hh + (rotr(e, 6) ^ rotr(e, 11) ^ rotr(e, 25)) + ((e & f) ^ (~e & g)) + kRound[i] + w[i];
+ const uint32_t t2 = (rotr(a, 2) ^ rotr(a, 13) ^ rotr(a, 22)) + ((a & b) ^ (a & c) ^ (b & c));
+ hh = g;
+ g = f;
+ f = e;
+ e = d + t1;
+ d = c;
+ c = b;
+ b = a;
+ a = t1 + t2;
+ }
+ h[0] += a;
+ h[1] += b;
+ h[2] += c;
+ h[3] += d;
+ h[4] += e;
+ h[5] += f;
+ h[6] += g;
+ h[7] += hh;
+}
+
+} // namespace
+
+std::string sha256Hex(const void* data, size_t size) {
+ std::array<uint32_t, 8> h = {0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a,
+ 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19};
+ const auto* bytes = static_cast<const uint8_t*>(data);
+ size_t i = 0;
+ for (; i + 64 <= size; i += 64) compress(h, bytes + i);
+
+ // Final block(s): the remaining bytes, 0x80, zeros, then the bit length (big-endian).
+ uint8_t tail[128] = {};
+ const size_t rest = size - i;
+ for (size_t k = 0; k < rest; ++k) tail[k] = bytes[i + k];
+ tail[rest] = 0x80;
+ const size_t tailLen = rest < 56 ? 64 : 128;
+ const uint64_t bits = uint64_t(size) * 8;
+ for (int k = 0; k < 8; ++k) tail[tailLen - 1 - k] = uint8_t(bits >> (8 * k));
+ compress(h, tail);
+ if (tailLen == 128) compress(h, tail + 64);
+
+ static const char* hex = "0123456789abcdef";
+ std::string out;
+ out.reserve(64);
+ for (uint32_t v : h)
+ for (int k = 28; k >= 0; k -= 4) out += hex[(v >> k) & 0xf];
+ return out;
+}
+
+} // namespace sf
diff --git a/src/core/Sha256.h b/src/core/Sha256.h
new file mode 100644
index 00000000..387cece0
--- /dev/null
+++ b/src/core/Sha256.h
@@ -0,0 +1,18 @@
+// SculptForge - open source digital sculpting
+// SPDX-License-Identifier: GPL-3.0-or-later
+//
+// SHA-256 (FIPS 180-4), for checking downloads such as community gallery
+// brushes against the hash their index publishes.
+#pragma once
+
+#include <cstddef>
+#include <cstdint>
+#include <string>
+
+namespace sf {
+
+// Lowercase hex digest of `size` bytes.
+std::string sha256Hex(const void* data, size_t size);
+inline std::string sha256Hex(const std::string& data) { return sha256Hex(data.data(), data.size()); }
+
+} // namespace sf
diff --git a/tests/test_brush_gallery.cpp b/tests/test_brush_gallery.cpp
new file mode 100644
index 00000000..6a6f78b2
--- /dev/null
+++ b/tests/test_brush_gallery.cpp
@@ -0,0 +1,301 @@
+// SculptForge - open source digital sculpting
+// SPDX-License-Identifier: GPL-3.0-or-later
+//
+// Community brush gallery: SHA-256, index parsing and validation, gallery
+// paths, search, installing from a local gallery folder, and the `stroke`
+// command used to render brush previews.
+#include "TestHarness.h"
+
+#include "ai/BrushGalleryClient.h"
+#include "core/BrushGallery.h"
+#include "core/Commands.h"
+#include "core/PathStroke.h"
+#include "core/Primitives.h"
+#include "core/Sha256.h"
+
+#include <cstdlib>
+#include <filesystem>
+#include <fstream>
+
+using namespace sf;
+
+namespace {
+
+const char* kIndex = R"({
+ "format": "sculptforge-brush-gallery",
+ "version": 1,
+ "brushes": [
+ {"name": "Snake Scales", "description": "Small scales.", "author": "Ann", "tags": ["Creature", "scales"],
+ "file": "brushes/snake-scales.sfbrush", "preview": "previews/snake-scales.png",
+ "sha256": "E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855", "added": "2026-10-21"},
+ {"name": "Cracked Earth", "description": "Dry mud.", "author": "Bo", "tags": ["environment", "cracks"],
+ "file": "brushes/cracked-earth.sfbrush", "preview": "previews/cracked-earth.png",
+ "sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"},
+ {"name": "Escape", "file": "../../etc/passwd.sfbrush",
+ "sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"},
+ {"name": "No Hash", "file": "brushes/no-hash.sfbrush"},
+ {"name": "snake scales", "file": "brushes/dupe.sfbrush",
+ "sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"},
+ {"name": "Odd Preview", "file": "brushes/odd.sfbrush", "preview": "https://evil.example/x.png",
+ "sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"},
+ 42
+ ]
+})";
+
+// Points the per-user data folder (where the gallery cache lives) at `dir` while alive.
+struct ScopedDataDir {
+#if defined(_WIN32)
+ static constexpr const char* kVar = "APPDATA";
+#else
+ static constexpr const char* kVar = "XDG_DATA_HOME";
+#endif
+ std::string old;
+ bool had = false;
+ explicit ScopedDataDir(const std::string& dir) {
+ if (const char* v = std::getenv(kVar)) old = v, had = true;
+ set(dir.c_str());
+ }
+ ~ScopedDataDir() { had ? set(old.c_str()) : unset(); }
+ static void set(const char* v) {
+#if defined(_WIN32)
+ _putenv_s(kVar, v);
+#else
+ setenv(kVar, v, 1);
+#endif
+ }
+ static void unset() {
+#if defined(_WIN32)
+ _putenv_s(kVar, "");
+#else
+ unsetenv(kVar);
+#endif
+ }
+};
+
+void writeText(const std::filesystem::path& p, const std::string& text) {
+ std::filesystem::create_directories(p.parent_path());
+ std::ofstream(p, std::ios::binary) << text;
+}
+
+} // namespace
+
+TEST(sha256_known_vectors) {
+ CHECK(sha256Hex("") == "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855");
+ CHECK(sha256Hex("abc") == "ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad");
+ CHECK(sha256Hex("abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq") ==
+ "248d6a61d20638b8e5c026930c3e6039a33ce45964ff2167f6ecedd419db06c1");
+ // 55 / 56 / 64 bytes: the padding boundary cases.
+ CHECK(sha256Hex(std::string(55, 'a')) == "9f4390f8d30c2dd92ec9f095b65e2b9ae9b0a925a5258e241c9f1e910f734318");
+ CHECK(sha256Hex(std::string(56, 'a')) == "b35439a4ac6f0948b6d6f9e3c6af0f5f590ce20f1bde7090ef7970686ec6738a");
+ CHECK(sha256Hex(std::string(64, 'a')) == "ffe054fe7ae0cb6dc65c3af9b61d5209f439851db43d0ba5997337df154668eb");
+ CHECK(sha256Hex(std::string(1000000, 'a')) == "cdc76e5c9914fb9281a1c7e284d73e67f1809a48a497200e046d39ccc7112cd0");
+}
+
+TEST(gallery_index_parses_and_skips_bad_entries) {
+ GalleryIndex index;
+ std::string error;
+ std::vector<std::string> warnings;
+ CHECK(parseGalleryIndex(kIndex, index, error, &warnings));
+ CHECK(index.brushes.size() == 3); // Snake Scales, Cracked Earth, Odd Preview
+ CHECK(index.brushes[0].name == "Cracked Earth"); // sorted by name
+ CHECK(index.brushes[2].name == "Snake Scales");
+ const GalleryBrush& snake = index.brushes[2];
+ CHECK(snake.author == "Ann");
+ CHECK(snake.tags.size() == 2 && snake.tags[0] == "creature"); // lowercased
+ CHECK(snake.sha256 == "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855");
+ CHECK(snake.added == "2026-10-21");
+ CHECK(index.brushes[1].name == "Odd Preview" && index.brushes[1].preview.empty()); // remote preview dropped
+ CHECK(warnings.size() == 5); // escape, no hash, duplicate, odd preview, not an object
+}
+
+TEST(gallery_index_rejects_wrong_documents) {
+ GalleryIndex index;
+ std::string error;
+ CHECK(!parseGalleryIndex("not json", index, error));
+ CHECK(!parseGalleryIndex(R"({"brushes": []})", index, error));
+ CHECK(!parseGalleryIndex(R"({"format": "sculptforge-brush-gallery", "version": 2, "brushes": []})", index, error));
+ CHECK(error.find("newer") != std::string::npos);
+ CHECK(parseGalleryIndex(R"({"format": "sculptforge-brush-gallery", "version": 1, "brushes": []})", index, error));
+ CHECK(index.brushes.empty());
+}
+
+TEST(gallery_paths_are_confined) {
+ CHECK(isSafeGalleryPath("brushes/snake-scales.sfbrush"));
+ CHECK(isSafeGalleryPath("previews/a_b.1.png"));
+ CHECK(!isSafeGalleryPath(""));
+ CHECK(!isSafeGalleryPath("/etc/passwd"));
+ CHECK(!isSafeGalleryPath("brushes/../../x.sfbrush"));
+ CHECK(!isSafeGalleryPath("brushes\\x.sfbrush"));
+ CHECK(!isSafeGalleryPath("https://evil.example/x.sfbrush"));
+ CHECK(!isSafeGalleryPath("brushes//x.sfbrush"));
+ CHECK(!isSafeGalleryPath("C:/x.sfbrush"));
+ CHECK(isSha256Hex(std::string(64, 'a')) && !isSha256Hex(std::string(63, 'a')) && !isSha256Hex(std::string(64, 'g')));
+}
+
+TEST(gallery_locations_resolve) {
+ CHECK(galleryIndexLocation("") == kDefaultBrushGalleryUrl);
+ CHECK(galleryIndexLocation(" https://example.com/g/index.json ") == "https://example.com/g/index.json");
+ CHECK(galleryIndexLocation("https://example.com/g/") == "https://example.com/g/index.json");
+ CHECK(galleryIndexLocation("/srv/brushes") == "/srv/brushes/index.json");
+ CHECK(galleryIndexLocation("C:\\Studio\\Brushes") == "C:\\Studio\\Brushes\\index.json");
+ CHECK(resolveGalleryPath("https://example.com/g/index.json", "previews/a.png") == "https://example.com/g/previews/a.png");
+ CHECK(resolveGalleryPath("/srv/brushes/index.json", "brushes/a.sfbrush") == "/srv/brushes/brushes/a.sfbrush");
+ CHECK(resolveGalleryPath("file:///srv/g/index.json", "brushes/a.sfbrush") == "file:///srv/g/brushes/a.sfbrush");
+ CHECK(galleryLocalPath("https://example.com/index.json").empty());
+ CHECK(galleryLocalPath("HTTP://example.com/index.json").empty());
+ CHECK(galleryLocalPath("/srv/brushes/index.json") == "/srv/brushes/index.json");
+#if !defined(_WIN32)
+ CHECK(galleryLocalPath("file:///srv/my%20brushes/index.json") == "/srv/my brushes/index.json");
+#endif
+}
+
+TEST(gallery_hash_check) {
+ const std::string data = "{\"name\": \"X\"}";
+ CHECK(galleryHashMatches(data, sha256Hex(data)));
+ std::string upper = sha256Hex(data);
+ for (char& c : upper) c = char(std::toupper(static_cast<unsigned char>(c)));
+ CHECK(galleryHashMatches(data, upper));
+ CHECK(!galleryHashMatches(data + " ", sha256Hex(data)));
+ CHECK(!galleryHashMatches(data, "nothex"));
+}
+
+TEST(gallery_search_and_tags) {
+ GalleryIndex index;
+ std::string error;
+ CHECK(parseGalleryIndex(kIndex, index, error));
+ const GalleryBrush& snake = index.brushes[2];
+ CHECK(galleryBrushMatches(snake, "", ""));
+ CHECK(galleryBrushMatches(snake, "SCALES", ""));
+ CHECK(galleryBrushMatches(snake, "small creature", "")); // every word, anywhere
+ CHECK(!galleryBrushMatches(snake, "small mud", ""));
+ CHECK(galleryBrushMatches(snake, "", "Creature"));
+ CHECK(!galleryBrushMatches(snake, "", "cracks"));
+ CHECK(galleryBrushMatches(snake, "ann", "")); // author
+ const auto tags = galleryTags(index);
+ CHECK(tags.size() == 4);
+}
+
+TEST(gallery_install_from_local_folder) {
+ namespace fs = std::filesystem;
+ const fs::path dir = fs::path(test::tempPath("sf_gallery_test"));
+ fs::remove_all(dir);
+ fs::create_directories(dir / "brushes");
+ ScopedDataDir dataDir((dir / "appdata").string());
+ BrushRecipe r;
+ r.name = "Test Gallery Brush";
+ r.depth = -0.3f;
+ std::string err;
+ CHECK(r.save((dir / "brushes" / "test-gallery-brush.sfbrush").string(), err));
+ std::string brushText;
+ {
+ std::ifstream f(dir / "brushes" / "test-gallery-brush.sfbrush", std::ios::binary);
+ brushText.assign(std::istreambuf_iterator<char>(f), std::istreambuf_iterator<char>());
+ }
+ auto writeIndex = [&](const std::string& sha) {
+ writeText(dir / "index.json", std::string(R"({"format": "sculptforge-brush-gallery", "version": 1, "brushes": [
+ {"name": "Test Gallery Brush", "tags": ["test"], "file": "brushes/test-gallery-brush.sfbrush",
+ "sha256": ")") + sha + "\"}]}");
+ };
+ writeIndex(sha256Hex(brushText));
+
+ CommandRegistry reg;
+ ai::registerBrushGalleryCommands(reg);
+ Document doc;
+ const std::string gallery = dir.string();
+ CommandResult res = reg.execute(doc, "brush_gallery_search", {{"tag", std::string("test")}, {"gallery", gallery}});
+ CHECK(res.ok && res.message.find("Test Gallery Brush") != std::string::npos);
+ res = reg.execute(doc, "brush_gallery_install", {{"name", std::string("test gallery brush")}, {"gallery", gallery}});
+ CHECK(res.ok);
+ CHECK(doc.activeBrush >= 0 && doc.brushes[doc.activeBrush].name == "Test Gallery Brush");
+ CHECK(std::abs(doc.brushes[doc.activeBrush].depth + 0.3f) < 1e-4f);
+
+ // A tampered file (hash no longer matches) is refused.
+ writeIndex(std::string(64, '0'));
+ const size_t before = doc.brushes.size();
+ res = reg.execute(doc, "brush_gallery_install", {{"name", std::string("Test Gallery Brush")}, {"gallery", gallery}});
+ CHECK(!res.ok && res.message.find("checksum") != std::string::npos);
+ CHECK(doc.brushes.size() == before);
+ res = reg.execute(doc, "brush_gallery_install", {{"name", std::string("Missing")}, {"gallery", gallery}});
+ CHECK(!res.ok);
+ fs::remove_all(dir);
+}
+
+TEST(gallery_index_cached_for_offline_use) {
+ namespace fs = std::filesystem;
+ const fs::path dir = fs::path(test::tempPath("sf_gallery_cache_test"));
+ fs::remove_all(dir);
+ ScopedDataDir dataDir((dir / "appdata").string());
+ const std::string location = galleryIndexLocation((dir / "gallery").string());
+ writeText(dir / "gallery" / "index.json", kIndex);
+ ai::GalleryFetch r = ai::fetchGalleryIndex(location);
+ CHECK(r.ok && !r.fromCache);
+ fs::remove_all(dir / "gallery"); // the gallery goes away: the last good copy is used
+ r = ai::fetchGalleryIndex(location);
+ CHECK(r.ok && r.fromCache && !r.error.empty());
+ GalleryIndex index;
+ std::string error;
+ CHECK(parseGalleryIndex(r.data, index, error) && index.brushes.size() == 3);
+ // A gallery that answers with something broken is an error, not a silent fallback.
+ writeText(dir / "gallery" / "index.json", "{\"oops\": 1}");
+ r = ai::fetchGalleryIndex(location);
+ CHECK(!r.ok);
+ // Never-seen galleries have no cache.
+ CHECK(!ai::fetchGalleryIndex(galleryIndexLocation((dir / "nowhere").string())).ok);
+ fs::remove_all(dir);
+}
+
+TEST(stroke_path_sampling) {
+ // Straight segments at even spacing, ending within one step of the last point.
+ auto s = samplePath({{0, 0, 0}, {1, 0, 0}}, false, 0.25f);
+ CHECK(s.size() == 5);
+ CHECK(glm::distance(s.back(), glm::vec3(1, 0, 0)) < 1e-4f);
+ // Curves pass through every control point's neighbourhood and stay evenly spaced.
+ s = samplePath({{0, 0, 0}, {1, 1, 0}, {2, 0, 0}}, true, 0.05f);
+ CHECK(s.size() > 40);
+ bool even = true;
+ for (size_t i = 1; i < s.size(); ++i) even = even && std::abs(glm::distance(s[i], s[i - 1]) - 0.05f) < 0.01f;
+ CHECK(even);
+ float closest = 1e9f;
+ for (const auto& p : s) closest = std::min(closest, glm::distance(p, glm::vec3(1, 1, 0)));
+ CHECK(closest < 0.05f);
+ CHECK(samplePath({{1, 2, 3}}, true, 0.1f).size() == 1);
+
+ std::vector<glm::vec3> pts;
+ std::string err;
+ CHECK(parsePathPoints("0,0,0 1,2.5,-3|4,5,6", pts, err) && pts.size() == 3 && pts[1].z == -3.0f);
+ CHECK(!parsePathPoints("0,0", pts, err));
+ CHECK(!parsePathPoints("0,0,0,", pts, err));
+ CHECK(!parsePathPoints(" ", pts, err));
+}
+
+TEST(stroke_command_sculpts_along_path) {
+ CommandRegistry reg;
+ Document doc = test::makeDoc(makePlane(80, 2.0f)); // XZ plane, normal +Y
+ const Args args = {{"points", std::string("-0.6,0,0 0,0,0.2 0.6,0,0")},
+ {"view", std::string("0,-1,0")},
+ {"brush", std::string("Dragon Scales")},
+ {"radius", 0.1}};
+ CommandResult r = reg.execute(doc, "stroke", args);
+ CHECK(r.ok);
+ CHECK(doc.undo.canUndo());
+ float maxY = 0.0f, farY = 0.0f;
+ for (const auto& p : doc.mesh.positions) {
+ if (std::abs(p.z - 0.1f) < 0.15f && std::abs(p.x) < 0.5f) maxY = std::max(maxY, std::abs(p.y));
+ if (p.z < -0.5f) farY = std::max(farY, std::abs(p.y));
+ }
+ CHECK(maxY > 1e-3f); // the path moved the surface
+ CHECK(farY == 0.0f); // and nothing far from it
+ r = reg.execute(doc, "undo");
+ CHECK(r.ok);
+ bool flat = true;
+ for (const auto& p : doc.mesh.positions) flat = flat && p.y == 0.0f;
+ CHECK(flat);
+
+ // Built-in brushes by name (any case), inverted; errors are reported.
+ CHECK(reg.execute(doc, "stroke", {{"points", std::string("0,0,0 0.3,0,0")}, {"view", std::string("0,-1,0")},
+ {"brush", std::string("clay")}, {"invert", true}})
+ .ok);
+ CHECK(!reg.execute(doc, "stroke", {{"points", std::string("0,0,0")}, {"brush", std::string("Nope")}}).ok);
+ CHECK(!reg.execute(doc, "stroke", {{"points", std::string("5,0,5 6,0,6")}, {"view", std::string("0,-1,0")}}).ok);
+ CHECK(!reg.execute(doc, "stroke", {{"points", std::string("0,0,0")}, {"view", std::string("0,0,0")}}).ok);
+}
diff --git a/tests/ui/brush_gallery.sfui b/tests/ui/brush_gallery.sfui
new file mode 100644
index 00000000..a66ae15e
--- /dev/null
+++ b/tests/ui/brush_gallery.sfui
@@ -0,0 +1,47 @@
+# Community brushes: browse a gallery (the seed content in tools/brush-gallery/repo, read from disk the way a
+# studio mirror would be), search it, filter by tag, install a brush and see it in the library; then a
+# gallery that can't be reached shows a clear error instead of an empty window.
+env SCULPTFORGE_BRUSH_GALLERY $SCRIPT_DIR/../../tools/brush-gallery/repo
+expect_value brushes == 7
+click View
+click "Community brushes"
+wait_idle 30
+expect_text 21 brushes
+expect "Community brushes/Share yours"
+wait 1
+wait_idle 30
+wait 0.5
+shot gallery
+
+type "##gallerysearch" scales
+expect_text 2 brushes of 21
+expect "Installed##Dragon Scales"
+expect "Install##Snake Scales"
+wait_idle 30
+wait 0.5
+shot search
+
+click "Install##Snake Scales"
+wait_idle 30
+expect "Installed##Snake Scales"
+expect_value brushes == 8
+expect_status Snake Scales
+shot installed
+
+click "Community brushes/x##clearsearch"
+expect_text 21 brushes
+click "##gallerytag"
+click "hard-surface"
+expect_text 5 brushes of 21
+expect "Install##Panel Line"
+wait_idle 30
+wait 0.5
+shot tag-filter
+
+env SCULPTFORGE_BRUSH_GALLERY $SCRIPT_DIR/no-such-gallery
+click "Community brushes/Refresh"
+wait_idle 30
+expect_text Can't reach the brush gallery
+expect "Try again"
+expect_no_text 21 brushes
+shot unreachable
diff --git a/tools/brush-gallery/build_index.py b/tools/brush-gallery/build_index.py
new file mode 100644
index 00000000..e922c257
--- /dev/null
+++ b/tools/brush-gallery/build_index.py
@@ -0,0 +1,248 @@
+#!/usr/bin/env python3
+# SculptForge - open source digital sculpting
+# SPDX-License-Identifier: GPL-3.0-or-later
+"""Validate the community brush gallery and write its index.json.
+
+ python3 build_index.py repo # validate every brush, write repo/index.json
+ python3 build_index.py repo --validate-only # pull requests: validate, write nothing
+ python3 build_index.py repo --check # fail if index.json is out of date
+
+Every brushes/<name>.sfbrush must be plain brush data: a JSON object with only
+recipe parameters and gallery metadata, values in range, named after its file,
+with a previews/<name>.png next to it. Each brush is round-tripped through
+`sculptforge-cli` (brush_load + brush_save), so the app itself decides whether
+it is valid; anything it would clamp or drop is reported. The index lists
+{name, description, author, tags, file, preview, sha256, added} per brush
+(docs/brushes.md in the SculptForge repo describes the format). Standard
+library only.
+"""
+
+import argparse
+import datetime
+import hashlib
+import json
+import os
+import re
+import shutil
+import struct
+import subprocess
+import sys
+import tempfile
+from pathlib import Path
+
+INDEX_FORMAT = "sculptforge-brush-gallery"
+INDEX_VERSION = 1
+MAX_BRUSH_BYTES = 16 * 1024
+MAX_PREVIEW_BYTES = 512 * 1024
+PREVIEW_SIZE = (512, 384)
+META_KEYS = {"name", "description", "author", "tags", "format", "version"}
+TAG_RE = re.compile(r"^[a-z0-9][a-z0-9-]{0,23}$")
+
+
+def slug(name):
+ """File name for a brush name: "Dragon Scales" -> "dragon-scales"."""
+ return re.sub(r"[^a-z0-9]+", "-", name.lower()).strip("-")
+
+
+def find_cli(explicit):
+ candidates = [explicit, os.environ.get("SCULPTFORGE_CLI")]
+ root = Path(__file__).resolve().parents[2]
+ for build in ("build", "build-release", "out/build"):
+ candidates += [root / build / "sculptforge-cli", root / build / "sculptforge-cli.exe",
+ root / build / "Release" / "sculptforge-cli.exe"]
+ candidates.append(shutil.which("sculptforge-cli"))
+ for c in candidates:
+ if c and Path(c).is_file():
+ return str(c)
+ sys.exit("error: cannot find sculptforge-cli; pass --cli PATH or set SCULPTFORGE_CLI")
+
+
+def recipe_params(cli):
+ """Recipe parameter names and types, from the app's own brush_create tool schema."""
+ out = subprocess.run([cli, "--schema"], capture_output=True, text=True, check=True).stdout
+ for tool in json.loads(out):
+ if tool["name"] == "brush_create":
+ props = tool["input_schema"]["properties"]
+ return {k: v["type"] for k, v in props.items() if k not in ("name", "description")}
+ sys.exit("error: sculptforge-cli has no brush_create command")
+
+
+def quote(text):
+ return '"' + str(text).replace("\\", "\\\\").replace('"', '\\"') + '"'
+
+
+def round_trip(cli, path, tmp):
+ """The brush as SculptForge loads and saves it, or an error message."""
+ saved = Path(tmp) / "roundtrip.sfbrush"
+ script = f"brush_load path={quote(path.resolve())}; brush_save path={quote(saved)}"
+ r = subprocess.run([cli, "-q", "-c", script], capture_output=True, text=True)
+ if r.returncode != 0:
+ return None, (r.stderr or r.stdout).strip()
+ return json.loads(saved.read_text(encoding="utf-8")), None
+
+
+def png_size(path):
+ data = path.read_bytes()[:24]
+ if len(data) < 24 or data[:8] != b"\x89PNG\r\n\x1a\n" or data[12:16] != b"IHDR":
+ return None
+ return struct.unpack(">II", data[16:24])
+
+
+def same(a, b):
+ if isinstance(a, bool) or isinstance(b, bool):
+ return a is b
+ if isinstance(a, (int, float)) and isinstance(b, (int, float)):
+ return abs(a - b) <= 0.0005 + 1e-9
+ return a == b
+
+
+def date_added(repo, rel, previous):
+ if rel in previous:
+ return previous[rel]
+ try:
+ out = subprocess.run(["git", "-C", str(repo), "log", "--diff-filter=A", "--follow", "--format=%as", "--", rel],
+ capture_output=True, text=True, timeout=30).stdout.split()
+ if out:
+ return out[-1]
+ except (OSError, subprocess.SubprocessError):
+ pass
+ return datetime.datetime.now(datetime.timezone.utc).date().isoformat()
+
+
+def validate(repo, path, params, cli, tmp):
+ """Returns (entry, errors) for one brush file."""
+ errors = []
+ rel = path.relative_to(repo).as_posix()
+ raw = path.read_bytes()
+ if len(raw) > MAX_BRUSH_BYTES:
+ return None, [f"{rel}: {len(raw)} bytes, the limit is {MAX_BRUSH_BYTES}"]
+ try:
+ brush = json.loads(raw.decode("utf-8"))
+ except (UnicodeDecodeError, ValueError) as e:
+ return None, [f"{rel}: not valid UTF-8 JSON ({e})"]
+ if not isinstance(brush, dict):
+ return None, [f"{rel}: must be a JSON object"]
+
+ unknown = sorted(set(brush) - set(params) - META_KEYS)
+ if unknown:
+ errors.append(f"{rel}: unknown keys {', '.join(unknown)} (brushes are recipe data only)")
+ if brush.get("format") != "sfbrush" or brush.get("version") != 1:
+ errors.append(f'{rel}: needs "format": "sfbrush" and "version": 1')
+ name, description, author = brush.get("name"), brush.get("description"), brush.get("author")
+ for key, value, limit in (("name", name, 64), ("description", description, 500), ("author", author, 64)):
+ if not isinstance(value, str) or not value.strip():
+ errors.append(f"{rel}: '{key}' must be a non-empty string")
+ elif len(value) > limit:
+ errors.append(f"{rel}: '{key}' is longer than {limit} characters")
+ tags = brush.get("tags")
+ if not isinstance(tags, list) or not 1 <= len(tags) <= 6 or not all(isinstance(t, str) and TAG_RE.match(t) for t in tags):
+ errors.append(f"{rel}: 'tags' must be 1-6 lowercase words (a-z, 0-9, '-'), e.g. [\"skin\", \"texture\"]")
+ if isinstance(name, str) and name.strip() and path.name != slug(name) + ".sfbrush":
+ errors.append(f"{rel}: should be named {slug(name)}.sfbrush after the brush name")
+
+ preview = Path("previews") / (path.stem + ".png")
+ preview_path = repo / preview
+ if not preview_path.is_file():
+ errors.append(f"{rel}: missing preview {preview.as_posix()} (render it with tools/brush-gallery/render_previews.py)")
+ else:
+ size = png_size(preview_path)
+ if size != PREVIEW_SIZE:
+ errors.append(f"{preview.as_posix()}: must be a {PREVIEW_SIZE[0]}x{PREVIEW_SIZE[1]} PNG")
+ if preview_path.stat().st_size > MAX_PREVIEW_BYTES:
+ errors.append(f"{preview.as_posix()}: larger than {MAX_PREVIEW_BYTES // 1024} KB")
+
+ # Let SculptForge itself judge the recipe: anything it clamps or ignores is an error.
+ for key, kind in params.items():
+ if key not in brush:
+ continue
+ v = brush[key]
+ ok = {"number": isinstance(v, (int, float)) and not isinstance(v, bool), "boolean": isinstance(v, bool),
+ "string": isinstance(v, str)}.get(kind, True)
+ if not ok:
+ errors.append(f"{rel}: '{key}' must be a {kind}")
+ if not errors:
+ saved, err = round_trip(cli, path, tmp)
+ if err:
+ errors.append(f"{rel}: SculptForge cannot load it: {err}")
+ else:
+ for key in list(params) + ["name", "description"]:
+ if key in brush and not same(brush[key], saved.get(key)):
+ errors.append(f"{rel}: '{key}' = {json.dumps(brush[key])} is not valid "
+ f"(SculptForge reads it as {json.dumps(saved.get(key))})")
+ if errors:
+ return None, errors
+ return {
+ "name": name,
+ "description": description,
+ "author": author,
+ "tags": tags,
+ "file": rel,
+ "preview": preview.as_posix(),
+ "sha256": hashlib.sha256(raw).hexdigest(),
+ }, []
+
+
+def main():
+ p = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter)
+ p.add_argument("repo", nargs="?", default=str(Path(__file__).resolve().parent / "repo"),
+ help="gallery folder (with brushes/ and previews/)")
+ p.add_argument("--cli", help="path to sculptforge-cli")
+ mode = p.add_mutually_exclusive_group()
+ mode.add_argument("--validate-only", action="store_true", help="validate, do not write index.json")
+ mode.add_argument("--check", action="store_true", help="fail if index.json is missing or out of date")
+ args = p.parse_args()
+
+ repo = Path(args.repo).resolve()
+ cli = find_cli(args.cli)
+ params = recipe_params(cli)
+ index_path = repo / "index.json"
+ previous = {}
+ if index_path.is_file():
+ try:
+ previous = {b["file"]: b["added"] for b in json.loads(index_path.read_text(encoding="utf-8"))["brushes"]}
+ except (ValueError, KeyError, TypeError):
+ pass
+
+ brushes = sorted((repo / "brushes").glob("*.sfbrush"))
+ if not brushes:
+ sys.exit(f"error: no brushes in {repo / 'brushes'}")
+ entries, errors = [], []
+ with tempfile.TemporaryDirectory() as tmp:
+ for path in brushes:
+ entry, errs = validate(repo, path, params, cli, tmp)
+ errors += errs
+ if entry:
+ entry["added"] = date_added(repo, entry["file"], previous)
+ entries.append(entry)
+ names = {}
+ for e in entries:
+ other = names.setdefault(e["name"].lower(), e["file"])
+ if other != e["file"]:
+ errors.append(f"{e['file']}: the name '{e['name']}' is already used by {other}")
+ for png in sorted((repo / "previews").glob("*.png")):
+ if not (repo / "brushes" / (png.stem + ".sfbrush")).is_file():
+ errors.append(f"previews/{png.name}: no brush with this name")
+ if errors:
+ print("\n".join("error: " + e for e in errors), file=sys.stderr)
+ print(f"{len(errors)} problem(s) in {len(brushes)} brushes", file=sys.stderr)
+ return 1
+
+ entries.sort(key=lambda e: e["name"].lower())
+ text = json.dumps({"format": INDEX_FORMAT, "version": INDEX_VERSION, "brushes": entries}, indent=2,
+ ensure_ascii=False) + "\n"
+ if args.validate_only:
+ print(f"{len(entries)} brushes OK")
+ elif args.check:
+ current = index_path.read_text(encoding="utf-8") if index_path.is_file() else ""
+ if current != text:
+ print("error: index.json is out of date; run tools/brush-gallery/build_index.py", file=sys.stderr)
+ return 1
+ print(f"{len(entries)} brushes OK, index.json up to date")
+ else:
+ index_path.write_text(text, encoding="utf-8")
+ print(f"{len(entries)} brushes OK, wrote {index_path}")
+ return 0
+
+
+if __name__ == "__main__":
+ sys.exit(main())
diff --git a/tools/brush-gallery/render_previews.py b/tools/brush-gallery/render_previews.py
new file mode 100644
index 00000000..9a6a2921
--- /dev/null
+++ b/tools/brush-gallery/render_previews.py
@@ -0,0 +1,158 @@
+#!/usr/bin/env python3
+# SculptForge - open source digital sculpting
+# SPDX-License-Identifier: GPL-3.0-or-later
+"""Render a preview image for every .sfbrush brush in a folder.
+
+Each preview is the same shot, so a gallery reads as one set: a sculpting
+sphere with three S-curve strokes of the brush, rendered headless by
+`sculptforge --render` with the Clay MatCap from the front.
+
+ python3 render_previews.py repo/brushes --out repo/previews
+ python3 render_previews.py my_brush.sfbrush --out . # one brush
+ python3 render_previews.py repo/brushes --out repo/previews --changed # only new/edited brushes
+
+Needs the `sculptforge` app (an OpenGL 3.3 context; on a headless Linux box run
+it under `xvfb-run`). Standard library only; if Pillow is installed the PNGs
+are also shrunk to a 256-colour palette (about a third of the size, no visible
+difference on these renders).
+"""
+
+import argparse
+import json
+import os
+import shutil
+import subprocess
+import sys
+from pathlib import Path
+
+# Three S-curves across the front of the unit sphere (x, y; the stroke
+# projects along -Z onto the surface). Mirrored top and bottom, so the
+# preview is balanced whatever the brush does.
+CURVES = [
+ [(-0.75, 0.42), (-0.25, 0.58), (0.25, 0.30), (0.75, 0.45)],
+ [(-0.90, 0.00), (-0.30, 0.15), (0.30, -0.15), (0.90, 0.00)],
+ [(-0.75, -0.45), (-0.25, -0.30), (0.25, -0.58), (0.75, -0.42)],
+]
+PLANE_CURVES = [ # the same layout on a plane seen from above (x, z)
+ [(-0.80, -0.50), (-0.30, -0.62), (0.30, -0.36), (0.80, -0.48)],
+ [(-0.85, 0.00), (-0.30, -0.12), (0.30, 0.14), (0.85, 0.00)],
+ [(-0.80, 0.48), (-0.30, 0.36), (0.30, 0.62), (0.80, 0.50)],
+]
+
+
+def find_app(explicit):
+ """The sculptforge executable: --app, $SCULPTFORGE, a build folder next to this repo, or PATH."""
+ candidates = [explicit, os.environ.get("SCULPTFORGE")]
+ root = Path(__file__).resolve().parents[2]
+ for build in ("build", "build-release", "out/build"):
+ candidates += [root / build / "sculptforge", root / build / "sculptforge.exe",
+ root / build / "Release" / "sculptforge.exe"]
+ candidates.append(shutil.which("sculptforge"))
+ for c in candidates:
+ if c and Path(c).is_file():
+ return str(c)
+ sys.exit("error: cannot find the sculptforge app; pass --app PATH or set SCULPTFORGE")
+
+
+def quote(text):
+ """A double-quoted sculptforge script value."""
+ return '"' + str(text).replace("\\", "\\\\").replace('"', '\\"') + '"'
+
+
+def cavity_mask(brush_path):
+ try:
+ value = json.loads(Path(brush_path).read_text(encoding="utf-8")).get("cavityMask", 0)
+ return float(value) if isinstance(value, (int, float)) else 0.0
+ except (OSError, ValueError):
+ return 0.0
+
+
+def preview_script(brush_path, subject, radius, material):
+ if subject == "plane":
+ lines = ["new_plane resolution=900"]
+ curves, view = PLANE_CURVES, "0,-1,0"
+ points = lambda c: " ".join(f"{x},0,{z}" for x, z in c)
+ else:
+ lines = ["new_sphere subdivisions=8"]
+ curves, view = CURVES, "0,0,-1"
+ points = lambda c: " ".join(f"{x},{y},0" for x, y in c)
+ # Brushes masked to ridges or cavities do nothing on a smooth surface: give
+ # them raised forms (or grooves) along the same curves to work on first.
+ mask = cavity_mask(brush_path)
+ if abs(mask) >= 0.25:
+ invert = "true" if mask > 0 else "false"
+ for c in curves:
+ lines.append(f"stroke brush=Standard strength=1 invert={invert} points={quote(points(c))} view={view} "
+ f"radius={radius * 1.2:g}")
+ lines.append(f"brush_load path={quote(brush_path)}")
+ for i, c in enumerate(curves):
+ lines.append(f"stroke points={quote(points(c))} view={view} radius={radius} seed={i + 1}")
+ lines.append(f"set_material name={quote(material)}")
+ return "; ".join(lines)
+
+
+def render(app, brush, out, args):
+ view = "0,-58" if args.subject == "plane" else "0,0"
+ zoom = "2.3" if args.subject == "plane" else "1.75"
+ out.unlink(missing_ok=True) # a failed render must not leave the old preview behind
+ cmd = [app, "--render", str(out), "--size", args.size, "--view", view, "--zoom", zoom,
+ "--run", preview_script(brush.resolve(), args.subject, args.radius, args.material)]
+ result = subprocess.run(cmd, capture_output=True, text=True, timeout=300)
+ log = result.stdout + result.stderr
+ if result.returncode != 0 or not out.is_file():
+ return log.strip() or f"exit code {result.returncode}"
+ return None
+
+
+def shrink_png(path):
+ """Palette-quantize with Pillow when it is available (optional)."""
+ try:
+ from PIL import Image
+ except ImportError:
+ return
+ with Image.open(path) as im:
+ small = im.convert("RGB").quantize(256, method=Image.Quantize.MEDIANCUT, dither=Image.Dither.FLOYDSTEINBERG)
+ small.save(path, optimize=True)
+
+
+def main():
+ p = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter)
+ p.add_argument("inputs", nargs="+", help=".sfbrush files or folders of them")
+ p.add_argument("--out", required=True, help="folder for the PNG previews (<brush file name>.png)")
+ p.add_argument("--app", help="path to the sculptforge executable")
+ p.add_argument("--size", default="512x384", help="image size WxH (default 512x384)")
+ p.add_argument("--subject", choices=["sphere", "plane"], default="sphere", help="what to sculpt on")
+ p.add_argument("--material", default="Clay", help="MatCap (Clay, Red Wax, Skin, White, Bronze, Chrome)")
+ p.add_argument("--radius", type=float, default=0.12, help="brush radius in world units (sphere radius 1)")
+ p.add_argument("--no-shrink", action="store_true", help="keep the full-colour PNGs even if Pillow is installed")
+ p.add_argument("--changed", action="store_true", help="skip brushes whose preview is newer than the brush")
+ args = p.parse_args()
+
+ brushes = []
+ for i in args.inputs:
+ path = Path(i)
+ brushes += sorted(path.glob("*.sfbrush")) if path.is_dir() else [path]
+ if not brushes:
+ sys.exit("error: no .sfbrush files found")
+ out_dir = Path(args.out)
+ out_dir.mkdir(parents=True, exist_ok=True)
+ app = find_app(args.app)
+
+ failed = 0
+ for brush in brushes:
+ out = out_dir / (brush.stem + ".png")
+ if args.changed and out.is_file() and out.stat().st_mtime >= brush.stat().st_mtime:
+ continue
+ error = render(app, brush, out, args)
+ if error:
+ failed += 1
+ print(f"FAILED {brush}: {error}", file=sys.stderr)
+ else:
+ if not args.no_shrink:
+ shrink_png(out)
+ print(f"rendered {out}")
+ return 1 if failed else 0
+
+
+if __name__ == "__main__":
+ sys.exit(main())
diff --git a/tools/brush-gallery/repo/.github/PULL_REQUEST_TEMPLATE.md b/tools/brush-gallery/repo/.github/PULL_REQUEST_TEMPLATE.md
new file mode 100644
index 00000000..cedef573
--- /dev/null
+++ b/tools/brush-gallery/repo/.github/PULL_REQUEST_TEMPLATE.md
@@ -0,0 +1,7 @@
+**Brush name:**
+
+**What it is for** (one sentence):
+
+- [ ] I made this brush myself and dedicate it to the public domain under CC0 1.0.
+- [ ] `brushes/<name>.sfbrush` has `author`, `tags` and a `description`; the file is named after the brush.
+- [ ] `previews/<name>.png` was rendered with `render_previews.py` (or: please render it for me).
diff --git a/tools/brush-gallery/repo/.github/workflows/publish.yml b/tools/brush-gallery/repo/.github/workflows/publish.yml
new file mode 100644
index 00000000..895a29da
--- /dev/null
+++ b/tools/brush-gallery/repo/.github/workflows/publish.yml
@@ -0,0 +1,60 @@
+# Rebuilds index.json (what the SculptForge app reads) after every change on
+# main, rendering any missing previews first, and commits it.
+name: Publish index
+
+on:
+ push:
+ branches: [main]
+ paths: ['brushes/**', 'previews/**', '.github/workflows/publish.yml']
+ workflow_dispatch:
+
+permissions:
+ contents: write
+
+concurrency:
+ group: publish
+ cancel-in-progress: false
+
+jobs:
+ publish:
+ runs-on: ubuntu-24.04
+ steps:
+ - uses: actions/checkout@v4
+ with:
+ path: gallery
+ fetch-depth: 0 # build_index.py dates new brushes from their first commit
+ - uses: actions/checkout@v4
+ with:
+ repository: islandmed/SculptForge
+ path: sculptforge
+ - name: Build SculptForge
+ working-directory: sculptforge
+ run: |
+ sudo ./packaging/linux/install-build-deps.sh
+ sudo apt-get install -y xvfb libgl1-mesa-dri
+ cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DSCULPTFORGE_USE_SYSTEM_SDL=OFF \
+ -DSCULPTFORGE_BUILD_TESTS=OFF -DSCULPTFORGE_BUILD_PYTHON=OFF
+ cmake --build build --target sculptforge sculptforge-cli --parallel
+ - name: Render missing previews
+ run: |
+ missing=()
+ for b in gallery/brushes/*.sfbrush; do
+ [ -f "gallery/previews/$(basename "$b" .sfbrush).png" ] || missing+=("$b")
+ done
+ if [ ${#missing[@]} -gt 0 ]; then
+ pip install pillow
+ xvfb-run -a -s "-screen 0 1280x1024x24" env LIBGL_ALWAYS_SOFTWARE=1 \
+ python3 sculptforge/tools/brush-gallery/render_previews.py "${missing[@]}" \
+ --out gallery/previews --app sculptforge/build/sculptforge
+ fi
+ - name: Build index.json
+ run: python3 sculptforge/tools/brush-gallery/build_index.py gallery --cli sculptforge/build/sculptforge-cli
+ - name: Commit
+ working-directory: gallery
+ run: |
+ git add index.json previews
+ if git diff --cached --quiet; then echo "index.json is up to date"; exit 0; fi
+ git config user.name "github-actions[bot]"
+ git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
+ git commit -m "Update index.json"
+ git push
diff --git a/tools/brush-gallery/repo/.github/workflows/validate.yml b/tools/brush-gallery/repo/.github/workflows/validate.yml
new file mode 100644
index 00000000..e6a60414
--- /dev/null
+++ b/tools/brush-gallery/repo/.github/workflows/validate.yml
@@ -0,0 +1,48 @@
+# Checks every pull request: only brushes/ and previews/ may change, and every
+# brush must load in SculptForge exactly as written (build_index.py round-trips
+# it through sculptforge-cli built from the latest SculptForge source).
+name: Validate brushes
+
+on:
+ pull_request:
+ workflow_dispatch:
+
+permissions:
+ contents: read
+
+concurrency:
+ group: validate-${{ github.ref }}
+ cancel-in-progress: true
+
+jobs:
+ validate:
+ runs-on: ubuntu-24.04
+ steps:
+ - uses: actions/checkout@v4
+ with:
+ path: gallery
+ fetch-depth: 0
+ - name: Only brush files changed
+ if: github.event_name == 'pull_request'
+ working-directory: gallery
+ run: |
+ bad=$(git diff --name-only "origin/${{ github.base_ref }}...HEAD" \
+ | grep -Ev '^(brushes/[a-z0-9-]+\.sfbrush|previews/[a-z0-9-]+\.png)$' || true)
+ if [ -n "$bad" ]; then
+ echo "::error::Pull requests may only add or change brushes/<name>.sfbrush and previews/<name>.png. Also changed:"
+ echo "$bad"
+ exit 1
+ fi
+ - uses: actions/checkout@v4
+ with:
+ repository: islandmed/SculptForge
+ path: sculptforge
+ - name: Build sculptforge-cli
+ working-directory: sculptforge
+ run: |
+ sudo ./packaging/linux/install-build-deps.sh
+ cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DSCULPTFORGE_BUILD_APP=OFF \
+ -DSCULPTFORGE_BUILD_TESTS=OFF -DSCULPTFORGE_BUILD_PYTHON=OFF
+ cmake --build build --target sculptforge-cli --parallel
+ - name: Validate
+ run: python3 sculptforge/tools/brush-gallery/build_index.py gallery --validate-only --cli sculptforge/build/sculptforge-cli
diff --git a/tools/brush-gallery/repo/LICENSE b/tools/brush-gallery/repo/LICENSE
new file mode 100644
index 00000000..2a58f328
--- /dev/null
+++ b/tools/brush-gallery/repo/LICENSE
@@ -0,0 +1,11 @@
+SculptForge community brushes
+
+To the extent possible under law, the contributors to this repository have waived all copyright and
+related or neighboring rights to the brushes (brushes/*.sfbrush) and their previews (previews/*.png),
+dedicating them to the public domain under the Creative Commons CC0 1.0 Universal Public Domain
+Dedication:
+
+ https://creativecommons.org/publicdomain/zero/1.0/
+ Legal code: https://creativecommons.org/publicdomain/zero/1.0/legalcode
+
+You can copy, modify, distribute and use them, even for commercial purposes, without asking permission.
diff --git a/tools/brush-gallery/repo/README.md b/tools/brush-gallery/repo/README.md
new file mode 100644
index 00000000..629ef22a
--- /dev/null
+++ b/tools/brush-gallery/repo/README.md
@@ -0,0 +1,84 @@
+# SculptForge community brushes
+
+Free sculpting brushes for [SculptForge](https://github.com/islandmed/SculptForge), the free, open-source
+alternative to ZBrush, shared by the people who made them. Every brush here is public domain
+([CC0](LICENSE)): use it in personal and commercial work, change it, bundle it with your own tools.
+
+**Install brushes from inside SculptForge:** *View > Community brushes*, pick one, click **Install**. You can
+also download any `.sfbrush` file from [`brushes/`](brushes) and drag it onto the SculptForge window.
+Browse the gallery with previews at <https://islandmed.github.io/SculptForge/brushes.html>.
+
+## What a brush is
+
+A SculptForge brush is a small JSON *recipe* (`.sfbrush`): how the surface moves, the shape of the tip, a
+surface pattern, stroke spacing and masking. It is data only, never code, so installing a brush from a
+stranger is as safe as opening a text file. You design brushes in SculptForge's **Brush Lab**, by hand or by
+describing them to the AI brush creator ("dry cracked mud", "a palette knife that drags clay").
+
+```json
+{
+ "name": "Snake Scales",
+ "description": "Tight rows of small, smooth scales for snakes, lizards and fish.",
+ "direction": "normal", "depth": 0.35, "pattern": "scales", "patternScale": 0.18, "patternAmount": 1,
+ "hardness": 0.55, "spacing": 0.2,
+ "author": "SculptForge",
+ "tags": ["creature", "scales", "texture"],
+ "format": "sfbrush", "version": 1
+}
+```
+
+Parameters you leave out take neutral defaults. The full list, with ranges, is in
+[SculptForge's brush guide](https://github.com/islandmed/SculptForge/blob/main/docs/brushes.md).
+
+## Share your brush
+
+1. **Save it.** In Brush Lab, select your brush and click *Save .sfbrush*.
+2. **Add the gallery fields.** Open the file in a text editor and add `"author"` (your name or handle) and
+ `"tags"` (1-6 lowercase words, e.g. `["skin", "creature", "texture"]`). Give it a one-sentence
+ `"description"` that says what it is for.
+3. **Name the file after the brush**, lowercase with dashes: *Cracked Earth* → `brushes/cracked-earth.sfbrush`.
+4. **Render the preview** with SculptForge (a sphere with three strokes, so every preview matches):
+
+ ```sh
+ git clone https://github.com/islandmed/SculptForge # once, for the scripts
+ python3 SculptForge/tools/brush-gallery/render_previews.py brushes/cracked-earth.sfbrush --out previews
+ ```
+
+ It needs the SculptForge app on your `PATH` (or `--app /path/to/sculptforge`). This writes
+ `previews/cracked-earth.png` (512 x 384).
+5. **Open a pull request** adding just those two files. A check runs SculptForge on your brush and tells you
+ if anything needs fixing. After it is merged, the gallery index updates itself and the brush shows up in
+ everyone's *Community brushes* window.
+
+Can't render the preview? Open the pull request anyway and say so; a maintainer will render it for you.
+
+## Rules
+
+- **Data only.** A brush is one `.sfbrush` file with recipe parameters and the gallery fields `name`,
+ `description`, `author`, `tags`, `format`, `version`. No other keys, no scripts, no links, no images
+ inside it. Values must be in range (the check tells you if SculptForge would clamp anything).
+- **One brush per file, one name per brush.** Names are unique in the gallery (2-4 words an artist would
+ recognise). The file name is the name in lowercase with dashes.
+- **Your own work, shared as CC0.** By opening a pull request you confirm you made the brush and dedicate it
+ to the public domain under [CC0 1.0](LICENSE). Don't submit brushes copied from paid packs.
+- **Useful and distinct.** Improvements to an existing brush are welcome as an edit to its file; near-copies
+ of a brush that is already here will be declined.
+- **Be kind.** Names, descriptions and tags follow SculptForge's
+ [code of conduct](https://github.com/islandmed/SculptForge/blob/main/CODE_OF_CONDUCT.md).
+
+Pull requests may only change files in `brushes/` and `previews/`; `index.json` is generated.
+
+## For maintainers
+
+`index.json` is what the app reads. It is rebuilt on every push to `main` by
+[`publish.yml`](.github/workflows/publish.yml) using `build_index.py` from the SculptForge repository, which
+round-trips every brush through `sculptforge-cli`, checks the preview and records its SHA-256 (the app
+refuses a download whose hash does not match). To rebuild by hand:
+
+```sh
+python3 SculptForge/tools/brush-gallery/build_index.py . # validate + write index.json
+python3 SculptForge/tools/brush-gallery/render_previews.py brushes --out previews --changed
+```
+
+The index format is documented in
+[docs/brushes.md](https://github.com/islandmed/SculptForge/blob/main/docs/brushes.md#community-gallery).
diff --git a/tools/brush-gallery/repo/brushes/chipped-stone.sfbrush b/tools/brush-gallery/repo/brushes/chipped-stone.sfbrush
new file mode 100644
index 00000000..538126cb
--- /dev/null
+++ b/tools/brush-gallery/repo/brushes/chipped-stone.sfbrush
@@ -0,0 +1,29 @@
+{
+ "name": "Chipped Stone",
+ "description": "Knocks rough, eroded chips into stone blocks, walls and cliffs.",
+ "direction": "normal",
+ "depth": -0.7,
+ "plane": "flatten",
+ "planeAmount": 0.6,
+ "pinch": 0,
+ "drag": 0,
+ "smooth": 0,
+ "hardness": 0.85,
+ "tipSharpness": 0,
+ "pattern": "noise",
+ "patternScale": 0.35,
+ "patternAmount": 0.9,
+ "spacing": 0.3,
+ "jitter": 0.3,
+ "pressureCurve": 1,
+ "frontFacesOnly": false,
+ "cavityMask": 0,
+ "author": "SculptForge",
+ "tags": [
+ "stone",
+ "environment",
+ "weathering"
+ ],
+ "format": "sfbrush",
+ "version": 1
+}
diff --git a/tools/brush-gallery/repo/brushes/clay-buildup.sfbrush b/tools/brush-gallery/repo/brushes/clay-buildup.sfbrush
new file mode 100644
index 00000000..6e50755d
--- /dev/null
+++ b/tools/brush-gallery/repo/brushes/clay-buildup.sfbrush
@@ -0,0 +1,29 @@
+{
+ "name": "Clay Buildup",
+ "description": "Builds up flat-topped strokes of clay for blocking in forms.",
+ "direction": "normal",
+ "depth": 0.3,
+ "plane": "clay",
+ "planeAmount": 0.7,
+ "pinch": 0,
+ "drag": 0,
+ "smooth": 0.1,
+ "hardness": 0.35,
+ "tipSharpness": 0,
+ "pattern": "none",
+ "patternScale": 0.3,
+ "patternAmount": 0,
+ "spacing": 0.15,
+ "jitter": 0,
+ "pressureCurve": 1,
+ "frontFacesOnly": false,
+ "cavityMask": 0,
+ "author": "SculptForge",
+ "tags": [
+ "clay",
+ "blocking",
+ "forms"
+ ],
+ "format": "sfbrush",
+ "version": 1
+}
diff --git a/tools/brush-gallery/repo/brushes/cracked-earth.sfbrush b/tools/brush-gallery/repo/brushes/cracked-earth.sfbrush
new file mode 100644
index 00000000..404b69b7
--- /dev/null
+++ b/tools/brush-gallery/repo/brushes/cracked-earth.sfbrush
@@ -0,0 +1,29 @@
+{
+ "name": "Cracked Earth",
+ "description": "Dry, cracked mud: flattens the ground and splits it into plates.",
+ "direction": "normal",
+ "depth": -0.25,
+ "plane": "flatten",
+ "planeAmount": 0.5,
+ "pinch": 0,
+ "drag": 0,
+ "smooth": 0,
+ "hardness": 0.8,
+ "tipSharpness": 0,
+ "pattern": "cracks",
+ "patternScale": 0.7,
+ "patternAmount": 1.0,
+ "spacing": 0.2,
+ "jitter": 0,
+ "pressureCurve": 1,
+ "frontFacesOnly": false,
+ "cavityMask": 0,
+ "author": "SculptForge",
+ "tags": [
+ "environment",
+ "ground",
+ "cracks"
+ ],
+ "format": "sfbrush",
+ "version": 1
+}
diff --git a/tools/brush-gallery/repo/brushes/dragon-scales.sfbrush b/tools/brush-gallery/repo/brushes/dragon-scales.sfbrush
new file mode 100644
index 00000000..e36b1ebe
--- /dev/null
+++ b/tools/brush-gallery/repo/brushes/dragon-scales.sfbrush
@@ -0,0 +1,29 @@
+{
+ "name": "Dragon Scales",
+ "description": "Stamps rounded overlapping scales along the stroke.",
+ "direction": "normal",
+ "depth": 0.45,
+ "plane": "none",
+ "planeAmount": 0.5,
+ "pinch": 0,
+ "drag": 0,
+ "smooth": 0,
+ "hardness": 0.35,
+ "tipSharpness": 0,
+ "pattern": "scales",
+ "patternScale": 0.35,
+ "patternAmount": 0.95,
+ "spacing": 0.35,
+ "jitter": 0,
+ "pressureCurve": 1,
+ "frontFacesOnly": false,
+ "cavityMask": 0,
+ "author": "SculptForge",
+ "tags": [
+ "creature",
+ "scales",
+ "texture"
+ ],
+ "format": "sfbrush",
+ "version": 1
+}
diff --git a/tools/brush-gallery/repo/brushes/edge-wear.sfbrush b/tools/brush-gallery/repo/brushes/edge-wear.sfbrush
new file mode 100644
index 00000000..76c33a31
--- /dev/null
+++ b/tools/brush-gallery/repo/brushes/edge-wear.sfbrush
@@ -0,0 +1,29 @@
+{
+ "name": "Edge Wear",
+ "description": "Chips and softens only the sharp edges and ridges, for weathered props.",
+ "direction": "normal",
+ "depth": -0.35,
+ "plane": "none",
+ "planeAmount": 0.5,
+ "pinch": 0,
+ "drag": 0,
+ "smooth": 0,
+ "hardness": 0.4,
+ "tipSharpness": 0,
+ "pattern": "noise",
+ "patternScale": 0.25,
+ "patternAmount": 0.7,
+ "spacing": 0.15,
+ "jitter": 0,
+ "pressureCurve": 1,
+ "frontFacesOnly": false,
+ "cavityMask": -0.8,
+ "author": "SculptForge",
+ "tags": [
+ "props",
+ "weathering",
+ "hard-surface"
+ ],
+ "format": "sfbrush",
+ "version": 1
+}
diff --git a/tools/brush-gallery/repo/brushes/fabric-folds.sfbrush b/tools/brush-gallery/repo/brushes/fabric-folds.sfbrush
new file mode 100644
index 00000000..8bb4be8e
--- /dev/null
+++ b/tools/brush-gallery/repo/brushes/fabric-folds.sfbrush
@@ -0,0 +1,29 @@
+{
+ "name": "Fabric Folds",
+ "description": "Soft, rounded cloth folds with a crisp inner edge.",
+ "direction": "normal",
+ "depth": 0.55,
+ "plane": "none",
+ "planeAmount": 0.5,
+ "pinch": 0.45,
+ "drag": 0.15,
+ "smooth": 0.25,
+ "hardness": 0.1,
+ "tipSharpness": 0.25,
+ "pattern": "none",
+ "patternScale": 0.3,
+ "patternAmount": 0,
+ "spacing": 0.05,
+ "jitter": 0,
+ "pressureCurve": 1,
+ "frontFacesOnly": false,
+ "cavityMask": 0,
+ "author": "SculptForge",
+ "tags": [
+ "fabric",
+ "clothing",
+ "folds"
+ ],
+ "format": "sfbrush",
+ "version": 1
+}
diff --git a/tools/brush-gallery/repo/brushes/hammered-metal.sfbrush b/tools/brush-gallery/repo/brushes/hammered-metal.sfbrush
new file mode 100644
index 00000000..160bf1f7
--- /dev/null
+++ b/tools/brush-gallery/repo/brushes/hammered-metal.sfbrush
@@ -0,0 +1,29 @@
+{
+ "name": "Hammered Metal",
+ "description": "Soft overlapping hammer dimples for beaten copper, armour and cookware.",
+ "direction": "normal",
+ "depth": -1.0,
+ "plane": "flatten",
+ "planeAmount": 1.0,
+ "pinch": 0,
+ "drag": 0,
+ "smooth": 0,
+ "hardness": 0.0,
+ "tipSharpness": 0,
+ "pattern": "none",
+ "patternScale": 0.3,
+ "patternAmount": 0,
+ "spacing": 0.45,
+ "jitter": 1.0,
+ "pressureCurve": 1,
+ "frontFacesOnly": false,
+ "cavityMask": 0,
+ "author": "SculptForge",
+ "tags": [
+ "metal",
+ "props",
+ "hard-surface"
+ ],
+ "format": "sfbrush",
+ "version": 1
+}
diff --git a/tools/brush-gallery/repo/brushes/lava-rock.sfbrush b/tools/brush-gallery/repo/brushes/lava-rock.sfbrush
new file mode 100644
index 00000000..a630c763
--- /dev/null
+++ b/tools/brush-gallery/repo/brushes/lava-rock.sfbrush
@@ -0,0 +1,29 @@
+{
+ "name": "Lava Rock",
+ "description": "Pitted, porous volcanic stone and pumice.",
+ "direction": "normal",
+ "depth": -0.8,
+ "plane": "none",
+ "planeAmount": 0.5,
+ "pinch": 0,
+ "drag": 0,
+ "smooth": 0,
+ "hardness": 0.5,
+ "tipSharpness": 0,
+ "pattern": "pores",
+ "patternScale": 0.3,
+ "patternAmount": 1.0,
+ "spacing": 0.08,
+ "jitter": 0.4,
+ "pressureCurve": 1,
+ "frontFacesOnly": false,
+ "cavityMask": 0,
+ "author": "SculptForge",
+ "tags": [
+ "stone",
+ "environment",
+ "texture"
+ ],
+ "format": "sfbrush",
+ "version": 1
+}
diff --git a/tools/brush-gallery/repo/brushes/orange-peel.sfbrush b/tools/brush-gallery/repo/brushes/orange-peel.sfbrush
new file mode 100644
index 00000000..4f0cb6d6
--- /dev/null
+++ b/tools/brush-gallery/repo/brushes/orange-peel.sfbrush
@@ -0,0 +1,29 @@
+{
+ "name": "Orange Peel",
+ "description": "Dense dimpled skin like citrus peel, leather or older skin.",
+ "direction": "normal",
+ "depth": -0.4,
+ "plane": "none",
+ "planeAmount": 0.5,
+ "pinch": 0,
+ "drag": 0,
+ "smooth": 0,
+ "hardness": 0.3,
+ "tipSharpness": 0,
+ "pattern": "pores",
+ "patternScale": 0.12,
+ "patternAmount": 1.0,
+ "spacing": 0.12,
+ "jitter": 0.5,
+ "pressureCurve": 1,
+ "frontFacesOnly": false,
+ "cavityMask": 0,
+ "author": "SculptForge",
+ "tags": [
+ "skin",
+ "texture",
+ "character"
+ ],
+ "format": "sfbrush",
+ "version": 1
+}
diff --git a/tools/brush-gallery/repo/brushes/palette-knife.sfbrush b/tools/brush-gallery/repo/brushes/palette-knife.sfbrush
new file mode 100644
index 00000000..7c2ccc01
--- /dev/null
+++ b/tools/brush-gallery/repo/brushes/palette-knife.sfbrush
@@ -0,0 +1,29 @@
+{
+ "name": "Palette Knife",
+ "description": "Flattens and drags clay sideways like a sculptor's knife.",
+ "direction": "normal",
+ "depth": 0,
+ "plane": "flatten",
+ "planeAmount": 0.8,
+ "pinch": 0,
+ "drag": 0.6,
+ "smooth": 0,
+ "hardness": 0.75,
+ "tipSharpness": 0,
+ "pattern": "none",
+ "patternScale": 0.3,
+ "patternAmount": 0,
+ "spacing": 0.1,
+ "jitter": 0,
+ "pressureCurve": 1,
+ "frontFacesOnly": false,
+ "cavityMask": 0,
+ "author": "SculptForge",
+ "tags": [
+ "clay",
+ "planes",
+ "hard-surface"
+ ],
+ "format": "sfbrush",
+ "version": 1
+}
diff --git a/tools/brush-gallery/repo/brushes/panel-line.sfbrush b/tools/brush-gallery/repo/brushes/panel-line.sfbrush
new file mode 100644
index 00000000..943f79d5
--- /dev/null
+++ b/tools/brush-gallery/repo/brushes/panel-line.sfbrush
@@ -0,0 +1,29 @@
+{
+ "name": "Panel Line",
+ "description": "Clean, narrow grooves for hard-surface panel seams.",
+ "direction": "normal",
+ "depth": -0.6,
+ "plane": "none",
+ "planeAmount": 0.5,
+ "pinch": 0.35,
+ "drag": 0,
+ "smooth": 0,
+ "hardness": 0.3,
+ "tipSharpness": 1.0,
+ "pattern": "none",
+ "patternScale": 0.3,
+ "patternAmount": 0,
+ "spacing": 0.1,
+ "jitter": 0,
+ "pressureCurve": 1,
+ "frontFacesOnly": false,
+ "cavityMask": 0,
+ "author": "SculptForge",
+ "tags": [
+ "hard-surface",
+ "mech",
+ "crease"
+ ],
+ "format": "sfbrush",
+ "version": 1
+}
diff --git a/tools/brush-gallery/repo/brushes/rasp.sfbrush b/tools/brush-gallery/repo/brushes/rasp.sfbrush
new file mode 100644
index 00000000..8ec61cc1
--- /dev/null
+++ b/tools/brush-gallery/repo/brushes/rasp.sfbrush
@@ -0,0 +1,29 @@
+{
+ "name": "Rasp",
+ "description": "Coarse file and rasp marks for carved wood, stone and rough castings.",
+ "direction": "normal",
+ "depth": -0.3,
+ "plane": "none",
+ "planeAmount": 0.5,
+ "pinch": 0,
+ "drag": 0.4,
+ "smooth": 0,
+ "hardness": 0.5,
+ "tipSharpness": 0,
+ "pattern": "ridges",
+ "patternScale": 0.25,
+ "patternAmount": 0.8,
+ "spacing": 0.05,
+ "jitter": 0,
+ "pressureCurve": 1,
+ "frontFacesOnly": false,
+ "cavityMask": 0,
+ "author": "SculptForge",
+ "tags": [
+ "wood",
+ "stone",
+ "texture"
+ ],
+ "format": "sfbrush",
+ "version": 1
+}
diff --git a/tools/brush-gallery/repo/brushes/rope.sfbrush b/tools/brush-gallery/repo/brushes/rope.sfbrush
new file mode 100644
index 00000000..7d49e1db
--- /dev/null
+++ b/tools/brush-gallery/repo/brushes/rope.sfbrush
@@ -0,0 +1,29 @@
+{
+ "name": "Rope",
+ "description": "A raised, knotted cord for ropes, braids and cables.",
+ "direction": "normal",
+ "depth": 0.7,
+ "plane": "none",
+ "planeAmount": 0.5,
+ "pinch": 0,
+ "drag": 0,
+ "smooth": 0.1,
+ "hardness": 0.5,
+ "tipSharpness": 0,
+ "pattern": "scales",
+ "patternScale": 0.5,
+ "patternAmount": 0.6,
+ "spacing": 0.05,
+ "jitter": 0,
+ "pressureCurve": 1,
+ "frontFacesOnly": false,
+ "cavityMask": 0,
+ "author": "SculptForge",
+ "tags": [
+ "props",
+ "fabric",
+ "cord"
+ ],
+ "format": "sfbrush",
+ "version": 1
+}
diff --git a/tools/brush-gallery/repo/brushes/rough-clay.sfbrush b/tools/brush-gallery/repo/brushes/rough-clay.sfbrush
new file mode 100644
index 00000000..6da8e0e5
--- /dev/null
+++ b/tools/brush-gallery/repo/brushes/rough-clay.sfbrush
@@ -0,0 +1,29 @@
+{
+ "name": "Rough Clay",
+ "description": "Lumpy, hand-pressed clay for a traditional sculpted look.",
+ "direction": "normal",
+ "depth": 0.4,
+ "plane": "clay",
+ "planeAmount": 0.4,
+ "pinch": 0,
+ "drag": 0,
+ "smooth": 0,
+ "hardness": 0.4,
+ "tipSharpness": 0,
+ "pattern": "noise",
+ "patternScale": 0.45,
+ "patternAmount": 0.75,
+ "spacing": 0.2,
+ "jitter": 0.4,
+ "pressureCurve": 1,
+ "frontFacesOnly": false,
+ "cavityMask": 0,
+ "author": "SculptForge",
+ "tags": [
+ "clay",
+ "blocking",
+ "texture"
+ ],
+ "format": "sfbrush",
+ "version": 1
+}
diff --git a/tools/brush-gallery/repo/brushes/scar-tissue.sfbrush b/tools/brush-gallery/repo/brushes/scar-tissue.sfbrush
new file mode 100644
index 00000000..87c75fb1
--- /dev/null
+++ b/tools/brush-gallery/repo/brushes/scar-tissue.sfbrush
@@ -0,0 +1,29 @@
+{
+ "name": "Scar Tissue",
+ "description": "Raised, puckered scars and healed wounds.",
+ "direction": "normal",
+ "depth": 0.4,
+ "plane": "none",
+ "planeAmount": 0.5,
+ "pinch": 0.6,
+ "drag": 0,
+ "smooth": 0.15,
+ "hardness": 0.2,
+ "tipSharpness": 0.3,
+ "pattern": "ridges",
+ "patternScale": 0.25,
+ "patternAmount": 0.25,
+ "spacing": 0.05,
+ "jitter": 0,
+ "pressureCurve": 1,
+ "frontFacesOnly": false,
+ "cavityMask": 0,
+ "author": "SculptForge",
+ "tags": [
+ "skin",
+ "character",
+ "creature"
+ ],
+ "format": "sfbrush",
+ "version": 1
+}
diff --git a/tools/brush-gallery/repo/brushes/skin-pores.sfbrush b/tools/brush-gallery/repo/brushes/skin-pores.sfbrush
new file mode 100644
index 00000000..7e129903
--- /dev/null
+++ b/tools/brush-gallery/repo/brushes/skin-pores.sfbrush
@@ -0,0 +1,29 @@
+{
+ "name": "Skin Pores",
+ "description": "Sprinkles tiny pores for close-up skin detail.",
+ "direction": "normal",
+ "depth": -0.2,
+ "plane": "none",
+ "planeAmount": 0.5,
+ "pinch": 0,
+ "drag": 0,
+ "smooth": 0,
+ "hardness": 0,
+ "tipSharpness": 0,
+ "pattern": "pores",
+ "patternScale": 0.08,
+ "patternAmount": 1,
+ "spacing": 0.3,
+ "jitter": 0.3,
+ "pressureCurve": 1,
+ "frontFacesOnly": true,
+ "cavityMask": 0,
+ "author": "SculptForge",
+ "tags": [
+ "skin",
+ "texture",
+ "character"
+ ],
+ "format": "sfbrush",
+ "version": 1
+}
diff --git a/tools/brush-gallery/repo/brushes/snake-scales.sfbrush b/tools/brush-gallery/repo/brushes/snake-scales.sfbrush
new file mode 100644
index 00000000..9aa35829
--- /dev/null
+++ b/tools/brush-gallery/repo/brushes/snake-scales.sfbrush
@@ -0,0 +1,29 @@
+{
+ "name": "Snake Scales",
+ "description": "Tight rows of small, smooth scales for snakes, lizards and fish.",
+ "direction": "normal",
+ "depth": 0.35,
+ "plane": "none",
+ "planeAmount": 0.5,
+ "pinch": 0,
+ "drag": 0,
+ "smooth": 0,
+ "hardness": 0.55,
+ "tipSharpness": 0,
+ "pattern": "scales",
+ "patternScale": 0.18,
+ "patternAmount": 1.0,
+ "spacing": 0.2,
+ "jitter": 0,
+ "pressureCurve": 1,
+ "frontFacesOnly": false,
+ "cavityMask": 0,
+ "author": "SculptForge",
+ "tags": [
+ "creature",
+ "scales",
+ "texture"
+ ],
+ "format": "sfbrush",
+ "version": 1
+}
diff --git a/tools/brush-gallery/repo/brushes/stone-chisel.sfbrush b/tools/brush-gallery/repo/brushes/stone-chisel.sfbrush
new file mode 100644
index 00000000..ef2e05bd
--- /dev/null
+++ b/tools/brush-gallery/repo/brushes/stone-chisel.sfbrush
@@ -0,0 +1,29 @@
+{
+ "name": "Stone Chisel",
+ "description": "Scrapes hard planes and breaks them up with cracks for rocks and ruins.",
+ "direction": "normal",
+ "depth": -0.25,
+ "plane": "scrape",
+ "planeAmount": 0.8,
+ "pinch": 0,
+ "drag": 0,
+ "smooth": 0,
+ "hardness": 0.85,
+ "tipSharpness": 0,
+ "pattern": "cracks",
+ "patternScale": 0.45,
+ "patternAmount": 0.6,
+ "spacing": 0.15,
+ "jitter": 0,
+ "pressureCurve": 1,
+ "frontFacesOnly": false,
+ "cavityMask": 0,
+ "author": "SculptForge",
+ "tags": [
+ "stone",
+ "environment",
+ "hard-surface"
+ ],
+ "format": "sfbrush",
+ "version": 1
+}
diff --git a/tools/brush-gallery/repo/brushes/tree-bark.sfbrush b/tools/brush-gallery/repo/brushes/tree-bark.sfbrush
new file mode 100644
index 00000000..0131e61d
--- /dev/null
+++ b/tools/brush-gallery/repo/brushes/tree-bark.sfbrush
@@ -0,0 +1,29 @@
+{
+ "name": "Tree Bark",
+ "description": "Deep, sinewy bark ridges for trunks, roots and old wood.",
+ "direction": "normal",
+ "depth": 0.4,
+ "plane": "none",
+ "planeAmount": 0.5,
+ "pinch": 0,
+ "drag": 0,
+ "smooth": 0,
+ "hardness": 0.5,
+ "tipSharpness": 0,
+ "pattern": "ridges",
+ "patternScale": 0.3,
+ "patternAmount": 1.0,
+ "spacing": 0.12,
+ "jitter": 0.15,
+ "pressureCurve": 1,
+ "frontFacesOnly": false,
+ "cavityMask": 0,
+ "author": "SculptForge",
+ "tags": [
+ "environment",
+ "wood",
+ "texture"
+ ],
+ "format": "sfbrush",
+ "version": 1
+}
diff --git a/tools/brush-gallery/repo/brushes/veins.sfbrush b/tools/brush-gallery/repo/brushes/veins.sfbrush
new file mode 100644
index 00000000..8baad31d
--- /dev/null
+++ b/tools/brush-gallery/repo/brushes/veins.sfbrush
@@ -0,0 +1,29 @@
+{
+ "name": "Veins",
+ "description": "Soft raised veins and tendons under the skin.",
+ "direction": "normal",
+ "depth": 0.45,
+ "plane": "none",
+ "planeAmount": 0.5,
+ "pinch": 0.3,
+ "drag": 0,
+ "smooth": 0.35,
+ "hardness": 0.1,
+ "tipSharpness": 0.8,
+ "pattern": "none",
+ "patternScale": 0.3,
+ "patternAmount": 0,
+ "spacing": 0.05,
+ "jitter": 0,
+ "pressureCurve": 1,
+ "frontFacesOnly": true,
+ "cavityMask": 0,
+ "author": "SculptForge",
+ "tags": [
+ "skin",
+ "anatomy",
+ "character"
+ ],
+ "format": "sfbrush",
+ "version": 1
+}
diff --git a/tools/brush-gallery/repo/brushes/wrinkle.sfbrush b/tools/brush-gallery/repo/brushes/wrinkle.sfbrush
new file mode 100644
index 00000000..a8fa5683
--- /dev/null
+++ b/tools/brush-gallery/repo/brushes/wrinkle.sfbrush
@@ -0,0 +1,29 @@
+{
+ "name": "Wrinkle",
+ "description": "Fine, sharp creases for skin folds and fabric wrinkles.",
+ "direction": "normal",
+ "depth": -0.55,
+ "plane": "none",
+ "planeAmount": 0.5,
+ "pinch": 0.7,
+ "drag": 0,
+ "smooth": 0,
+ "hardness": 0.15,
+ "tipSharpness": 0.7,
+ "pattern": "none",
+ "patternScale": 0.3,
+ "patternAmount": 0,
+ "spacing": 0.06,
+ "jitter": 0,
+ "pressureCurve": 1,
+ "frontFacesOnly": false,
+ "cavityMask": 0,
+ "author": "SculptForge",
+ "tags": [
+ "skin",
+ "fabric",
+ "crease"
+ ],
+ "format": "sfbrush",
+ "version": 1
+}
diff --git a/tools/brush-gallery/repo/index.json b/tools/brush-gallery/repo/index.json
new file mode 100644
index 00000000..af560083
--- /dev/null
+++ b/tools/brush-gallery/repo/index.json
@@ -0,0 +1,300 @@
+{
+ "format": "sculptforge-brush-gallery",
+ "version": 1,
+ "brushes": [
+ {
+ "name": "Chipped Stone",
+ "description": "Knocks rough, eroded chips into stone blocks, walls and cliffs.",
+ "author": "SculptForge",
+ "tags": [
+ "stone",
+ "environment",
+ "weathering"
+ ],
+ "file": "brushes/chipped-stone.sfbrush",
+ "preview": "previews/chipped-stone.png",
+ "sha256": "c7ffc468725fbd5efd7b3ae1c7d270fb63be7a2cb24547bae99f62366072e4ae",
+ "added": "2026-10-22"
+ },
+ {
+ "name": "Clay Buildup",
+ "description": "Builds up flat-topped strokes of clay for blocking in forms.",
+ "author": "SculptForge",
+ "tags": [
+ "clay",
+ "blocking",
+ "forms"
+ ],
+ "file": "brushes/clay-buildup.sfbrush",
+ "preview": "previews/clay-buildup.png",
+ "sha256": "0681e2d2e16d0ca18f2d70297509a9939fdcd89488077299e2d162afe7a4ca55",
+ "added": "2026-10-22"
+ },
+ {
+ "name": "Cracked Earth",
+ "description": "Dry, cracked mud: flattens the ground and splits it into plates.",
+ "author": "SculptForge",
+ "tags": [
+ "environment",
+ "ground",
+ "cracks"
+ ],
+ "file": "brushes/cracked-earth.sfbrush",
+ "preview": "previews/cracked-earth.png",
+ "sha256": "99230163c8d9d8b2e71c3c8e1b2cd377055154bd3fd533cd6b6737911254a866",
+ "added": "2026-10-22"
+ },
+ {
+ "name": "Dragon Scales",
+ "description": "Stamps rounded overlapping scales along the stroke.",
+ "author": "SculptForge",
+ "tags": [
+ "creature",
+ "scales",
+ "texture"
+ ],
+ "file": "brushes/dragon-scales.sfbrush",
+ "preview": "previews/dragon-scales.png",
+ "sha256": "8b280a7f656c8193e7d9a6378c94cb98b7e220283b1f325d24b86579f7bf4da1",
+ "added": "2026-10-22"
+ },
+ {
+ "name": "Edge Wear",
+ "description": "Chips and softens only the sharp edges and ridges, for weathered props.",
+ "author": "SculptForge",
+ "tags": [
+ "props",
+ "weathering",
+ "hard-surface"
+ ],
+ "file": "brushes/edge-wear.sfbrush",
+ "preview": "previews/edge-wear.png",
+ "sha256": "c0caee8df43a88738bf32c2aac742bca022b6edf8d8e4f316d380dd28483c50e",
+ "added": "2026-10-22"
+ },
+ {
+ "name": "Fabric Folds",
+ "description": "Soft, rounded cloth folds with a crisp inner edge.",
+ "author": "SculptForge",
+ "tags": [
+ "fabric",
+ "clothing",
+ "folds"
+ ],
+ "file": "brushes/fabric-folds.sfbrush",
+ "preview": "previews/fabric-folds.png",
+ "sha256": "4f3bc4f8abb61453c00930ce867b039df74cd57e9a8578fc157d16a82993c398",
+ "added": "2026-10-22"
+ },
+ {
+ "name": "Hammered Metal",
+ "description": "Soft overlapping hammer dimples for beaten copper, armour and cookware.",
+ "author": "SculptForge",
+ "tags": [
+ "metal",
+ "props",
+ "hard-surface"
+ ],
+ "file": "brushes/hammered-metal.sfbrush",
+ "preview": "previews/hammered-metal.png",
+ "sha256": "0a6c2e543854bbf1ace7c03584d93c7223ba34690ffd15ae2c8f681e63215a59",
+ "added": "2026-10-22"
+ },
+ {
+ "name": "Lava Rock",
+ "description": "Pitted, porous volcanic stone and pumice.",
+ "author": "SculptForge",
+ "tags": [
+ "stone",
+ "environment",
+ "texture"
+ ],
+ "file": "brushes/lava-rock.sfbrush",
+ "preview": "previews/lava-rock.png",
+ "sha256": "09508472f41b8dbf602ca235b4b78ab11fb6a637939857840769e470c64fe541",
+ "added": "2026-10-22"
+ },
+ {
+ "name": "Orange Peel",
+ "description": "Dense dimpled skin like citrus peel, leather or older skin.",
+ "author": "SculptForge",
+ "tags": [
+ "skin",
+ "texture",
+ "character"
+ ],
+ "file": "brushes/orange-peel.sfbrush",
+ "preview": "previews/orange-peel.png",
+ "sha256": "893f1a1ec7086b0125db2764822cf3bfe6c4fe33cba797b396cc19c484400dfb",
+ "added": "2026-10-22"
+ },
+ {
+ "name": "Palette Knife",
+ "description": "Flattens and drags clay sideways like a sculptor's knife.",
+ "author": "SculptForge",
+ "tags": [
+ "clay",
+ "planes",
+ "hard-surface"
+ ],
+ "file": "brushes/palette-knife.sfbrush",
+ "preview": "previews/palette-knife.png",
+ "sha256": "1c35a1edb55bf819f22e7d8a79040bc75ede35075e9c269a46d2598bfed0f247",
+ "added": "2026-10-22"
+ },
+ {
+ "name": "Panel Line",
+ "description": "Clean, narrow grooves for hard-surface panel seams.",
+ "author": "SculptForge",
+ "tags": [
+ "hard-surface",
+ "mech",
+ "crease"
+ ],
+ "file": "brushes/panel-line.sfbrush",
+ "preview": "previews/panel-line.png",
+ "sha256": "6b3dc65fca7b3fbb4458303b5bbf68bfafce7491910cfd88211890444a5b483c",
+ "added": "2026-10-22"
+ },
+ {
+ "name": "Rasp",
+ "description": "Coarse file and rasp marks for carved wood, stone and rough castings.",
+ "author": "SculptForge",
+ "tags": [
+ "wood",
+ "stone",
+ "texture"
+ ],
+ "file": "brushes/rasp.sfbrush",
+ "preview": "previews/rasp.png",
+ "sha256": "796078c902282b17669675887ee9696b4ab0fc2c8b940822e401912017abad43",
+ "added": "2026-10-22"
+ },
+ {
+ "name": "Rope",
+ "description": "A raised, knotted cord for ropes, braids and cables.",
+ "author": "SculptForge",
+ "tags": [
+ "props",
+ "fabric",
+ "cord"
+ ],
+ "file": "brushes/rope.sfbrush",
+ "preview": "previews/rope.png",
+ "sha256": "2371ac38551d9d52173628a901735702b74e786025cd6e368458e33bef9729d4",
+ "added": "2026-10-22"
+ },
+ {
+ "name": "Rough Clay",
+ "description": "Lumpy, hand-pressed clay for a traditional sculpted look.",
+ "author": "SculptForge",
+ "tags": [
+ "clay",
+ "blocking",
+ "texture"
+ ],
+ "file": "brushes/rough-clay.sfbrush",
+ "preview": "previews/rough-clay.png",
+ "sha256": "286ea08a9ea8b0f020713f2f6071229548eca628d456bce7d05537b4c06b4b0e",
+ "added": "2026-10-22"
+ },
+ {
+ "name": "Scar Tissue",
+ "description": "Raised, puckered scars and healed wounds.",
+ "author": "SculptForge",
+ "tags": [
+ "skin",
+ "character",
+ "creature"
+ ],
+ "file": "brushes/scar-tissue.sfbrush",
+ "preview": "previews/scar-tissue.png",
+ "sha256": "3f01aa14511af0232cc414b341ab620ad1f61966d6329126f7d968027bc1cad9",
+ "added": "2026-10-22"
+ },
+ {
+ "name": "Skin Pores",
+ "description": "Sprinkles tiny pores for close-up skin detail.",
+ "author": "SculptForge",
+ "tags": [
+ "skin",
+ "texture",
+ "character"
+ ],
+ "file": "brushes/skin-pores.sfbrush",
+ "preview": "previews/skin-pores.png",
+ "sha256": "7b984fab853ccebf6b422059cc733cb3ad8f272b6456ae302c0230d0da864623",
+ "added": "2026-10-22"
+ },
+ {
+ "name": "Snake Scales",
+ "description": "Tight rows of small, smooth scales for snakes, lizards and fish.",
+ "author": "SculptForge",
+ "tags": [
+ "creature",
+ "scales",
+ "texture"
+ ],
+ "file": "brushes/snake-scales.sfbrush",
+ "preview": "previews/snake-scales.png",
+ "sha256": "c035ed01b287843b11fd56224b73d1e10b1fd6cc779034920b383b783c4458a0",
+ "added": "2026-10-22"
+ },
+ {
+ "name": "Stone Chisel",
+ "description": "Scrapes hard planes and breaks them up with cracks for rocks and ruins.",
+ "author": "SculptForge",
+ "tags": [
+ "stone",
+ "environment",
+ "hard-surface"
+ ],
+ "file": "brushes/stone-chisel.sfbrush",
+ "preview": "previews/stone-chisel.png",
+ "sha256": "7db8ad4c84793a093fc21bd724bc63c127dde0528df32d677fe5552378c299e4",
+ "added": "2026-10-22"
+ },
+ {
+ "name": "Tree Bark",
+ "description": "Deep, sinewy bark ridges for trunks, roots and old wood.",
+ "author": "SculptForge",
+ "tags": [
+ "environment",
+ "wood",
+ "texture"
+ ],
+ "file": "brushes/tree-bark.sfbrush",
+ "preview": "previews/tree-bark.png",
+ "sha256": "46f15969f96e90b1bbb4aedfb2a00ea427e29c57790b77750ccb4b773783a019",
+ "added": "2026-10-22"
+ },
+ {
+ "name": "Veins",
+ "description": "Soft raised veins and tendons under the skin.",
+ "author": "SculptForge",
+ "tags": [
+ "skin",
+ "anatomy",
+ "character"
+ ],
+ "file": "brushes/veins.sfbrush",
+ "preview": "previews/veins.png",
+ "sha256": "0f5d91734d140856c7a5cd49798be8dc0a10a10eb388270d67a9f2f098f36a52",
+ "added": "2026-10-22"
+ },
+ {
+ "name": "Wrinkle",
+ "description": "Fine, sharp creases for skin folds and fabric wrinkles.",
+ "author": "SculptForge",
+ "tags": [
+ "skin",
+ "fabric",
+ "crease"
+ ],
+ "file": "brushes/wrinkle.sfbrush",
+ "preview": "previews/wrinkle.png",
+ "sha256": "7051077d8ffb4b254d0fc1eb117b12124f6aef2bd12dd0d9e440e3ab0cb9a48a",
+ "added": "2026-10-22"
+ }
+ ]
+}
diff --git a/tools/brush-gallery/repo/previews/chipped-stone.png b/tools/brush-gallery/repo/previews/chipped-stone.png
new file mode 100644
index 00000000..cbb6a4a1
Binary files /dev/null and b/tools/brush-gallery/repo/previews/chipped-stone.png differ
diff --git a/tools/brush-gallery/repo/previews/clay-buildup.png b/tools/brush-gallery/repo/previews/clay-buildup.png
new file mode 100644
index 00000000..0ad2fbb9
Binary files /dev/null and b/tools/brush-gallery/repo/previews/clay-buildup.png differ
diff --git a/tools/brush-gallery/repo/previews/cracked-earth.png b/tools/brush-gallery/repo/previews/cracked-earth.png
new file mode 100644
index 00000000..c9c37b0f
Binary files /dev/null and b/tools/brush-gallery/repo/previews/cracked-earth.png differ
diff --git a/tools/brush-gallery/repo/previews/dragon-scales.png b/tools/brush-gallery/repo/previews/dragon-scales.png
new file mode 100644
index 00000000..333facbe
Binary files /dev/null and b/tools/brush-gallery/repo/previews/dragon-scales.png differ
diff --git a/tools/brush-gallery/repo/previews/edge-wear.png b/tools/brush-gallery/repo/previews/edge-wear.png
new file mode 100644
index 00000000..97c49028
Binary files /dev/null and b/tools/brush-gallery/repo/previews/edge-wear.png differ
diff --git a/tools/brush-gallery/repo/previews/fabric-folds.png b/tools/brush-gallery/repo/previews/fabric-folds.png
new file mode 100644
index 00000000..81574c8e
Binary files /dev/null and b/tools/brush-gallery/repo/previews/fabric-folds.png differ
diff --git a/tools/brush-gallery/repo/previews/hammered-metal.png b/tools/brush-gallery/repo/previews/hammered-metal.png
new file mode 100644
index 00000000..6ae0c062
Binary files /dev/null and b/tools/brush-gallery/repo/previews/hammered-metal.png differ
diff --git a/tools/brush-gallery/repo/previews/lava-rock.png b/tools/brush-gallery/repo/previews/lava-rock.png
new file mode 100644
index 00000000..4f0a771a
Binary files /dev/null and b/tools/brush-gallery/repo/previews/lava-rock.png differ
diff --git a/tools/brush-gallery/repo/previews/orange-peel.png b/tools/brush-gallery/repo/previews/orange-peel.png
new file mode 100644
index 00000000..c9b27540
Binary files /dev/null and b/tools/brush-gallery/repo/previews/orange-peel.png differ
diff --git a/tools/brush-gallery/repo/previews/palette-knife.png b/tools/brush-gallery/repo/previews/palette-knife.png
new file mode 100644
index 00000000..3173142a
Binary files /dev/null and b/tools/brush-gallery/repo/previews/palette-knife.png differ
diff --git a/tools/brush-gallery/repo/previews/panel-line.png b/tools/brush-gallery/repo/previews/panel-line.png
new file mode 100644
index 00000000..f3ea93b1
Binary files /dev/null and b/tools/brush-gallery/repo/previews/panel-line.png differ
diff --git a/tools/brush-gallery/repo/previews/rasp.png b/tools/brush-gallery/repo/previews/rasp.png
new file mode 100644
index 00000000..19c31320
Binary files /dev/null and b/tools/brush-gallery/repo/previews/rasp.png differ
diff --git a/tools/brush-gallery/repo/previews/rope.png b/tools/brush-gallery/repo/previews/rope.png
new file mode 100644
index 00000000..e1e6e8d8
Binary files /dev/null and b/tools/brush-gallery/repo/previews/rope.png differ
diff --git a/tools/brush-gallery/repo/previews/rough-clay.png b/tools/brush-gallery/repo/previews/rough-clay.png
new file mode 100644
index 00000000..7f7ab739
Binary files /dev/null and b/tools/brush-gallery/repo/previews/rough-clay.png differ
diff --git a/tools/brush-gallery/repo/previews/scar-tissue.png b/tools/brush-gallery/repo/previews/scar-tissue.png
new file mode 100644
index 00000000..bb73ccb6
Binary files /dev/null and b/tools/brush-gallery/repo/previews/scar-tissue.png differ
diff --git a/tools/brush-gallery/repo/previews/skin-pores.png b/tools/brush-gallery/repo/previews/skin-pores.png
new file mode 100644
index 00000000..0ee9d5c6
Binary files /dev/null and b/tools/brush-gallery/repo/previews/skin-pores.png differ
diff --git a/tools/brush-gallery/repo/previews/snake-scales.png b/tools/brush-gallery/repo/previews/snake-scales.png
new file mode 100644
index 00000000..24475b48
Binary files /dev/null and b/tools/brush-gallery/repo/previews/snake-scales.png differ
diff --git a/tools/brush-gallery/repo/previews/stone-chisel.png b/tools/brush-gallery/repo/previews/stone-chisel.png
new file mode 100644
index 00000000..2c604507
Binary files /dev/null and b/tools/brush-gallery/repo/previews/stone-chisel.png differ
diff --git a/tools/brush-gallery/repo/previews/tree-bark.png b/tools/brush-gallery/repo/previews/tree-bark.png
new file mode 100644
index 00000000..c7d4cdfd
Binary files /dev/null and b/tools/brush-gallery/repo/previews/tree-bark.png differ
diff --git a/tools/brush-gallery/repo/previews/veins.png b/tools/brush-gallery/repo/previews/veins.png
new file mode 100644
index 00000000..e8da557d
Binary files /dev/null and b/tools/brush-gallery/repo/previews/veins.png differ
diff --git a/tools/brush-gallery/repo/previews/wrinkle.png b/tools/brush-gallery/repo/previews/wrinkle.png
new file mode 100644
index 00000000..fedeb7fc
Binary files /dev/null and b/tools/brush-gallery/repo/previews/wrinkle.png differ
diff --git a/tools/brush-gallery/sync_website.py b/tools/brush-gallery/sync_website.py
new file mode 100644
index 00000000..816f855b
--- /dev/null
+++ b/tools/brush-gallery/sync_website.py
@@ -0,0 +1,65 @@
+#!/usr/bin/env python3
+# SculptForge - open source digital sculpting
+# SPDX-License-Identifier: GPL-3.0-or-later
+"""Copy the brush gallery into the website and write its cards into brushes.html.
+
+ python3 sync_website.py [gallery folder] [website folder]
+
+The site bundles a snapshot (website/gallery/: index.json, brushes, previews)
+so brushes.html works without JavaScript and before the gallery repository is
+published; in the browser it switches to the live index when it can reach it.
+Run after build_index.py. Standard library only.
+"""
+
+import html
+import json
+import re
+import shutil
+import sys
+from pathlib import Path
+
+HERE = Path(__file__).resolve().parent
+
+
+def card(b, base):
+ """The same markup as the card() function in brushes.html."""
+ e = lambda s: html.escape(str(s), quote=True)
+ tags = "".join(f"<span>{e(t)}</span>" for t in b["tags"])
+ name = b["file"].rsplit("/", 1)[-1]
+ return (f' <article class="brush" data-tags="{e(" ".join(b["tags"]))}">'
+ f'<img src="{e(base + b["preview"])}" alt="{e(b["name"])} brush preview" width="512" height="384" loading="lazy">'
+ f'<div class="brush-body"><h3>{e(b["name"])}</h3><p class="by">by {e(b["author"])}</p>'
+ f'<p class="desc">{e(b["description"])}</p><p class="brush-tags">{tags}</p>'
+ f'<a class="btn small" href="{e(base + b["file"])}" download="{e(name)}" title="Download the .sfbrush file">Download</a></div></article>')
+
+
+def main():
+ gallery = Path(sys.argv[1]) if len(sys.argv) > 1 else HERE / "repo"
+ website = Path(sys.argv[2]) if len(sys.argv) > 2 else HERE.parents[1] / "website"
+ index = json.loads((gallery / "index.json").read_text(encoding="utf-8"))
+
+ out = website / "gallery"
+ if out.exists():
+ shutil.rmtree(out)
+ for sub in ("brushes", "previews"):
+ (out / sub).mkdir(parents=True)
+ for b in index["brushes"]:
+ shutil.copy2(gallery / b["file"], out / b["file"])
+ shutil.copy2(gallery / b["preview"], out / b["preview"])
+ shutil.copy2(gallery / "index.json", out / "index.json")
+
+ page = website / "brushes.html"
+ text = page.read_text(encoding="utf-8")
+ cards = "\n".join(card(b, "gallery/") for b in index["brushes"])
+ text, n = re.subn(r"(<!-- brushes:start[^>]*-->\n).*?(<!-- brushes:end -->)",
+ lambda m: m.group(1) + cards + "\n" + m.group(2), text, flags=re.S)
+ if n != 1:
+ sys.exit("error: brushes.html has no <!-- brushes:start --> ... <!-- brushes:end --> block")
+ text = re.sub(r"<!-- brushes:count -->.*?<!-- /brushes:count -->",
+ f"<!-- brushes:count -->{len(index['brushes'])} brushes<!-- /brushes:count -->", text)
+ page.write_text(text, encoding="utf-8")
+ print(f"{len(index['brushes'])} brushes -> {out} and {page}")
+
+
+if __name__ == "__main__":
+ main()
diff --git a/website/brushes.html b/website/brushes.html
new file mode 100644
index 00000000..35eed562
--- /dev/null
+++ b/website/brushes.html
@@ -0,0 +1,233 @@
+<!doctype html>
+<html lang="en">
+<head>
+ <meta charset="utf-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1">
+ <title>Community brushes - SculptForge</title>
+ <meta name="description" content="Free sculpting brushes for SculptForge, shared by the community under CC0. Install them in one click from the app or drag a .sfbrush file onto the window, and share your own.">
+ <meta name="theme-color" content="#111114">
+ <meta name="color-scheme" content="dark">
+ <link rel="icon" type="image/png" href="img/favicon-64.png">
+ <link rel="apple-touch-icon" href="img/icon-256.png">
+ <meta property="og:type" content="website">
+ <meta property="og:title" content="SculptForge community brushes">
+ <meta property="og:description" content="Free, CC0 sculpting brushes for SculptForge: scales, cracked earth, fabric folds, bark, pores, rope and more. Install in one click, share your own.">
+ <meta property="og:image" content="https://islandmed.github.io/SculptForge/gallery/previews/snake-scales.png">
+ <meta property="og:url" content="https://islandmed.github.io/SculptForge/brushes.html">
+ <meta name="twitter:card" content="summary_large_image">
+ <link rel="stylesheet" href="style.css?v=6">
+</head>
+<body>
+ <header class="nav">
+ <div class="wrap nav-inner">
+ <a class="brand" href="index.html"><img src="img/logo.svg" alt="" width="34" height="34"><span>SculptForge</span></a>
+ <nav aria-label="Main">
+ <a href="index.html#features">Features</a>
+ <a href="index.html#demos">Demos</a>
+ <a href="brushes.html" aria-current="page">Brushes</a>
+ <a class="nav-dl" href="index.html#download">Download</a>
+ <a href="https://github.com/islandmed/SculptForge#readme">Docs</a>
+ <a class="gh" href="https://github.com/islandmed/SculptForge">GitHub</a>
+ </nav>
+ </div>
+ </header>
+
+ <main id="top">
+ <section class="hero brushes-hero">
+ <div class="wrap">
+ <p class="eyebrow">Community brushes</p>
+ <h1>Brushes made by artists, <span class="accent">free for everyone.</span></h1>
+ <p class="lede">Sculpting brushes for SculptForge, shared by the people who made them and dedicated to the
+ public domain (CC0): use them in personal and commercial work. A brush is a small data file, never
+ code, so installing one is as safe as opening a text file.</p>
+ <div class="ctas">
+ <a class="btn primary" href="#gallery">Browse brushes</a>
+ <a class="btn" href="https://github.com/islandmed/sculptforge-brushes#share-your-brush">Share yours</a>
+ </div>
+ </div>
+ </section>
+
+ <section class="section alt" id="install">
+ <div class="wrap">
+ <h2>Install a brush</h2>
+ <div class="steps">
+ <div class="card">
+ <h3>From the app</h3>
+ <p>In SculptForge open <strong>View &gt; Community brushes</strong>, search or pick a tag, and click
+ <strong>Install</strong>. The brush is checked against the gallery's checksum, added to your library and
+ ready to sculpt with.</p>
+ </div>
+ <div class="card">
+ <h3>Drag the file</h3>
+ <p>Download any <code>.sfbrush</code> below and drag it onto the SculptForge window (or use Brush Lab's
+ <em>Load .sfbrush</em>). Studios can share a whole folder of brushes with
+ <code>SCULPTFORGE_BRUSH_PATH</code>.</p>
+ </div>
+ <div class="card">
+ <h3>Make your own</h3>
+ <p>Describe a brush to the AI brush creator in Brush Lab ("dry cracked mud", "a palette knife that drags
+ clay"), tune the recipe, then <a href="https://github.com/islandmed/sculptforge-brushes#share-your-brush">share
+ it</a> so everyone can use it.</p>
+ </div>
+ </div>
+ </div>
+ </section>
+
+ <section class="section" id="gallery">
+ <div class="wrap">
+ <div class="gallery-head">
+ <h2>The gallery</h2>
+ <p class="fine" id="gallery-count"><!-- brushes:count -->21 brushes<!-- /brushes:count --></p>
+ </div>
+ <div class="filters" hidden>
+ <input type="search" id="brush-search" placeholder="Search brushes (scales, skin, stone...)" aria-label="Search brushes">
+ <div class="tags" id="brush-tags" role="group" aria-label="Filter by tag"></div>
+ </div>
+ <div class="brush-grid" id="brush-grid">
+<!-- brushes:start (generated by tools/brush-gallery/sync_website.py) -->
+ <article class="brush" data-tags="stone environment weathering"><img src="gallery/previews/chipped-stone.png" alt="Chipped Stone brush preview" width="512" height="384" loading="lazy"><div class="brush-body"><h3>Chipped Stone</h3><p class="by">by SculptForge</p><p class="desc">Knocks rough, eroded chips into stone blocks, walls and cliffs.</p><p class="brush-tags"><span>stone</span><span>environment</span><span>weathering</span></p><a class="btn small" href="gallery/brushes/chipped-stone.sfbrush" download="chipped-stone.sfbrush" title="Download the .sfbrush file">Download</a></div></article>
+ <article class="brush" data-tags="clay blocking forms"><img src="gallery/previews/clay-buildup.png" alt="Clay Buildup brush preview" width="512" height="384" loading="lazy"><div class="brush-body"><h3>Clay Buildup</h3><p class="by">by SculptForge</p><p class="desc">Builds up flat-topped strokes of clay for blocking in forms.</p><p class="brush-tags"><span>clay</span><span>blocking</span><span>forms</span></p><a class="btn small" href="gallery/brushes/clay-buildup.sfbrush" download="clay-buildup.sfbrush" title="Download the .sfbrush file">Download</a></div></article>
+ <article class="brush" data-tags="environment ground cracks"><img src="gallery/previews/cracked-earth.png" alt="Cracked Earth brush preview" width="512" height="384" loading="lazy"><div class="brush-body"><h3>Cracked Earth</h3><p class="by">by SculptForge</p><p class="desc">Dry, cracked mud: flattens the ground and splits it into plates.</p><p class="brush-tags"><span>environment</span><span>ground</span><span>cracks</span></p><a class="btn small" href="gallery/brushes/cracked-earth.sfbrush" download="cracked-earth.sfbrush" title="Download the .sfbrush file">Download</a></div></article>
+ <article class="brush" data-tags="creature scales texture"><img src="gallery/previews/dragon-scales.png" alt="Dragon Scales brush preview" width="512" height="384" loading="lazy"><div class="brush-body"><h3>Dragon Scales</h3><p class="by">by SculptForge</p><p class="desc">Stamps rounded overlapping scales along the stroke.</p><p class="brush-tags"><span>creature</span><span>scales</span><span>texture</span></p><a class="btn small" href="gallery/brushes/dragon-scales.sfbrush" download="dragon-scales.sfbrush" title="Download the .sfbrush file">Download</a></div></article>
+ <article class="brush" data-tags="props weathering hard-surface"><img src="gallery/previews/edge-wear.png" alt="Edge Wear brush preview" width="512" height="384" loading="lazy"><div class="brush-body"><h3>Edge Wear</h3><p class="by">by SculptForge</p><p class="desc">Chips and softens only the sharp edges and ridges, for weathered props.</p><p class="brush-tags"><span>props</span><span>weathering</span><span>hard-surface</span></p><a class="btn small" href="gallery/brushes/edge-wear.sfbrush" download="edge-wear.sfbrush" title="Download the .sfbrush file">Download</a></div></article>
+ <article class="brush" data-tags="fabric clothing folds"><img src="gallery/previews/fabric-folds.png" alt="Fabric Folds brush preview" width="512" height="384" loading="lazy"><div class="brush-body"><h3>Fabric Folds</h3><p class="by">by SculptForge</p><p class="desc">Soft, rounded cloth folds with a crisp inner edge.</p><p class="brush-tags"><span>fabric</span><span>clothing</span><span>folds</span></p><a class="btn small" href="gallery/brushes/fabric-folds.sfbrush" download="fabric-folds.sfbrush" title="Download the .sfbrush file">Download</a></div></article>
+ <article class="brush" data-tags="metal props hard-surface"><img src="gallery/previews/hammered-metal.png" alt="Hammered Metal brush preview" width="512" height="384" loading="lazy"><div class="brush-body"><h3>Hammered Metal</h3><p class="by">by SculptForge</p><p class="desc">Soft overlapping hammer dimples for beaten copper, armour and cookware.</p><p class="brush-tags"><span>metal</span><span>props</span><span>hard-surface</span></p><a class="btn small" href="gallery/brushes/hammered-metal.sfbrush" download="hammered-metal.sfbrush" title="Download the .sfbrush file">Download</a></div></article>
+ <article class="brush" data-tags="stone environment texture"><img src="gallery/previews/lava-rock.png" alt="Lava Rock brush preview" width="512" height="384" loading="lazy"><div class="brush-body"><h3>Lava Rock</h3><p class="by">by SculptForge</p><p class="desc">Pitted, porous volcanic stone and pumice.</p><p class="brush-tags"><span>stone</span><span>environment</span><span>texture</span></p><a class="btn small" href="gallery/brushes/lava-rock.sfbrush" download="lava-rock.sfbrush" title="Download the .sfbrush file">Download</a></div></article>
+ <article class="brush" data-tags="skin texture character"><img src="gallery/previews/orange-peel.png" alt="Orange Peel brush preview" width="512" height="384" loading="lazy"><div class="brush-body"><h3>Orange Peel</h3><p class="by">by SculptForge</p><p class="desc">Dense dimpled skin like citrus peel, leather or older skin.</p><p class="brush-tags"><span>skin</span><span>texture</span><span>character</span></p><a class="btn small" href="gallery/brushes/orange-peel.sfbrush" download="orange-peel.sfbrush" title="Download the .sfbrush file">Download</a></div></article>
+ <article class="brush" data-tags="clay planes hard-surface"><img src="gallery/previews/palette-knife.png" alt="Palette Knife brush preview" width="512" height="384" loading="lazy"><div class="brush-body"><h3>Palette Knife</h3><p class="by">by SculptForge</p><p class="desc">Flattens and drags clay sideways like a sculptor&#x27;s knife.</p><p class="brush-tags"><span>clay</span><span>planes</span><span>hard-surface</span></p><a class="btn small" href="gallery/brushes/palette-knife.sfbrush" download="palette-knife.sfbrush" title="Download the .sfbrush file">Download</a></div></article>
+ <article class="brush" data-tags="hard-surface mech crease"><img src="gallery/previews/panel-line.png" alt="Panel Line brush preview" width="512" height="384" loading="lazy"><div class="brush-body"><h3>Panel Line</h3><p class="by">by SculptForge</p><p class="desc">Clean, narrow grooves for hard-surface panel seams.</p><p class="brush-tags"><span>hard-surface</span><span>mech</span><span>crease</span></p><a class="btn small" href="gallery/brushes/panel-line.sfbrush" download="panel-line.sfbrush" title="Download the .sfbrush file">Download</a></div></article>
+ <article class="brush" data-tags="wood stone texture"><img src="gallery/previews/rasp.png" alt="Rasp brush preview" width="512" height="384" loading="lazy"><div class="brush-body"><h3>Rasp</h3><p class="by">by SculptForge</p><p class="desc">Coarse file and rasp marks for carved wood, stone and rough castings.</p><p class="brush-tags"><span>wood</span><span>stone</span><span>texture</span></p><a class="btn small" href="gallery/brushes/rasp.sfbrush" download="rasp.sfbrush" title="Download the .sfbrush file">Download</a></div></article>
+ <article class="brush" data-tags="props fabric cord"><img src="gallery/previews/rope.png" alt="Rope brush preview" width="512" height="384" loading="lazy"><div class="brush-body"><h3>Rope</h3><p class="by">by SculptForge</p><p class="desc">A raised, knotted cord for ropes, braids and cables.</p><p class="brush-tags"><span>props</span><span>fabric</span><span>cord</span></p><a class="btn small" href="gallery/brushes/rope.sfbrush" download="rope.sfbrush" title="Download the .sfbrush file">Download</a></div></article>
+ <article class="brush" data-tags="clay blocking texture"><img src="gallery/previews/rough-clay.png" alt="Rough Clay brush preview" width="512" height="384" loading="lazy"><div class="brush-body"><h3>Rough Clay</h3><p class="by">by SculptForge</p><p class="desc">Lumpy, hand-pressed clay for a traditional sculpted look.</p><p class="brush-tags"><span>clay</span><span>blocking</span><span>texture</span></p><a class="btn small" href="gallery/brushes/rough-clay.sfbrush" download="rough-clay.sfbrush" title="Download the .sfbrush file">Download</a></div></article>
+ <article class="brush" data-tags="skin character creature"><img src="gallery/previews/scar-tissue.png" alt="Scar Tissue brush preview" width="512" height="384" loading="lazy"><div class="brush-body"><h3>Scar Tissue</h3><p class="by">by SculptForge</p><p class="desc">Raised, puckered scars and healed wounds.</p><p class="brush-tags"><span>skin</span><span>character</span><span>creature</span></p><a class="btn small" href="gallery/brushes/scar-tissue.sfbrush" download="scar-tissue.sfbrush" title="Download the .sfbrush file">Download</a></div></article>
+ <article class="brush" data-tags="skin texture character"><img src="gallery/previews/skin-pores.png" alt="Skin Pores brush preview" width="512" height="384" loading="lazy"><div class="brush-body"><h3>Skin Pores</h3><p class="by">by SculptForge</p><p class="desc">Sprinkles tiny pores for close-up skin detail.</p><p class="brush-tags"><span>skin</span><span>texture</span><span>character</span></p><a class="btn small" href="gallery/brushes/skin-pores.sfbrush" download="skin-pores.sfbrush" title="Download the .sfbrush file">Download</a></div></article>
+ <article class="brush" data-tags="creature scales texture"><img src="gallery/previews/snake-scales.png" alt="Snake Scales brush preview" width="512" height="384" loading="lazy"><div class="brush-body"><h3>Snake Scales</h3><p class="by">by SculptForge</p><p class="desc">Tight rows of small, smooth scales for snakes, lizards and fish.</p><p class="brush-tags"><span>creature</span><span>scales</span><span>texture</span></p><a class="btn small" href="gallery/brushes/snake-scales.sfbrush" download="snake-scales.sfbrush" title="Download the .sfbrush file">Download</a></div></article>
+ <article class="brush" data-tags="stone environment hard-surface"><img src="gallery/previews/stone-chisel.png" alt="Stone Chisel brush preview" width="512" height="384" loading="lazy"><div class="brush-body"><h3>Stone Chisel</h3><p class="by">by SculptForge</p><p class="desc">Scrapes hard planes and breaks them up with cracks for rocks and ruins.</p><p class="brush-tags"><span>stone</span><span>environment</span><span>hard-surface</span></p><a class="btn small" href="gallery/brushes/stone-chisel.sfbrush" download="stone-chisel.sfbrush" title="Download the .sfbrush file">Download</a></div></article>
+ <article class="brush" data-tags="environment wood texture"><img src="gallery/previews/tree-bark.png" alt="Tree Bark brush preview" width="512" height="384" loading="lazy"><div class="brush-body"><h3>Tree Bark</h3><p class="by">by SculptForge</p><p class="desc">Deep, sinewy bark ridges for trunks, roots and old wood.</p><p class="brush-tags"><span>environment</span><span>wood</span><span>texture</span></p><a class="btn small" href="gallery/brushes/tree-bark.sfbrush" download="tree-bark.sfbrush" title="Download the .sfbrush file">Download</a></div></article>
+ <article class="brush" data-tags="skin anatomy character"><img src="gallery/previews/veins.png" alt="Veins brush preview" width="512" height="384" loading="lazy"><div class="brush-body"><h3>Veins</h3><p class="by">by SculptForge</p><p class="desc">Soft raised veins and tendons under the skin.</p><p class="brush-tags"><span>skin</span><span>anatomy</span><span>character</span></p><a class="btn small" href="gallery/brushes/veins.sfbrush" download="veins.sfbrush" title="Download the .sfbrush file">Download</a></div></article>
+ <article class="brush" data-tags="skin fabric crease"><img src="gallery/previews/wrinkle.png" alt="Wrinkle brush preview" width="512" height="384" loading="lazy"><div class="brush-body"><h3>Wrinkle</h3><p class="by">by SculptForge</p><p class="desc">Fine, sharp creases for skin folds and fabric wrinkles.</p><p class="brush-tags"><span>skin</span><span>fabric</span><span>crease</span></p><a class="btn small" href="gallery/brushes/wrinkle.sfbrush" download="wrinkle.sfbrush" title="Download the .sfbrush file">Download</a></div></article>
+<!-- brushes:end -->
+ </div>
+ <p class="empty" id="brush-empty" hidden>No brushes match your search.</p>
+ </div>
+ </section>
+
+ <section class="section alt" id="share">
+ <div class="wrap two-col">
+ <div>
+ <h2>Share your brush</h2>
+ <p class="section-lede">The gallery is a GitHub repository. Add your <code>.sfbrush</code> and a preview
+ image in a pull request; a check loads your brush in SculptForge and tells you if anything needs fixing.
+ Once merged, it shows up in everyone's Community brushes window.</p>
+ <div class="ctas">
+ <a class="btn primary" href="https://github.com/islandmed/sculptforge-brushes#share-your-brush">How to share</a>
+ <a class="btn" href="https://github.com/islandmed/SculptForge/blob/main/docs/brushes.md">Brush guide</a>
+ </div>
+ </div>
+ <div>
+ <ul class="checks">
+ <li><strong>Data only.</strong> Brushes are recipe parameters, never scripts or code.</li>
+ <li><strong>Your own work, shared as CC0</strong>, so anyone can use it anywhere.</li>
+ <li><strong>Matching previews.</strong> <code>render_previews.py</code> sculpts the same sphere for every
+ brush, so the gallery reads as one set.</li>
+ <li><strong>Checked downloads.</strong> The app verifies each brush's SHA-256 before installing it.</li>
+ </ul>
+ </div>
+ </div>
+ </section>
+ </main>
+
+ <footer class="footer">
+ <div class="wrap footer-grid">
+ <div>
+ <a class="brand" href="index.html"><img src="img/logo.svg" alt="" width="28" height="28"><span>SculptForge</span></a>
+ <p class="fine">Copyright © 2026 The SculptForge contributors. SculptForge is licensed under the
+ <a href="https://github.com/islandmed/SculptForge/blob/main/LICENSE">GNU GPL v3.0 or later</a>; community
+ brushes and their previews are <a href="https://creativecommons.org/publicdomain/zero/1.0/">CC0</a>.</p>
+ </div>
+ <div class="links">
+ <a href="https://github.com/islandmed/sculptforge-brushes">Gallery repository</a>
+ <a href="https://github.com/islandmed/SculptForge">Source code</a>
+ <a href="https://github.com/islandmed/SculptForge/blob/main/CODE_OF_CONDUCT.md">Code of conduct</a>
+ </div>
+ <p class="fine trademarks">SculptForge is an independent project, not affiliated with or endorsed by Maxon.
+ ZBrush is a trademark of Maxon. The site uses the Inter typeface (SIL Open Font License), self-hosted, with
+ no trackers and no cookies.</p>
+ </div>
+ </footer>
+ <script>
+ // Search and tag filters over the cards. The cards above come from the snapshot bundled with the site;
+ // if the live gallery index is reachable, newer brushes from it replace them.
+ (() => {
+ const LIVE = "https://raw.githubusercontent.com/islandmed/sculptforge-brushes/main/";
+ const grid = document.getElementById("brush-grid");
+ const search = document.getElementById("brush-search");
+ const tagBox = document.getElementById("brush-tags");
+ const empty = document.getElementById("brush-empty");
+ const count = document.getElementById("gallery-count");
+ let tag = "";
+
+ const el = (name, attrs = {}, text) => {
+ const e = document.createElement(name);
+ for (const [k, v] of Object.entries(attrs)) e.setAttribute(k, v);
+ if (text !== undefined) e.textContent = text;
+ return e;
+ };
+ // Same markup as sync_website.py writes.
+ const card = (b, base) => {
+ const c = el("article", { class: "brush", "data-tags": b.tags.join(" ") });
+ c.append(el("img", { src: base + b.preview, alt: b.name + " brush preview", width: 512, height: 384, loading: "lazy" }));
+ const body = el("div", { class: "brush-body" });
+ body.append(el("h3", {}, b.name), el("p", { class: "by" }, "by " + b.author), el("p", { class: "desc" }, b.description));
+ const tags = el("p", { class: "brush-tags" });
+ for (const t of b.tags) tags.append(el("span", {}, t));
+ body.append(tags, el("a", { class: "btn small", href: base + b.file, download: b.file.split("/").pop(), title: "Download the .sfbrush file" }, "Download"));
+ c.append(body);
+ return c;
+ };
+ const cards = () => [...grid.querySelectorAll(".brush")];
+ const apply = () => {
+ const words = search.value.toLowerCase().split(/\s+/).filter(Boolean);
+ let shown = 0;
+ for (const c of cards()) {
+ const text = c.textContent.toLowerCase();
+ const ok = (!tag || c.dataset.tags.split(" ").includes(tag)) && words.every((w) => text.includes(w));
+ c.hidden = !ok;
+ shown += ok;
+ }
+ const total = cards().length;
+ count.textContent = shown === total ? `${total} brushes` : `${shown} of ${total} brushes`;
+ empty.hidden = shown > 0;
+ };
+ const buildTags = () => {
+ const n = {};
+ for (const c of cards()) for (const t of c.dataset.tags.split(" ")) n[t] = (n[t] || 0) + 1;
+ tagBox.replaceChildren();
+ // The most used tags (and the selected one); search finds the rest.
+ const top = Object.keys(n).sort((a, b) => n[b] - n[a] || a.localeCompare(b)).slice(0, 12);
+ if (tag && !top.includes(tag)) top.push(tag);
+ const names = ["", ...top];
+ for (const t of names) {
+ const b = el("button", { type: "button", "aria-pressed": String(t === tag) }, t || "All");
+ b.addEventListener("click", () => { tag = t; buildTags(); apply(); });
+ tagBox.append(b);
+ }
+ };
+ document.querySelector(".filters").hidden = false;
+ search.addEventListener("input", apply);
+ buildTags();
+ apply();
+
+ fetch(LIVE + "index.json", { cache: "no-cache" })
+ .then((r) => (r.ok ? r.json() : Promise.reject()))
+ .then((index) => {
+ if (index.format !== "sculptforge-brush-gallery" || !Array.isArray(index.brushes) || !index.brushes.length) return;
+ grid.replaceChildren(...index.brushes.map((b) => card(b, LIVE)));
+ buildTags();
+ apply();
+ })
+ .catch(() => {}); // offline or not published yet: the bundled snapshot stays
+ })();
+ </script>
+</body>
+</html>
diff --git a/website/gallery/brushes/chipped-stone.sfbrush b/website/gallery/brushes/chipped-stone.sfbrush
new file mode 100644
index 00000000..538126cb
--- /dev/null
+++ b/website/gallery/brushes/chipped-stone.sfbrush
@@ -0,0 +1,29 @@
+{
+ "name": "Chipped Stone",
+ "description": "Knocks rough, eroded chips into stone blocks, walls and cliffs.",
+ "direction": "normal",
+ "depth": -0.7,
+ "plane": "flatten",
+ "planeAmount": 0.6,
+ "pinch": 0,
+ "drag": 0,
+ "smooth": 0,
+ "hardness": 0.85,
+ "tipSharpness": 0,
+ "pattern": "noise",
+ "patternScale": 0.35,
+ "patternAmount": 0.9,
+ "spacing": 0.3,
+ "jitter": 0.3,
+ "pressureCurve": 1,
+ "frontFacesOnly": false,
+ "cavityMask": 0,
+ "author": "SculptForge",
+ "tags": [
+ "stone",
+ "environment",
+ "weathering"
+ ],
+ "format": "sfbrush",
+ "version": 1
+}
diff --git a/website/gallery/brushes/clay-buildup.sfbrush b/website/gallery/brushes/clay-buildup.sfbrush
new file mode 100644
index 00000000..6e50755d
--- /dev/null
+++ b/website/gallery/brushes/clay-buildup.sfbrush
@@ -0,0 +1,29 @@
+{
+ "name": "Clay Buildup",
+ "description": "Builds up flat-topped strokes of clay for blocking in forms.",
+ "direction": "normal",
+ "depth": 0.3,
+ "plane": "clay",
+ "planeAmount": 0.7,
+ "pinch": 0,
+ "drag": 0,
+ "smooth": 0.1,
+ "hardness": 0.35,
+ "tipSharpness": 0,
+ "pattern": "none",
+ "patternScale": 0.3,
+ "patternAmount": 0,
+ "spacing": 0.15,
+ "jitter": 0,
+ "pressureCurve": 1,
+ "frontFacesOnly": false,
+ "cavityMask": 0,
+ "author": "SculptForge",
+ "tags": [
+ "clay",
+ "blocking",
+ "forms"
+ ],
+ "format": "sfbrush",
+ "version": 1
+}
diff --git a/website/gallery/brushes/cracked-earth.sfbrush b/website/gallery/brushes/cracked-earth.sfbrush
new file mode 100644
index 00000000..404b69b7
--- /dev/null
+++ b/website/gallery/brushes/cracked-earth.sfbrush
@@ -0,0 +1,29 @@
+{
+ "name": "Cracked Earth",
+ "description": "Dry, cracked mud: flattens the ground and splits it into plates.",
+ "direction": "normal",
+ "depth": -0.25,
+ "plane": "flatten",
+ "planeAmount": 0.5,
+ "pinch": 0,
+ "drag": 0,
+ "smooth": 0,
+ "hardness": 0.8,
+ "tipSharpness": 0,
+ "pattern": "cracks",
+ "patternScale": 0.7,
+ "patternAmount": 1.0,
+ "spacing": 0.2,
+ "jitter": 0,
+ "pressureCurve": 1,
+ "frontFacesOnly": false,
+ "cavityMask": 0,
+ "author": "SculptForge",
+ "tags": [
+ "environment",
+ "ground",
+ "cracks"
+ ],
+ "format": "sfbrush",
+ "version": 1
+}
diff --git a/website/gallery/brushes/dragon-scales.sfbrush b/website/gallery/brushes/dragon-scales.sfbrush
new file mode 100644
index 00000000..e36b1ebe
--- /dev/null
+++ b/website/gallery/brushes/dragon-scales.sfbrush
@@ -0,0 +1,29 @@
+{
+ "name": "Dragon Scales",
+ "description": "Stamps rounded overlapping scales along the stroke.",
+ "direction": "normal",
+ "depth": 0.45,
+ "plane": "none",
+ "planeAmount": 0.5,
+ "pinch": 0,
+ "drag": 0,
+ "smooth": 0,
+ "hardness": 0.35,
+ "tipSharpness": 0,
+ "pattern": "scales",
+ "patternScale": 0.35,
+ "patternAmount": 0.95,
+ "spacing": 0.35,
+ "jitter": 0,
+ "pressureCurve": 1,
+ "frontFacesOnly": false,
+ "cavityMask": 0,
+ "author": "SculptForge",
+ "tags": [
+ "creature",
+ "scales",
+ "texture"
+ ],
+ "format": "sfbrush",
+ "version": 1
+}
diff --git a/website/gallery/brushes/edge-wear.sfbrush b/website/gallery/brushes/edge-wear.sfbrush
new file mode 100644
index 00000000..76c33a31
--- /dev/null
+++ b/website/gallery/brushes/edge-wear.sfbrush
@@ -0,0 +1,29 @@
+{
+ "name": "Edge Wear",
+ "description": "Chips and softens only the sharp edges and ridges, for weathered props.",
+ "direction": "normal",
+ "depth": -0.35,
+ "plane": "none",
+ "planeAmount": 0.5,
+ "pinch": 0,
+ "drag": 0,
+ "smooth": 0,
+ "hardness": 0.4,
+ "tipSharpness": 0,
+ "pattern": "noise",
+ "patternScale": 0.25,
+ "patternAmount": 0.7,
+ "spacing": 0.15,
+ "jitter": 0,
+ "pressureCurve": 1,
+ "frontFacesOnly": false,
+ "cavityMask": -0.8,
+ "author": "SculptForge",
+ "tags": [
+ "props",
+ "weathering",
+ "hard-surface"
+ ],
+ "format": "sfbrush",
+ "version": 1
+}
diff --git a/website/gallery/brushes/fabric-folds.sfbrush b/website/gallery/brushes/fabric-folds.sfbrush
new file mode 100644
index 00000000..8bb4be8e
--- /dev/null
+++ b/website/gallery/brushes/fabric-folds.sfbrush
@@ -0,0 +1,29 @@
+{
+ "name": "Fabric Folds",
+ "description": "Soft, rounded cloth folds with a crisp inner edge.",
+ "direction": "normal",
+ "depth": 0.55,
+ "plane": "none",
+ "planeAmount": 0.5,
+ "pinch": 0.45,
+ "drag": 0.15,
+ "smooth": 0.25,
+ "hardness": 0.1,
+ "tipSharpness": 0.25,
+ "pattern": "none",
+ "patternScale": 0.3,
+ "patternAmount": 0,
+ "spacing": 0.05,
+ "jitter": 0,
+ "pressureCurve": 1,
+ "frontFacesOnly": false,
+ "cavityMask": 0,
+ "author": "SculptForge",
+ "tags": [
+ "fabric",
+ "clothing",
+ "folds"
+ ],
+ "format": "sfbrush",
+ "version": 1
+}
diff --git a/website/gallery/brushes/hammered-metal.sfbrush b/website/gallery/brushes/hammered-metal.sfbrush
new file mode 100644
index 00000000..160bf1f7
--- /dev/null
+++ b/website/gallery/brushes/hammered-metal.sfbrush
@@ -0,0 +1,29 @@
+{
+ "name": "Hammered Metal",
+ "description": "Soft overlapping hammer dimples for beaten copper, armour and cookware.",
+ "direction": "normal",
+ "depth": -1.0,
+ "plane": "flatten",
+ "planeAmount": 1.0,
+ "pinch": 0,
+ "drag": 0,
+ "smooth": 0,
+ "hardness": 0.0,
+ "tipSharpness": 0,
+ "pattern": "none",
+ "patternScale": 0.3,
+ "patternAmount": 0,
+ "spacing": 0.45,
+ "jitter": 1.0,
+ "pressureCurve": 1,
+ "frontFacesOnly": false,
+ "cavityMask": 0,
+ "author": "SculptForge",
+ "tags": [
+ "metal",
+ "props",
+ "hard-surface"
+ ],
+ "format": "sfbrush",
+ "version": 1
+}
diff --git a/website/gallery/brushes/lava-rock.sfbrush b/website/gallery/brushes/lava-rock.sfbrush
new file mode 100644
index 00000000..a630c763
--- /dev/null
+++ b/website/gallery/brushes/lava-rock.sfbrush
@@ -0,0 +1,29 @@
+{
+ "name": "Lava Rock",
+ "description": "Pitted, porous volcanic stone and pumice.",
+ "direction": "normal",
+ "depth": -0.8,
+ "plane": "none",
+ "planeAmount": 0.5,
+ "pinch": 0,
+ "drag": 0,
+ "smooth": 0,
+ "hardness": 0.5,
+ "tipSharpness": 0,
+ "pattern": "pores",
+ "patternScale": 0.3,
+ "patternAmount": 1.0,
+ "spacing": 0.08,
+ "jitter": 0.4,
+ "pressureCurve": 1,
+ "frontFacesOnly": false,
+ "cavityMask": 0,
+ "author": "SculptForge",
+ "tags": [
+ "stone",
+ "environment",
+ "texture"
+ ],
+ "format": "sfbrush",
+ "version": 1
+}
diff --git a/website/gallery/brushes/orange-peel.sfbrush b/website/gallery/brushes/orange-peel.sfbrush
new file mode 100644
index 00000000..4f0cb6d6
--- /dev/null
+++ b/website/gallery/brushes/orange-peel.sfbrush
@@ -0,0 +1,29 @@
+{
+ "name": "Orange Peel",
+ "description": "Dense dimpled skin like citrus peel, leather or older skin.",
+ "direction": "normal",
+ "depth": -0.4,
+ "plane": "none",
+ "planeAmount": 0.5,
+ "pinch": 0,
+ "drag": 0,
+ "smooth": 0,
+ "hardness": 0.3,
+ "tipSharpness": 0,
+ "pattern": "pores",
+ "patternScale": 0.12,
+ "patternAmount": 1.0,
+ "spacing": 0.12,
+ "jitter": 0.5,
+ "pressureCurve": 1,
+ "frontFacesOnly": false,
+ "cavityMask": 0,
+ "author": "SculptForge",
+ "tags": [
+ "skin",
+ "texture",
+ "character"
+ ],
+ "format": "sfbrush",
+ "version": 1
+}
diff --git a/website/gallery/brushes/palette-knife.sfbrush b/website/gallery/brushes/palette-knife.sfbrush
new file mode 100644
index 00000000..7c2ccc01
--- /dev/null
+++ b/website/gallery/brushes/palette-knife.sfbrush
@@ -0,0 +1,29 @@
+{
+ "name": "Palette Knife",
+ "description": "Flattens and drags clay sideways like a sculptor's knife.",
+ "direction": "normal",
+ "depth": 0,
+ "plane": "flatten",
+ "planeAmount": 0.8,
+ "pinch": 0,
+ "drag": 0.6,
+ "smooth": 0,
+ "hardness": 0.75,
+ "tipSharpness": 0,
+ "pattern": "none",
+ "patternScale": 0.3,
+ "patternAmount": 0,
+ "spacing": 0.1,
+ "jitter": 0,
+ "pressureCurve": 1,
+ "frontFacesOnly": false,
+ "cavityMask": 0,
+ "author": "SculptForge",
+ "tags": [
+ "clay",
+ "planes",
+ "hard-surface"
+ ],
+ "format": "sfbrush",
+ "version": 1
+}
diff --git a/website/gallery/brushes/panel-line.sfbrush b/website/gallery/brushes/panel-line.sfbrush
new file mode 100644
index 00000000..943f79d5
--- /dev/null
+++ b/website/gallery/brushes/panel-line.sfbrush
@@ -0,0 +1,29 @@
+{
+ "name": "Panel Line",
+ "description": "Clean, narrow grooves for hard-surface panel seams.",
+ "direction": "normal",
+ "depth": -0.6,
+ "plane": "none",
+ "planeAmount": 0.5,
+ "pinch": 0.35,
+ "drag": 0,
+ "smooth": 0,
+ "hardness": 0.3,
+ "tipSharpness": 1.0,
+ "pattern": "none",
+ "patternScale": 0.3,
+ "patternAmount": 0,
+ "spacing": 0.1,
+ "jitter": 0,
+ "pressureCurve": 1,
+ "frontFacesOnly": false,
+ "cavityMask": 0,
+ "author": "SculptForge",
+ "tags": [
+ "hard-surface",
+ "mech",
+ "crease"
+ ],
+ "format": "sfbrush",
+ "version": 1
+}
diff --git a/website/gallery/brushes/rasp.sfbrush b/website/gallery/brushes/rasp.sfbrush
new file mode 100644
index 00000000..8ec61cc1
--- /dev/null
+++ b/website/gallery/brushes/rasp.sfbrush
@@ -0,0 +1,29 @@
+{
+ "name": "Rasp",
+ "description": "Coarse file and rasp marks for carved wood, stone and rough castings.",
+ "direction": "normal",
+ "depth": -0.3,
+ "plane": "none",
+ "planeAmount": 0.5,
+ "pinch": 0,
+ "drag": 0.4,
+ "smooth": 0,
+ "hardness": 0.5,
+ "tipSharpness": 0,
+ "pattern": "ridges",
+ "patternScale": 0.25,
+ "patternAmount": 0.8,
+ "spacing": 0.05,
+ "jitter": 0,
+ "pressureCurve": 1,
+ "frontFacesOnly": false,
+ "cavityMask": 0,
+ "author": "SculptForge",
+ "tags": [
+ "wood",
+ "stone",
+ "texture"
+ ],
+ "format": "sfbrush",
+ "version": 1
+}
diff --git a/website/gallery/brushes/rope.sfbrush b/website/gallery/brushes/rope.sfbrush
new file mode 100644
index 00000000..7d49e1db
--- /dev/null
+++ b/website/gallery/brushes/rope.sfbrush
@@ -0,0 +1,29 @@
+{
+ "name": "Rope",
+ "description": "A raised, knotted cord for ropes, braids and cables.",
+ "direction": "normal",
+ "depth": 0.7,
+ "plane": "none",
+ "planeAmount": 0.5,
+ "pinch": 0,
+ "drag": 0,
+ "smooth": 0.1,
+ "hardness": 0.5,
+ "tipSharpness": 0,
+ "pattern": "scales",
+ "patternScale": 0.5,
+ "patternAmount": 0.6,
+ "spacing": 0.05,
+ "jitter": 0,
+ "pressureCurve": 1,
+ "frontFacesOnly": false,
+ "cavityMask": 0,
+ "author": "SculptForge",
+ "tags": [
+ "props",
+ "fabric",
+ "cord"
+ ],
+ "format": "sfbrush",
+ "version": 1
+}
diff --git a/website/gallery/brushes/rough-clay.sfbrush b/website/gallery/brushes/rough-clay.sfbrush
new file mode 100644
index 00000000..6da8e0e5
--- /dev/null
+++ b/website/gallery/brushes/rough-clay.sfbrush
@@ -0,0 +1,29 @@
+{
+ "name": "Rough Clay",
+ "description": "Lumpy, hand-pressed clay for a traditional sculpted look.",
+ "direction": "normal",
+ "depth": 0.4,
+ "plane": "clay",
+ "planeAmount": 0.4,
+ "pinch": 0,
+ "drag": 0,
+ "smooth": 0,
+ "hardness": 0.4,
+ "tipSharpness": 0,
+ "pattern": "noise",
+ "patternScale": 0.45,
+ "patternAmount": 0.75,
+ "spacing": 0.2,
+ "jitter": 0.4,
+ "pressureCurve": 1,
+ "frontFacesOnly": false,
+ "cavityMask": 0,
+ "author": "SculptForge",
+ "tags": [
+ "clay",
+ "blocking",
+ "texture"
+ ],
+ "format": "sfbrush",
+ "version": 1
+}
diff --git a/website/gallery/brushes/scar-tissue.sfbrush b/website/gallery/brushes/scar-tissue.sfbrush
new file mode 100644
index 00000000..87c75fb1
--- /dev/null
+++ b/website/gallery/brushes/scar-tissue.sfbrush
@@ -0,0 +1,29 @@
+{
+ "name": "Scar Tissue",
+ "description": "Raised, puckered scars and healed wounds.",
+ "direction": "normal",
+ "depth": 0.4,
+ "plane": "none",
+ "planeAmount": 0.5,
+ "pinch": 0.6,
+ "drag": 0,
+ "smooth": 0.15,
+ "hardness": 0.2,
+ "tipSharpness": 0.3,
+ "pattern": "ridges",
+ "patternScale": 0.25,
+ "patternAmount": 0.25,
+ "spacing": 0.05,
+ "jitter": 0,
+ "pressureCurve": 1,
+ "frontFacesOnly": false,
+ "cavityMask": 0,
+ "author": "SculptForge",
+ "tags": [
+ "skin",
+ "character",
+ "creature"
+ ],
+ "format": "sfbrush",
+ "version": 1
+}
diff --git a/website/gallery/brushes/skin-pores.sfbrush b/website/gallery/brushes/skin-pores.sfbrush
new file mode 100644
index 00000000..7e129903
--- /dev/null
+++ b/website/gallery/brushes/skin-pores.sfbrush
@@ -0,0 +1,29 @@
+{
+ "name": "Skin Pores",
+ "description": "Sprinkles tiny pores for close-up skin detail.",
+ "direction": "normal",
+ "depth": -0.2,
+ "plane": "none",
+ "planeAmount": 0.5,
+ "pinch": 0,
+ "drag": 0,
+ "smooth": 0,
+ "hardness": 0,
+ "tipSharpness": 0,
+ "pattern": "pores",
+ "patternScale": 0.08,
+ "patternAmount": 1,
+ "spacing": 0.3,
+ "jitter": 0.3,
+ "pressureCurve": 1,
+ "frontFacesOnly": true,
+ "cavityMask": 0,
+ "author": "SculptForge",
+ "tags": [
+ "skin",
+ "texture",
+ "character"
+ ],
+ "format": "sfbrush",
+ "version": 1
+}
diff --git a/website/gallery/brushes/snake-scales.sfbrush b/website/gallery/brushes/snake-scales.sfbrush
new file mode 100644
index 00000000..9aa35829
--- /dev/null
+++ b/website/gallery/brushes/snake-scales.sfbrush
@@ -0,0 +1,29 @@
+{
+ "name": "Snake Scales",
+ "description": "Tight rows of small, smooth scales for snakes, lizards and fish.",
+ "direction": "normal",
+ "depth": 0.35,
+ "plane": "none",
+ "planeAmount": 0.5,
+ "pinch": 0,
+ "drag": 0,
+ "smooth": 0,
+ "hardness": 0.55,
+ "tipSharpness": 0,
+ "pattern": "scales",
+ "patternScale": 0.18,
+ "patternAmount": 1.0,
+ "spacing": 0.2,
+ "jitter": 0,
+ "pressureCurve": 1,
+ "frontFacesOnly": false,
+ "cavityMask": 0,
+ "author": "SculptForge",
+ "tags": [
+ "creature",
+ "scales",
+ "texture"
+ ],
+ "format": "sfbrush",
+ "version": 1
+}
diff --git a/website/gallery/brushes/stone-chisel.sfbrush b/website/gallery/brushes/stone-chisel.sfbrush
new file mode 100644
index 00000000..ef2e05bd
--- /dev/null
+++ b/website/gallery/brushes/stone-chisel.sfbrush
@@ -0,0 +1,29 @@
+{
+ "name": "Stone Chisel",
+ "description": "Scrapes hard planes and breaks them up with cracks for rocks and ruins.",
+ "direction": "normal",
+ "depth": -0.25,
+ "plane": "scrape",
+ "planeAmount": 0.8,
+ "pinch": 0,
+ "drag": 0,
+ "smooth": 0,
+ "hardness": 0.85,
+ "tipSharpness": 0,
+ "pattern": "cracks",
+ "patternScale": 0.45,
+ "patternAmount": 0.6,
+ "spacing": 0.15,
+ "jitter": 0,
+ "pressureCurve": 1,
+ "frontFacesOnly": false,
+ "cavityMask": 0,
+ "author": "SculptForge",
+ "tags": [
+ "stone",
+ "environment",
+ "hard-surface"
+ ],
+ "format": "sfbrush",
+ "version": 1
+}
diff --git a/website/gallery/brushes/tree-bark.sfbrush b/website/gallery/brushes/tree-bark.sfbrush
new file mode 100644
index 00000000..0131e61d
--- /dev/null
+++ b/website/gallery/brushes/tree-bark.sfbrush
@@ -0,0 +1,29 @@
+{
+ "name": "Tree Bark",
+ "description": "Deep, sinewy bark ridges for trunks, roots and old wood.",
+ "direction": "normal",
+ "depth": 0.4,
+ "plane": "none",
+ "planeAmount": 0.5,
+ "pinch": 0,
+ "drag": 0,
+ "smooth": 0,
+ "hardness": 0.5,
+ "tipSharpness": 0,
+ "pattern": "ridges",
+ "patternScale": 0.3,
+ "patternAmount": 1.0,
+ "spacing": 0.12,
+ "jitter": 0.15,
+ "pressureCurve": 1,
+ "frontFacesOnly": false,
+ "cavityMask": 0,
+ "author": "SculptForge",
+ "tags": [
+ "environment",
+ "wood",
+ "texture"
+ ],
+ "format": "sfbrush",
+ "version": 1
+}
diff --git a/website/gallery/brushes/veins.sfbrush b/website/gallery/brushes/veins.sfbrush
new file mode 100644
index 00000000..8baad31d
--- /dev/null
+++ b/website/gallery/brushes/veins.sfbrush
@@ -0,0 +1,29 @@
+{
+ "name": "Veins",
+ "description": "Soft raised veins and tendons under the skin.",
+ "direction": "normal",
+ "depth": 0.45,
+ "plane": "none",
+ "planeAmount": 0.5,
+ "pinch": 0.3,
+ "drag": 0,
+ "smooth": 0.35,
+ "hardness": 0.1,
+ "tipSharpness": 0.8,
+ "pattern": "none",
+ "patternScale": 0.3,
+ "patternAmount": 0,
+ "spacing": 0.05,
+ "jitter": 0,
+ "pressureCurve": 1,
+ "frontFacesOnly": true,
+ "cavityMask": 0,
+ "author": "SculptForge",
+ "tags": [
+ "skin",
+ "anatomy",
+ "character"
+ ],
+ "format": "sfbrush",
+ "version": 1
+}
diff --git a/website/gallery/brushes/wrinkle.sfbrush b/website/gallery/brushes/wrinkle.sfbrush
new file mode 100644
index 00000000..a8fa5683
--- /dev/null
+++ b/website/gallery/brushes/wrinkle.sfbrush
@@ -0,0 +1,29 @@
+{
+ "name": "Wrinkle",
+ "description": "Fine, sharp creases for skin folds and fabric wrinkles.",
+ "direction": "normal",
+ "depth": -0.55,
+ "plane": "none",
+ "planeAmount": 0.5,
+ "pinch": 0.7,
+ "drag": 0,
+ "smooth": 0,
+ "hardness": 0.15,
+ "tipSharpness": 0.7,
+ "pattern": "none",
+ "patternScale": 0.3,
+ "patternAmount": 0,
+ "spacing": 0.06,
+ "jitter": 0,
+ "pressureCurve": 1,
+ "frontFacesOnly": false,
+ "cavityMask": 0,
+ "author": "SculptForge",
+ "tags": [
+ "skin",
+ "fabric",
+ "crease"
+ ],
+ "format": "sfbrush",
+ "version": 1
+}
diff --git a/website/gallery/index.json b/website/gallery/index.json
new file mode 100644
index 00000000..af560083
--- /dev/null
+++ b/website/gallery/index.json
@@ -0,0 +1,300 @@
+{
+ "format": "sculptforge-brush-gallery",
+ "version": 1,
+ "brushes": [
+ {
+ "name": "Chipped Stone",
+ "description": "Knocks rough, eroded chips into stone blocks, walls and cliffs.",
+ "author": "SculptForge",
+ "tags": [
+ "stone",
+ "environment",
+ "weathering"
+ ],
+ "file": "brushes/chipped-stone.sfbrush",
+ "preview": "previews/chipped-stone.png",
+ "sha256": "c7ffc468725fbd5efd7b3ae1c7d270fb63be7a2cb24547bae99f62366072e4ae",
+ "added": "2026-10-22"
+ },
+ {
+ "name": "Clay Buildup",
+ "description": "Builds up flat-topped strokes of clay for blocking in forms.",
+ "author": "SculptForge",
+ "tags": [
+ "clay",
+ "blocking",
+ "forms"
+ ],
+ "file": "brushes/clay-buildup.sfbrush",
+ "preview": "previews/clay-buildup.png",
+ "sha256": "0681e2d2e16d0ca18f2d70297509a9939fdcd89488077299e2d162afe7a4ca55",
+ "added": "2026-10-22"
+ },
+ {
+ "name": "Cracked Earth",
+ "description": "Dry, cracked mud: flattens the ground and splits it into plates.",
+ "author": "SculptForge",
+ "tags": [
+ "environment",
+ "ground",
+ "cracks"
+ ],
+ "file": "brushes/cracked-earth.sfbrush",
+ "preview": "previews/cracked-earth.png",
+ "sha256": "99230163c8d9d8b2e71c3c8e1b2cd377055154bd3fd533cd6b6737911254a866",
+ "added": "2026-10-22"
+ },
+ {
+ "name": "Dragon Scales",
+ "description": "Stamps rounded overlapping scales along the stroke.",
+ "author": "SculptForge",
+ "tags": [
+ "creature",
+ "scales",
+ "texture"
+ ],
+ "file": "brushes/dragon-scales.sfbrush",
+ "preview": "previews/dragon-scales.png",
+ "sha256": "8b280a7f656c8193e7d9a6378c94cb98b7e220283b1f325d24b86579f7bf4da1",
+ "added": "2026-10-22"
+ },
+ {
+ "name": "Edge Wear",
+ "description": "Chips and softens only the sharp edges and ridges, for weathered props.",
+ "author": "SculptForge",
+ "tags": [
+ "props",
+ "weathering",
+ "hard-surface"
+ ],
+ "file": "brushes/edge-wear.sfbrush",
+ "preview": "previews/edge-wear.png",
+ "sha256": "c0caee8df43a88738bf32c2aac742bca022b6edf8d8e4f316d380dd28483c50e",
+ "added": "2026-10-22"
+ },
+ {
+ "name": "Fabric Folds",
+ "description": "Soft, rounded cloth folds with a crisp inner edge.",
+ "author": "SculptForge",
+ "tags": [
+ "fabric",
+ "clothing",
+ "folds"
+ ],
+ "file": "brushes/fabric-folds.sfbrush",
+ "preview": "previews/fabric-folds.png",
+ "sha256": "4f3bc4f8abb61453c00930ce867b039df74cd57e9a8578fc157d16a82993c398",
+ "added": "2026-10-22"
+ },
+ {
+ "name": "Hammered Metal",
+ "description": "Soft overlapping hammer dimples for beaten copper, armour and cookware.",
+ "author": "SculptForge",
+ "tags": [
+ "metal",
+ "props",
+ "hard-surface"
+ ],
+ "file": "brushes/hammered-metal.sfbrush",
+ "preview": "previews/hammered-metal.png",
+ "sha256": "0a6c2e543854bbf1ace7c03584d93c7223ba34690ffd15ae2c8f681e63215a59",
+ "added": "2026-10-22"
+ },
+ {
+ "name": "Lava Rock",
+ "description": "Pitted, porous volcanic stone and pumice.",
+ "author": "SculptForge",
+ "tags": [
+ "stone",
+ "environment",
+ "texture"
+ ],
+ "file": "brushes/lava-rock.sfbrush",
+ "preview": "previews/lava-rock.png",
+ "sha256": "09508472f41b8dbf602ca235b4b78ab11fb6a637939857840769e470c64fe541",
+ "added": "2026-10-22"
+ },
+ {
+ "name": "Orange Peel",
+ "description": "Dense dimpled skin like citrus peel, leather or older skin.",
+ "author": "SculptForge",
+ "tags": [
+ "skin",
+ "texture",
+ "character"
+ ],
+ "file": "brushes/orange-peel.sfbrush",
+ "preview": "previews/orange-peel.png",
+ "sha256": "893f1a1ec7086b0125db2764822cf3bfe6c4fe33cba797b396cc19c484400dfb",
+ "added": "2026-10-22"
+ },
+ {
+ "name": "Palette Knife",
+ "description": "Flattens and drags clay sideways like a sculptor's knife.",
+ "author": "SculptForge",
+ "tags": [
+ "clay",
+ "planes",
+ "hard-surface"
+ ],
+ "file": "brushes/palette-knife.sfbrush",
+ "preview": "previews/palette-knife.png",
+ "sha256": "1c35a1edb55bf819f22e7d8a79040bc75ede35075e9c269a46d2598bfed0f247",
+ "added": "2026-10-22"
+ },
+ {
+ "name": "Panel Line",
+ "description": "Clean, narrow grooves for hard-surface panel seams.",
+ "author": "SculptForge",
+ "tags": [
+ "hard-surface",
+ "mech",
+ "crease"
+ ],
+ "file": "brushes/panel-line.sfbrush",
+ "preview": "previews/panel-line.png",
+ "sha256": "6b3dc65fca7b3fbb4458303b5bbf68bfafce7491910cfd88211890444a5b483c",
+ "added": "2026-10-22"
+ },
+ {
+ "name": "Rasp",
+ "description": "Coarse file and rasp marks for carved wood, stone and rough castings.",
+ "author": "SculptForge",
+ "tags": [
+ "wood",
+ "stone",
+ "texture"
+ ],
+ "file": "brushes/rasp.sfbrush",
+ "preview": "previews/rasp.png",
+ "sha256": "796078c902282b17669675887ee9696b4ab0fc2c8b940822e401912017abad43",
+ "added": "2026-10-22"
+ },
+ {
+ "name": "Rope",
+ "description": "A raised, knotted cord for ropes, braids and cables.",
+ "author": "SculptForge",
+ "tags": [
+ "props",
+ "fabric",
+ "cord"
+ ],
+ "file": "brushes/rope.sfbrush",
+ "preview": "previews/rope.png",
+ "sha256": "2371ac38551d9d52173628a901735702b74e786025cd6e368458e33bef9729d4",
+ "added": "2026-10-22"
+ },
+ {
+ "name": "Rough Clay",
+ "description": "Lumpy, hand-pressed clay for a traditional sculpted look.",
+ "author": "SculptForge",
+ "tags": [
+ "clay",
+ "blocking",
+ "texture"
+ ],
+ "file": "brushes/rough-clay.sfbrush",
+ "preview": "previews/rough-clay.png",
+ "sha256": "286ea08a9ea8b0f020713f2f6071229548eca628d456bce7d05537b4c06b4b0e",
+ "added": "2026-10-22"
+ },
+ {
+ "name": "Scar Tissue",
+ "description": "Raised, puckered scars and healed wounds.",
+ "author": "SculptForge",
+ "tags": [
+ "skin",
+ "character",
+ "creature"
+ ],
+ "file": "brushes/scar-tissue.sfbrush",
+ "preview": "previews/scar-tissue.png",
+ "sha256": "3f01aa14511af0232cc414b341ab620ad1f61966d6329126f7d968027bc1cad9",
+ "added": "2026-10-22"
+ },
+ {
+ "name": "Skin Pores",
+ "description": "Sprinkles tiny pores for close-up skin detail.",
+ "author": "SculptForge",
+ "tags": [
+ "skin",
+ "texture",
+ "character"
+ ],
+ "file": "brushes/skin-pores.sfbrush",
+ "preview": "previews/skin-pores.png",
+ "sha256": "7b984fab853ccebf6b422059cc733cb3ad8f272b6456ae302c0230d0da864623",
+ "added": "2026-10-22"
+ },
+ {
+ "name": "Snake Scales",
+ "description": "Tight rows of small, smooth scales for snakes, lizards and fish.",
+ "author": "SculptForge",
+ "tags": [
+ "creature",
+ "scales",
+ "texture"
+ ],
+ "file": "brushes/snake-scales.sfbrush",
+ "preview": "previews/snake-scales.png",
+ "sha256": "c035ed01b287843b11fd56224b73d1e10b1fd6cc779034920b383b783c4458a0",
+ "added": "2026-10-22"
+ },
+ {
+ "name": "Stone Chisel",
+ "description": "Scrapes hard planes and breaks them up with cracks for rocks and ruins.",
+ "author": "SculptForge",
+ "tags": [
+ "stone",
+ "environment",
+ "hard-surface"
+ ],
+ "file": "brushes/stone-chisel.sfbrush",
+ "preview": "previews/stone-chisel.png",
+ "sha256": "7db8ad4c84793a093fc21bd724bc63c127dde0528df32d677fe5552378c299e4",
+ "added": "2026-10-22"
+ },
+ {
+ "name": "Tree Bark",
+ "description": "Deep, sinewy bark ridges for trunks, roots and old wood.",
+ "author": "SculptForge",
+ "tags": [
+ "environment",
+ "wood",
+ "texture"
+ ],
+ "file": "brushes/tree-bark.sfbrush",
+ "preview": "previews/tree-bark.png",
+ "sha256": "46f15969f96e90b1bbb4aedfb2a00ea427e29c57790b77750ccb4b773783a019",
+ "added": "2026-10-22"
+ },
+ {
+ "name": "Veins",
+ "description": "Soft raised veins and tendons under the skin.",
+ "author": "SculptForge",
+ "tags": [
+ "skin",
+ "anatomy",
+ "character"
+ ],
+ "file": "brushes/veins.sfbrush",
+ "preview": "previews/veins.png",
+ "sha256": "0f5d91734d140856c7a5cd49798be8dc0a10a10eb388270d67a9f2f098f36a52",
+ "added": "2026-10-22"
+ },
+ {
+ "name": "Wrinkle",
+ "description": "Fine, sharp creases for skin folds and fabric wrinkles.",
+ "author": "SculptForge",
+ "tags": [
+ "skin",
+ "fabric",
+ "crease"
+ ],
+ "file": "brushes/wrinkle.sfbrush",
+ "preview": "previews/wrinkle.png",
+ "sha256": "7051077d8ffb4b254d0fc1eb117b12124f6aef2bd12dd0d9e440e3ab0cb9a48a",
+ "added": "2026-10-22"
+ }
+ ]
+}
diff --git a/website/gallery/previews/chipped-stone.png b/website/gallery/previews/chipped-stone.png
new file mode 100644
index 00000000..cbb6a4a1
Binary files /dev/null and b/website/gallery/previews/chipped-stone.png differ
diff --git a/website/gallery/previews/clay-buildup.png b/website/gallery/previews/clay-buildup.png
new file mode 100644
index 00000000..0ad2fbb9
Binary files /dev/null and b/website/gallery/previews/clay-buildup.png differ
diff --git a/website/gallery/previews/cracked-earth.png b/website/gallery/previews/cracked-earth.png
new file mode 100644
index 00000000..c9c37b0f
Binary files /dev/null and b/website/gallery/previews/cracked-earth.png differ
diff --git a/website/gallery/previews/dragon-scales.png b/website/gallery/previews/dragon-scales.png
new file mode 100644
index 00000000..333facbe
Binary files /dev/null and b/website/gallery/previews/dragon-scales.png differ
diff --git a/website/gallery/previews/edge-wear.png b/website/gallery/previews/edge-wear.png
new file mode 100644
index 00000000..97c49028
Binary files /dev/null and b/website/gallery/previews/edge-wear.png differ
diff --git a/website/gallery/previews/fabric-folds.png b/website/gallery/previews/fabric-folds.png
new file mode 100644
index 00000000..81574c8e
Binary files /dev/null and b/website/gallery/previews/fabric-folds.png differ
diff --git a/website/gallery/previews/hammered-metal.png b/website/gallery/previews/hammered-metal.png
new file mode 100644
index 00000000..6ae0c062
Binary files /dev/null and b/website/gallery/previews/hammered-metal.png differ
diff --git a/website/gallery/previews/lava-rock.png b/website/gallery/previews/lava-rock.png
new file mode 100644
index 00000000..4f0a771a
Binary files /dev/null and b/website/gallery/previews/lava-rock.png differ
diff --git a/website/gallery/previews/orange-peel.png b/website/gallery/previews/orange-peel.png
new file mode 100644
index 00000000..c9b27540
Binary files /dev/null and b/website/gallery/previews/orange-peel.png differ
diff --git a/website/gallery/previews/palette-knife.png b/website/gallery/previews/palette-knife.png
new file mode 100644
index 00000000..3173142a
Binary files /dev/null and b/website/gallery/previews/palette-knife.png differ
diff --git a/website/gallery/previews/panel-line.png b/website/gallery/previews/panel-line.png
new file mode 100644
index 00000000..f3ea93b1
Binary files /dev/null and b/website/gallery/previews/panel-line.png differ
diff --git a/website/gallery/previews/rasp.png b/website/gallery/previews/rasp.png
new file mode 100644
index 00000000..19c31320
Binary files /dev/null and b/website/gallery/previews/rasp.png differ
diff --git a/website/gallery/previews/rope.png b/website/gallery/previews/rope.png
new file mode 100644
index 00000000..e1e6e8d8
Binary files /dev/null and b/website/gallery/previews/rope.png differ
diff --git a/website/gallery/previews/rough-clay.png b/website/gallery/previews/rough-clay.png
new file mode 100644
index 00000000..7f7ab739
Binary files /dev/null and b/website/gallery/previews/rough-clay.png differ
diff --git a/website/gallery/previews/scar-tissue.png b/website/gallery/previews/scar-tissue.png
new file mode 100644
index 00000000..bb73ccb6
Binary files /dev/null and b/website/gallery/previews/scar-tissue.png differ
diff --git a/website/gallery/previews/skin-pores.png b/website/gallery/previews/skin-pores.png
new file mode 100644
index 00000000..0ee9d5c6
Binary files /dev/null and b/website/gallery/previews/skin-pores.png differ
diff --git a/website/gallery/previews/snake-scales.png b/website/gallery/previews/snake-scales.png
new file mode 100644
index 00000000..24475b48
Binary files /dev/null and b/website/gallery/previews/snake-scales.png differ
diff --git a/website/gallery/previews/stone-chisel.png b/website/gallery/previews/stone-chisel.png
new file mode 100644
index 00000000..2c604507
Binary files /dev/null and b/website/gallery/previews/stone-chisel.png differ
diff --git a/website/gallery/previews/tree-bark.png b/website/gallery/previews/tree-bark.png
new file mode 100644
index 00000000..c7d4cdfd
Binary files /dev/null and b/website/gallery/previews/tree-bark.png differ
diff --git a/website/gallery/previews/veins.png b/website/gallery/previews/veins.png
new file mode 100644
index 00000000..e8da557d
Binary files /dev/null and b/website/gallery/previews/veins.png differ
diff --git a/website/gallery/previews/wrinkle.png b/website/gallery/previews/wrinkle.png
new file mode 100644
index 00000000..fedeb7fc
Binary files /dev/null and b/website/gallery/previews/wrinkle.png differ
diff --git a/website/index.html b/website/index.html
index a6ca64df..025c6667 100644
--- a/website/index.html
+++ b/website/index.html
@@ -15,7 +15,7 @@
<meta property="og:image" content="https://islandmed.github.io/SculptForge/img/social-preview.png?v=2">
<meta property="og:url" content="https://islandmed.github.io/SculptForge/">
<meta name="twitter:card" content="summary_large_image">
- <link rel="stylesheet" href="style.css?v=5">
+ <link rel="stylesheet" href="style.css?v=6">
</head>
<body>
<header class="nav">
diff --git a/website/style.css b/website/style.css
index bbe74c4d..91409558 100644
--- a/website/style.css
+++ b/website/style.css
@@ -262,6 +262,54 @@ p { margin: 0 0 1em; }
.vfx-links .btn { text-align: center; }
}
+/* Community brushes page (brushes.html). */
+.nav nav a[aria-current="page"] { color: var(--text); }
+.brushes-hero { padding: 72px 0 60px; }
+.brushes-hero h1 { max-width: 15em; }
+.brushes-hero .lede { max-width: 42em; }
+.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
+.gallery-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; }
+.filters { display: flex; flex-direction: column; gap: 14px; margin: 8px 0 28px; }
+.filters input { width: 100%; max-width: 520px; padding: 12px 18px; border-radius: 999px; border: 1px solid var(--border);
+ background: var(--panel); color: var(--text); font: inherit; font-size: 0.95rem; }
+.filters input:focus { outline: none; border-color: var(--accent); }
+.tags { display: flex; flex-wrap: wrap; gap: 8px; }
+.tags button { font: inherit; font-size: 0.82rem; color: var(--muted); background: transparent; border: 1px solid var(--border);
+ border-radius: 999px; padding: 4px 12px; cursor: pointer; }
+.tags button:hover { color: var(--text); border-color: #3a3a44; }
+.tags button[aria-pressed="true"] { color: #1a0d04; background: var(--accent); border-color: var(--accent); font-weight: 600; }
+.brush-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 18px; }
+.brush { display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--border);
+ border-radius: var(--radius); overflow: hidden; transition: border-color 0.2s, transform 0.2s; }
+.brush:hover { border-color: #3a3a44; transform: translateY(-2px); }
+.brush[hidden] { display: none; }
+.brush img { width: 100%; height: auto; aspect-ratio: 4 / 3; background: #1c1d22; }
+.brush-body { display: flex; flex-direction: column; flex: 1; padding: 16px 18px 18px; }
+.brush h3 { color: #fff; margin: 0 0 2px; }
+.brush .by { color: var(--muted); font-size: 0.85rem; margin: 0 0 8px; }
+.brush .desc { color: #cfcfd6; font-size: 0.92rem; margin: 0 0 12px; flex: 1; }
+.brush-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 14px; }
+.brush-tags span { font-size: 0.75rem; color: var(--muted); border: 1px solid var(--border); border-radius: 999px; padding: 2px 9px; }
+.btn.small { padding: 8px 16px; font-size: 0.88rem; text-align: center; }
+.brush .btn.small:hover { border-color: var(--accent); }
+.empty { color: var(--muted); }
+
+@media (max-width: 960px) {
+ .steps { grid-template-columns: 1fr; }
+}
+@media (max-width: 620px) {
+ .brushes-hero { padding: 36px 0 44px; }
+ .brushes-hero .lede { display: block; font-size: 1rem; }
+ .tags { flex-wrap: nowrap; overflow-x: auto; margin: 0 -16px; padding: 0 16px 4px; scrollbar-width: none; }
+ .tags::-webkit-scrollbar { display: none; }
+ .tags button { flex: none; }
+ .brush-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
+ .brush-body { padding: 12px 12px 14px; }
+ .brush .desc { font-size: 0.85rem; }
+ .brush h3 { font-size: 1rem; }
+ .gallery-head { flex-direction: column; gap: 0; }
+}
+
@media (forced-colors: active) {
.accent { color: Highlight; text-shadow: none; }
.btn.primary { border: 1px solid ButtonText; }