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.

Merge remote-tracking branch 'origin/feat/pbr' into integration/next

islandmedd50d5d7a654c
diff --cc CHANGELOG.md
index e9c329cb,d57c65b0..fd586086
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@@ -7,43 -7,34 +7,71 @@@ All notable changes to SculptForge are
## [Unreleased]
### Added
+- **Micro levels: hundreds of millions of sculptable polygons** (**Tool > Geometry > Micro**, `micro_*`
+ commands). Above the highest subdivision level a SubTool can carry a micro level: per triangle a regular grid of
+ 16-bit heights along the interpolated normal of the smooth (Phong-tessellated) base, instead of a mesh.
+ 300 million micro triangles take 374 MB (1.25 bytes each; the whole app about 0.8 GB), where a mesh of that size
+ would need about 27 GB. Unlike ZBrush's HD Geometry the whole model is sculptable at once.
+ - Brushes: Standard, Clay, Clay Buildup, Smooth, Inflate, Flatten, Trim, Layer, Pinch / Crease / Dam Standard
+ (as height sharpening), Mask; symmetry, Focal Shift, pressure and the mask apply. Big brushes are evaluated on
+ a coarser grid and interpolated (scale-adaptive). Move reshapes the base below the micro level and the detail
+ rides along (dual scale); "Move along normals" moves the micro surface itself.
+ - Viewport: the micro surface is evaluated on the GPU per frame, with a level of detail per cluster and a
+ triangle budget (2M on a laptop profile, 8M on a workstation, `RenderSettings::renderTriangleBudget`), crack
+ free; the shading keeps every micro detail. 300M micro triangles orbit at 70+ fps with 4x antialiasing (M1 Pro).
+ - Bake Micro (to a mesh), Export Displacement (32-bit EXR or 16-bit PNG, scalar or vector, over the base UVs).
+ - Undo: a packed journal per stroke (tiles in Morton order, each tile's change predicted and packed).
+ - Very large levels stay out of core in a sparse memory-mapped file (only what you touch is in memory).
+ - Projects: format 7 when a SubTool has a micro level (others stay format 6 for older versions).
+ - `sculptforge --bench-micro --bench-sizes 33,100,300` measures it. Guide chapter "Micro levels".
+- Automatic hardware detection and calibration. On first launch, and again when the graphics card, its driver or
+ the version changes, SculptForge spends about a second or two (under a small overlay; Esc skips) measuring
+ triangle throughput, upload bandwidth, brush speed and memory bandwidth, and probes the GPU (OpenGL strings,
+ video memory through GL_NVX_gpu_memory_info, GL_ATI_meminfo, GLX_MESA_query_renderer, amdgpu sysfs, DXGI or
+ CGL), RAM, threads, SIMD and OS. The result picks a profile: **Laptop / Budget**, **Workstation** (64 GB+ RAM
+ with a 16 GB+ discrete GPU, or Apple Silicon Max / Ultra and big APUs, that measure fast) or a **Software** safe
+ mode for llvmpipe, with a render triangle budget, motion proxy
+ threshold, GPU memory and upload budgets, texture, subdivision and micro-triangle limits and the thread count.
+ Cached in the settings folder; no network use. A one-line status bar message says what was found.
+- Preferences > Performance shows what was detected and measured ("Detected <GPU>, <memory> -> Workstation"),
+ the settings in effect, **Re-calibrate** and manual overrides (kept across re-calibrations).
+- An adaptive frame governor holds the view at 60 fps (120 / 144 on a fast display) while it moves, by switching
+ big scenes to their motion proxy sooner or later, with hysteresis; it changes only what is drawn, never the
+ model. Fast Navigation's 10 million triangle threshold now comes from the profile.
+- On battery (laptops), brushes switch to draft mode, uploads per frame halve and the target is 60 Hz.
+- `sculptforge --calibrate` prints the profile as JSON (schema sculptforge.calibration/1); commands
+ `performance_profile`, `calibrate` and `set_performance_override` for the console, scripts and MCP.
+- For developers: `core/TierConfig.h` (resident cache cap, active-triangle budget, upload budget, draft brush
+ mode, zero-copy UMA, target Hz) and `renderTriangleBudget()` for the renderer and micro-displacement
+ (docs/performance.md, "Hardware profile").
+ - Material painting (PBR): a painted texture can carry Roughness, Metallic, Normal, Height (16-bit), Ambient
+ Occlusion, Emissive and Opacity besides its colour, all painted in the same strokes. Turn channels on in
+ **Tool > Texture Map > Material Channels** (`texture_channels`); a channel costs no memory until it is painted
+ (64x64 copy-on-write tiles; untouched tiles aren't stored). **Color > Material** sets what the brush lays on
+ each channel (material swatches, per-channel value swatches and sliders; `paint_material`), and **C** picks the
+ whole material under the cursor. Paint layers hold every channel: channel chips on each layer row turn a
+ channel on or off for that layer, and give it its own blend mode and opacity, including **Normal Combine** for
+ normals (`texture_layer_channel`). Height also yields a normal combined onto the Normal channel. One undo step
+ per stroke, kept per layer and channel. Auto UV, Voxel Remesh, QRemesh and merging SubTools carry every channel.
+ See the guide's Material painting page.
+ - Solo channel view: **Tool > Texture Map** shows one channel on the model (roughness and the other scalars in
+ grey, the normal as colours, emission in colour), live while painting (`channel_view`).
+ - Export Maps with presets (`export_maps`): Unreal (`T_*_BC`, `T_*_N` in DirectX, `T_*_ORM`), Unity URP and HDRP
+ (mask map), glTF, Godot, Blender (one file per channel) and USD, plus your own JSON presets (the guide's Export
+ presets page). Height maps are 16-bit PNG.
+ - Model exports wire the channels into their materials: glTF metal-rough slots (packed occlusion / roughness /
+ metallic, normal, emissive, alpha from opacity), UsdPreviewSurface inputs, the MTL PBR keys and FBX material
+ maps. Send to Unreal imports `T_<Name>_BC / _N / _ORM` and builds an `M_<Name>` material from them.
+ - Preferences > Performance and `perf_info` show the memory of textures and their material channels.
+
+ ### Changed
+ - Texture painting on dense meshes costs the texels a dab reaches instead of the triangles under it: the brush
+ finds the texture tiles under it from the BVH and paints each texel from a cached triangle-and-barycentrics
+ map, tiles in parallel. A 0.35-radius dab with X symmetry on a 21M-triangle sphere: 4K 150-360 ms -> 24-39 ms,
+ 8K 240-350 ms -> 39-55 ms (M1 Pro, ranges over a busy and a quiet machine); results match the old dab within
+ 1/255. Lighter meshes keep the per-triangle dab.
+ - Project format 7 stores material channels. It is written only when a texture has them: other projects are
+ still saved as format 6, and every older project opens as before.
## [0.9.7] - 2026-10-31
diff --cc CMakeLists.txt
index 17c2f6e3,74eccf98..84ed1d4c
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@@ -70,11 -67,12 +70,16 @@@ add_library(sculptforge_core STATI
src/core/PaintLayer.cpp
src/core/Texture.cpp
src/core/TextureCommands.cpp
+ src/core/TileImage.cpp
+ src/core/TextureChannels.cpp
+ src/core/TextureChannelCommands.cpp
+ src/core/LayerStackIO.cpp
+ src/core/MapExport.cpp
src/core/Multires.cpp
+ src/core/Micro.cpp
+ src/core/MicroSculpt.cpp
+ src/core/MicroCommands.cpp
+ src/core/MicroStore.cpp
src/core/MultiresCommands.cpp
src/core/AutoUv.cpp
src/core/TextureTransfer.cpp
diff --cc docs/guide/index.md
index 42f9e3f8,2045c79c..b0a90d55
--- a/docs/guide/index.md
+++ b/docs/guide/index.md
@@@ -30,38 -30,39 +30,40 @@@ You can read it inside SculptForge (**H
12. [ZSpheres](zspheres.md)
13. [Polypaint and materials](polypaint.md)
14. [Texture painting](texture-painting.md)
- 15. [Sculpt layers and blend shapes](layers.md)
- 16. [Facial shapes and live face](facial-shapes.md)
- 17. [Subdivision levels](subdivision-levels.md)
- 18. [Micro levels: hundreds of millions of polygons](micro-levels.md)
- 19. [Dynamic topology](dynamic-topology.md)
- 20. [Moving, rotating and posing (Gizmo 3D)](gizmo.md)
- 21. [Subdivide, remesh, decimate and LODs](geometry.md)
- 22. [Quad retopology and detail projection](retopology.md)
+ 15. [Material painting (PBR)](pbr-painting.md)
+ 16. [Sculpt layers and blend shapes](layers.md)
+ 17. [Facial shapes and live face](facial-shapes.md)
+ 18. [Subdivision levels](subdivision-levels.md)
-19. [Dynamic topology](dynamic-topology.md)
-20. [Moving, rotating and posing (Gizmo 3D)](gizmo.md)
-21. [Subdivide, remesh, decimate and LODs](geometry.md)
-22. [Quad retopology and detail projection](retopology.md)
++19. [Micro levels: hundreds of millions of polygons](micro-levels.md)
++20. [Dynamic topology](dynamic-topology.md)
++21. [Moving, rotating and posing (Gizmo 3D)](gizmo.md)
++22. [Subdivide, remesh, decimate and LODs](geometry.md)
++23. [Quad retopology and detail projection](retopology.md)
## AI and capture
--23. [Image and text to 3D](generate-3d.md)
--24. [Gaussian splats](splats.md)
--25. [Scan an object into a splat](scan-to-splat.md)
--26. [From scan to sculptable mesh](scan-to-sculptable.md)
--27. [Phone capture and AR](phone-capture.md)
++24. [Image and text to 3D](generate-3d.md)
++25. [Gaussian splats](splats.md)
++26. [Scan an object into a splat](scan-to-splat.md)
++27. [From scan to sculptable mesh](scan-to-sculptable.md)
++28. [Phone capture and AR](phone-capture.md)
## Files and pipelines
--28. [Baking normal and displacement maps](baking.md)
--29. [Exporting, Unreal and ZBrush](exporting.md)
- 30. [Working with Blender](blender.md)
- 31. [Projects, autosave and QuickSave](projects.md)
- 32. [Scripting and automation](scripting.md)
- 33. [SculptForge for studios](studios.md)
-30. [Export presets](export-presets.md)
-31. [Working with Blender](blender.md)
-32. [Projects, autosave and QuickSave](projects.md)
-33. [Scripting and automation](scripting.md)
-34. [SculptForge for studios](studios.md)
++29. [Baking normal and displacement maps](baking.md)
++30. [Exporting, Unreal and ZBrush](exporting.md)
++31. [Export presets](export-presets.md)
++32. [Working with Blender](blender.md)
++33. [Projects, autosave and QuickSave](projects.md)
++34. [Scripting and automation](scripting.md)
++35. [SculptForge for studios](studios.md)
## Reference
- 34. [Keyboard and mouse](shortcuts.md)
- 35. [Performance and big meshes](performance.md)
- 36. [Troubleshooting and FAQ](troubleshooting.md)
- 37. [Glossary](glossary.md)
-35. [Keyboard and mouse](shortcuts.md)
-36. [Performance and big meshes](performance.md)
-37. [Troubleshooting and FAQ](troubleshooting.md)
-38. [Glossary](glossary.md)
++36. [Keyboard and mouse](shortcuts.md)
++37. [Performance and big meshes](performance.md)
++38. [Troubleshooting and FAQ](troubleshooting.md)
++39. [Glossary](glossary.md)
## Getting help
diff --cc src/core/Project.cpp
index a027a5ef,c82d5115..895112d4
--- a/src/core/Project.cpp
+++ b/src/core/Project.cpp
@@@ -816,25 -798,12 +832,27 @@@ bool saveProject(const std::string& pat
st.set("active_layer", active ? doc.activeLayer : s.activeLayer);
if (hasPaintLayers(doc.subtoolMesh(i)))
st.set("paint_layers", writePaintLayers(w, "subtools/" + std::to_string(i) + "/", doc.subtoolMesh(i)));
- if (doc.subtoolMesh(i).texture && doc.subtoolMesh(i).texture->width > 0)
+ if (doc.subtoolMesh(i).texture && doc.subtoolMesh(i).texture->width > 0) {
st.set("texture", writeTexture(w, "subtools/" + std::to_string(i) + "/", doc.subtoolMesh(i)));
+ version.need(textureFormatVersion(*doc.subtoolMesh(i).texture));
+ }
if (subdivLevelCount(doc.subtoolMesh(i)))
st.set("subdiv", writeSubdiv(w, "subtools/" + std::to_string(i) + "/", doc.subtoolMesh(i)));
+ if (const Mesh& m = doc.subtoolMesh(i); m.micro && microMatches(m)) { // format 7: the micro level (core/Micro.h)
+ const MicroMesh& mm = *m.micro;
+ const std::string p = "subtools/" + std::to_string(i) + "/micro/";
+ Json mj = Json::object();
+ mj.set("level", mm.level);
+ mj.set("step", double(mm.step));
+ // Tiles packed (delta + per-tile range, core/MicroStore.h): untouched tiles are 3 bytes.
+ std::vector<uint8_t> packed;
+ microPackTiles(mm.disp.data(), mm.baseTriangles, mm.samples, packed);
+ const size_t packedBytes = packed.size();
+ mj.set("displacement_packed", w.add(p + "displacement.pack", Scalar::U8, 1, packedBytes, std::move(packed)));
+ if (mm.hasMask()) mj.set("mask", w.externalBytes(p + "mask.bin", mm.mask));
+ st.set("micro", std::move(mj));
+ version.need(7);
+ }
const std::string& gozName = active ? doc.gozName : s.gozName;
if (!gozName.empty()) st.set("goz_name", gozName);
const std::vector<QRemeshGuide>& guides = active ? doc.qremeshGuides : s.qremeshGuides;
diff --cc src/core/Undo.h
index a17e0b78,225a5c8e..2bac8e0c
--- a/src/core/Undo.h
+++ b/src/core/Undo.h
@@@ -5,9 -5,9 +5,10 @@@
#include "core/BVH.h"
#include "core/Dyntopo.h"
#include "core/Mesh.h"
+#include "core/Micro.h"
#include "core/Multires.h"
#include "core/ThreadPool.h"
+ #include "core/TileImage.h"
#include <deque>
#include <memory>