CSG (Constructive Solid Geometry) module for rbfx/Urho3D.
This project depends on rbfx/Urho3D headers and libraries.
Configure with a prefix that contains Urho3DConfig.cmake (or equivalent):
cmake --preset linux-gcc-x64-dll -DCMAKE_INSTALL_PREFIX=/path/to/rbfx/sdk-or-source
cmake --build --preset linux-gcc-x64-debugSee CMakePresets.json for available configure and build presets.
Add this repository as a subdirectory in your rbfx/Urho3D build (or otherwise ensure an Urho3D CMake target exists), then build normally.
- Produces a plugin target:
Plugin.CSG - Produces a static library
Plugin.CSG.Editor(the editor addon) if the targetEditorLibraryis present. See "Editor addon".
A CsgSolid is an immutable polygonal operand. CsgBooleanOperation computes a union, a difference or an intersection of two closed solids.
The engine uses corefinement:
- It finds the intersection curve of the two solids with exact predicates. The predicates use float expansions (Shewchuk) in
CsgExpansion.h. - A face BVH (binned SAH) finds the face pairs that overlap.
- A symbolic perturbation (a displacement of the second operand) resolves the degenerate cases, such as a vertex on a face.
- A SIMD filter (
CsgFloat4: SSE2, NEON, WASM or scalar) decides most tests. A lane that it cannot decide goes to the exact expansion path. - The result keeps whole faces from the operands and builds new faces only along the curve.
All exact decisions use an integer grid:
- A solid stores one integer grid point for each vertex id. The float position of a vertex is the grid point divided by the scale. A boolean result keeps the grid points of its ids.
- The grid scale is 2^-10 (1/1024) units in float mode. Grid coordinates are 32 bit integers below 2^23, so differences are below 2^24 and exact in float.
- The CMake option
CSG_EXACT_USE_DOUBLE(default OFF) makesCsgReala double. The grid step is then 2^-16 units. Grid coordinates are below 2^29, so differences are below 2^30 and exact in double. A float coordinate snaps to this grid. - The library builds with strict float flags:
-ffp-contract=off -fno-fast-math(GCC, Clang) or/fp:strict(MSVC). - The coordinate limit is 2^13 (8192) units in both modes. For an operand coordinate outside this limit, or not finite, the solid sets the
outOfRangeflag andIsOutOfRange()returns true. A boolean with such an operand returns an empty solid withIsOutOfRange()true. - One rounding rule makes a grid coordinate: floor(x + 1/2). A tie goes toward plus infinity.
- An operand snaps once.
CsgSolid::FromOperandwelds the corners withinepsilon, repairs the T-junctions, and snaps each welded position to the grid. The fast entry (PresnappedFaces) does the weld and the snap in one pass. It is enough if the snapped faces close up exactly. A constructor without grid points (the polygon list entry) also welds withinepsilon. No later step snaps a position again. - A crossing of an edge through a triangle rounds once with the same rule.
CsgExact::RoundOnEdgeandCsgExact::RoundCrossingapply the rule exactly to a point on an edge. - A rounded crossing can fold: it leaves its triangle, it crosses a segment or a chain edge of a triangle map, it breaks the order of the crossings on its edge, or it turns over a closed cycle of segments inside its triangle. A crossing that rounds onto the line of a triangle edge folds if its exact point is not on that edge. A crossing that rounds outside its triangle does not fold if its twin has the same grid point. The twin is the crossing of that triangle edge at the same exact point. The exact sign of the cycle area comes from a double estimate with an error bound. If the bound does not decide, the cycle rule does not apply.
Corefinement::ConstrainCrossingsruns after the crossings are collected. It tests each crossing that is not exactly on the grid. If the crossing folds, it tries the other corners of the grid cell of the exact crossing, and keeps the first corner that does not fold. A crossing with no valid corner keeps its nearest rounding. A second pass (Corefinement::ConstrainClusters) handles the crossings of one edge whose grid cells intersect. These crossings get one common grid point if a corner of the intersection does not fold. Then the two sides of a thin slab get the same chain of grid points. The switchConstrainCrossingsOnGrid(inCsgCorefine.h) turns both passes off. - The bounds of the exact values follow from the grid (
CsgExact.h): minors below 2^50 and determinants below 2^75 in float mode, minors below 2^62 and determinants below 2^93 in double mode. - The SIMD filter stays on float in both modes. Its error bounds are
CsgPlanarFilterBound(planar determinants and dot products) andCsgDistanceFilterBound(distances). In double mode the conversion of a difference to float can round, and the bounds cover this error. A value inside the bound goes to the exact path.
- The splitter works on rounded grid points. It uses exact 2D grid predicates in the plane of a face and an exact cyclic order of the edges around a vertex. Before the trace of a triangle, the splitter welds the ids of the curve segments that have the same grid point. A curve id welds to the chain id at its grid point, or to the first curve id there. Two chain ids never weld to each other.
- Classification works per patch. Elements that an edge off the curve joins form a patch. The elements use grid-canonical ids: ids with equal grid points count as one id. The sum of the votes of the curve edges of a patch labels all its elements. A patch with no net vote (a zero-sum patch) gets a point query on one element that has a grid area.
- Every point query in the exact range is exact. A component with no curve edge uses a grid vertex. A zero-sum patch uses the centroid of a triangle, which is a rational point. Both use a ray along +x with the symbolic perturbation of the second operand. The ray reduces to three exact 2D tests and one exact plane test.
- A zero-sum patch where every element has zero grid area has no side. The boolean also removes a zero-sum patch with no exact classification: its polygon does not match its loop, or its triangulation has zero grid area. A component with no loop has no side. The boolean removes it. The clean-up would drop the faces of a zero-area patch in any case. A patch with a loop mismatch is removed, and the result can stay open.
- Holes of a region sort by the exact area of their loops. The area is an expansion (
CsgExact::LoopAreaExact). A loop of more than 2^20 points has no exact area and uses a double estimate. - The result path has no weld within
epsilonand no float repair. The kept faces go through an exact clean-up by grid point and id. The clean-up welds ids with equal grid points, removes repeated ids and zero-width spikes, cancels twin faces (two faces that visit the same ids in opposite directions), and splits an edge at the vertices that are exactly on it (T-junctions). CsgSolid::ContainsPoint(point)is exact and has no epsilon. It snaps the point to the grid like the input of a solid and counts the crossings of an exact ray along +x with the grid triangles. It uses the same predicates as the classification above. A point that is not finite or is out of the grid range is outside. A point on the surface has a fixed answer from the symbolic perturbation. Build a solid from polygons withCsgSolid::FromOperandor with the polygon constructor. Both repair the faces. A solid that is not closed can have a crack of one grid step. A ray through the crack gives a wrong parity.- The result is closed if every directed edge has an opposite partner. This test is exact and has no crack budget. If the surface is not closed, the result reports
IsClosed()false. epsilonis used for the weld of operand corners and for the bounds of operands. An operand without exact ids (a solid fromFromOperandor from polygons) also uses it for the crack budget ofIsClosed(). An epsilon that is not positive gives the default epsilon.
The pipeline steps were tested by switching them off over 200000 random cases. The segment rule and the edge-order rule of ConstrainCrossings, RemoveSpurs and the weld in FromOperand stay, because the results got worse without them. The suspect pre-pass only makes the work faster, by about 8 to 13 percent. The step CancelOpposites had no effect on these cases, so the boolean no longer has it.
Use CsgBuildPolygonsFromModel or CsgBuildSolidFromModel to get an operand from a Model. Use CsgTriangulatePolygons and CsgBuildModel to get a Model from polygons.
- Rounding changes the shape. A vertex moves by up to half a grid step on each axis (1/2048 units in float mode, 1/131072 units in double mode).
- In rare cases the result stays open (
IsClosed()false). In a sweep of 1028 rotations of a box union with coplanar contact, no sample fails in float mode and 1 sample fails in double mode. This sample is 5.9000 degrees on the axis (1, 1, 1), left union. The union of A and B is right, but the next boolean on the result fails. Three sheets of one operand lie in one grid cell. The sheets give a T-junction between them. In the sweep, no closed result has a wrong volume. ConstrainCrossingscosts time. On the benchmark it adds about 3% (box-box) to 20-25% (rotated coplanar union) to the boolean.- An operand with a coordinate outside of +-8192 units gives an empty solid with
IsOutOfRange()true. - A second identical cut is not idempotent in float mode. It adds sliver faces at the grid points of the first cut.
- Some second identical cuts are not valid. A sweep cuts a box with a sphere near a corner, then cuts the result with the same sphere again (8868 cases). The first cut is valid in all cases. 449 second cuts are not valid: 336 have duplicate sheets and 131 have open edges. The two groups overlap: some second cuts have both. No result is empty. In 8 cases the volume changes by more than 0.001 units, and in 7 of them by more than 0.1 units, up to 0.49 units. Large volume losses occur also with the fold rule before the on-edge rule.
- The single cut of these sweeps has no failure in 13788 cases (a grid of 8788 centers and 5000 random centers).
- An open case: a vertex of the first cut is on the edge line of a sphere triangle. The weld rule covers only the vertices of the chain of that edge. The crossing then moves, and the second cut keeps a duplicate sheet. The test tag
[known]holds this case. - A crossing with no valid corner in its grid cell keeps its nearest rounding. This rounding can stay on the line of a triangle edge. The result can still be valid.
Later work. The editor does not have these yet:
- Translucent cutters: draw subtract brushes as see-through volumes.
- Isolate: show one brush alone.
- Lock: protect a brush from edits.
- Align: align brushes to each other.
- Vertex snap: snap a handle to a vertex of another brush.
- Array and mirror: copy a brush many times.
- Groups: nest operands in a group.
Not planned:
- A prefab library of brushes.
- Bevel.
- Typed numeric input for handle positions. The inspector attributes already take typed values.
The benchmark is a hidden test (tag [.benchmark]). A normal run skips it. Run it with:
Tests.CSG "[.benchmark]" --benchmark-samples 20The baselines for the float build and the double build are in the header of Source/Tests/TestBenchmark.cpp.
CsgRoot builds one Model from the CsgBrush components in its subtree. A CsgBrush has a model and an operation (Union, DifferenceAB or Intersection).
A procedural brush (CsgBoxBrush, CsgSphereBrush, CsgCylinderBrush, CsgRingBrush, CsgWedgeBrush, CsgStairsBrush, CsgArchBrush) generates its model from parameters. See "Procedural box", "Procedural sphere", "Procedural cylinder, cone, prism and pyramid", "Procedural ring", "Procedural wedge", "Procedural stairs" and "Procedural arch".
The root writes the result to a StaticModel on the same node.
- The build runs on the
WorkQueue. The main thread applies the result. A result that is older than a later change still shows, and the root starts a new wait for the newer state. The root drops a stale result of a failed build, of a job with a model that reloaded, or when auto-apply is off. Deferred Delay Secis the wait before a rebuild. The wait starts at the first change and a later change does not reset it. A drag gives live updates.Rebuild()ignores it.- Transform changes: a dirty brush node or root node starts one check at the next work queue update. The check compares the local transform of each brush with the last value that the root saw. Only a difference requests a rebuild. A move of the root gives no rebuild. A brush move with a delay of 0 also starts its rebuild at the next work queue update, not in the call.
- Solid cache: the root stores a fingerprint for each brush (brush, model, transform, mesh id and operation). If a rebuild only appends brushes and the base model, the epsilon and the earlier brushes did not change, it starts from the cached solid. It applies only the new brushes.
AutoApplyResults(default true) applies a finished result at once. If it is false, the root queues each result.HasPendingResult,GetPendingResultRevisionandApplyPendingResultgive access to the oldest queued result.Bake()folds the applied brushes into the base operand and removes the brush nodes. The baked geometry exists only at run time and the root does not serialize it.Bake()returns false if a rebuild is in flight, a brush is dirty or a result is pending.Generate Collision(default false) puts aCollisionShapewith a triangle mesh on theCsgResultnode. The mesh is the applied result model, not a second build. Each applied result updates the same shape. An empty result removes the shape.Collision Static Body(default true) adds a staticRigidBody(mass 0) next to the shape. Clear it if you do not want a body. A shape without a body has no effect in the physics world.- The collision components are temporary, like the result node. The scene does not save them. The root makes them again after a load. A baked result keeps its collision.
- The engine adds a
PhysicsWorldto the scene when aCollisionShapeenters it. The scene saves that world. - If the engine has no physics, or the context did not register it, the attributes have no effect. The root logs one warning.
A procedural brush offers handles. A handle is a point that the user drags in the viewport.
The editor addon stays independent of the shape types. It uses three events and does not link Plugin.CSG.
The header Source/Urho3D/CSG/CsgShapeProtocol.h has the events and the keys. It needs only the Urho3D core types.
The addon sends an event with component->SendEvent(...). The brush answers on itself and writes the result into the event data.
A bad id or a bad delta gives no log message. The answer is P_ACCEPTED false.
E_CSGSHAPEQUERYHANDLES. Out:P_VERSION(int, 2),P_VALID(bool) andP_HANDLES(aVariantVector). Each element is aVariantMapwith the keysId(int),Name(string),Kind(int: 0 point, 1 axis),Position(Vector3),Axis(unit Vector3, zero for a point) andGroup(string, the adjustment mode of the handle). The key constants are inCsgShapeProtocol. The reply has alsoP_GROUPS(aStringVector): the groups in the order of the mode bar. The first entry is the default mode. The list is fixed for a shape type, also if a handle is not present (an apex).GroupandP_GROUPSare optional keys. The version stays 2. A reader ignores a key that it does not know. A reader treats a missingGroupas an empty group. A reply withoutP_GROUPS(an old runtime) gives no modes. The name "All" is reserved for the editor. A shape does not declare it. The reply has also the optionalP_CAGE(aVariantVectorofIntVector2). Each entry is a pair of handle ids. The editor draws a faint dashed line between the two handles. An id can name a handle that the mode hides. The version stays 2. A reply withoutP_CAGE(an old runtime) gives no cage. The shape gives the pairs withGetCageLines. The box gives 48 lines: each edge gives 2 lines through its midpoint dot and each face gives 4 lines to its center dot. The cylinder gives its axis (handle 0 to handle 1). The other shapes give no cage. The positions and axes are in the local space of the brush. A shape that is not valid givesP_VALIDfalse and no handle.E_CSGSHAPEMOVEHANDLES. In:P_INDICES(aVariantVectorof int ids) andP_DELTA(Vector3). The delta is the total delta from the drag start, in the local space of the brush. Out:P_ACCEPTED(bool).E_CSGSHAPERECENTER(protocol version 2). Out:P_ACCEPTED(bool) andP_OFFSET(Vector3). The offset is the amount, in the local space of the brush, that the shape center was away from the origin. The brush moves its parameters by minus the offset. The editor then moves the node bynode->GetTransform() * offset. Then the world shape does not change. Only the local transform of the node changes, so the parent transforms do not matter.P_ACCEPTEDis false if the shape is centered (offset below 1e-6), always centered (sphere, ring) or the new parameters are not valid. Then the parameters stay. The handle ids do not change. The editor queries the positions again. In C++ the same API isCsgProceduralBrush::Recenter. The box center is the mean of the 8 positionsSize * Corner. The cylinder center is the midpoint of the two end centers. The wedge, stairs and arch center is the "Center" attribute. The recenter sets it to zero.
The move is stateless. The brush applies the delta to its current parameters. The editor restores the attributes before each call.
The brush clamps the result with the sanitizer of the shape. It refuses a result that is not valid.
Then P_ACCEPTED is false and the parameters stay. A non-finite delta, an unknown id and a move without a change also give false.
An accepted move marks the brush dirty once. In C++ the same API is CsgProceduralBrush::GetHandles and MoveHandles.
A repeated id counts once. The handles apply in the given order.
The ids are a file contract. New ids do not change the protocol version: it stays 2.
A corner moves once by the delta, also if a corner handle and an edge handle name it, or two edge handles name it. A face handle adds its move along the axis on top.
| Shape | Id | Handle |
|---|---|---|
| Box | 0 to 7 | Corners (points). Bit 0 is +X, bit 1 is +Y, bit 2 is +Z. |
| Box | 20 to 25 | Faces (axes) in the order -X, +X, -Y, +Y, -Z, +Z. The face moves its 4 corners along the axis. |
| Box | 30 to 41 | Edges (points) at the midpoint of the 2 corners. Ids 30 to 33 are parallel to X, 34 to 37 to Y, 38 to 41 to Z. In a group the order is ascending by the bits of the other two axes (the lower axis is bit 0, 0 is the minus side). The names are "Edge X -Y -Z", "Edge X +Y -Z", "Edge X -Y +Z", "Edge X +Y +Z", then "Edge -X Y -Z" and so on. An edge moves its 2 corners by the delta. |
| Box | 50 to 52 | Size (axes) at the centroid of the +X, +Y, +Z face, with the + axis. The id is 50 plus the axis (0 X, 1 Y, 2 Z). The names are "Size X", "Size Y", "Size Z". A move d along the axis moves the 4 corners of the + face by +d and the 4 corners of the - face by -d. The box grows by 2 d and the centroid stays. |
| Sphere | 0 to 5 | Radius at +X, -X, +Y, -Y, +Z, -Z. The + and - handles of one axis edit one component. |
| Cylinder | 0, 1 | Bottom center and top center (points). |
| Cylinder | 2 to 5 | Bottom radius at +X, -X, +Z, -Z. On the polygon boundary along the axis. Not offered if the bottom is an apex. |
| Cylinder | 6 to 9 | Top radius at +X, -X, +Z, -Z. On the polygon boundary along the axis. Not offered if the top is an apex. |
| Cylinder | 10 | Bulge (axis +X at the middle of the center line). Not offered if the mean X radius is 0.001 or less. |
| Cylinder | 11 | Bottom scale. On the bottom rim at 45 degrees in XZ. A drag scales both radii. At an apex it sits at the bottom center. |
| Cylinder | 12 | Top scale. On the top rim at 45 degrees in XZ. A drag scales both radii. At an apex it sits at the top center. |
| Ring | 0 | Major radius (axis +X). |
| Ring | 1 | Radial tube radius (axis +X). |
| Ring | 2 | Axial tube radius (axis +Y). |
| Ring | 3 | Arc end (axis is the tangent at the arc end). The arc is in the range 1 to 360 degrees. |
| Wedge | 6 to 8 | Size (axes) "Size X", "Size Y", "Size Z" at the position of the +X, +Y and +Z face handle (ids 1, 4 and 3), with the + axis. A move d grows the size on the axis by 2 d. "Center" stays. |
| Wedge | 0 to 5 | Faces (axes) in the order -X, +X, -Z (front edge), +Z (back), +Y (top edge), -Y (bottom). The size on the axis grows by the move and "Center" moves by half of it, so the opposite face stays. |
| Stairs | 6 to 8 | Size (axes) "Size X", "Size Y", "Size Z" at the position of the +X, +Y and +Z face handle (ids 1, 4 and 3), with the + axis. A move d grows the size on the axis by 2 d. "Center" stays. |
| Stairs | 0 to 5 | Faces (axes) in the order -X (side center), +X (side center), -Z (first riser), +Z (back), +Y (top tread), -Y (bottom). The move is as for the wedge. There is no handle for "Steps". |
| Arch | 0 | Outer X radius at the start end of the outer curve (axis +X). The radius grows by the move. |
| Arch | 1 | Outer Y radius at the top of the outer curve (axis +Y). |
| Arch | 2 | Thickness at the top of the inner curve (axis -Y, into the hole). A move into the hole makes the wall thicker. |
| Arch | 3 | Depth at the front (axis +Z). The depth grows by the move and "Center" moves by half of it, so the back stays. |
| Arch | 4 | Arc end (axis is the tangent at the end angle). The arc grows by 2 d / s radians, with s the length of the tangent (-r.x sin a, r.y cos a). Both ends move, so the handle follows the cursor. |
Each face of the result knows the brush that made it. The editor uses this to select a brush with a click. A subtract brush has no surface of its own, but the faces that it cuts point back to it.
CsgPolygon::source_is the node ID of the brush that made the polygon. 0 is the base model or an unknown source. Each split, clip, snap and rescale of a polygon keeps it.CsgTriangulatedModel::Geometry::triangleSources_has one source for each triangle ofindexData_.- After each build the worker makes a pick table: three node space corners and one source for each triangle. The table belongs to the applied result. A queued or dropped result does not change it.
- The brush fingerprint compares the node ID. A new brush node with the same model and transform folds again.
The header Source/Urho3D/CSG/CsgRootProtocol.h has the event. It needs only the Urho3D core types.
The addon sends it with root->SendEvent(...). The root answers on itself, also when it is disabled.
E_CSGROOTPICK. In:P_ORIGIN(Vector3, world),P_DIRECTION(Vector3, world, any length) andP_MAXDISTANCE(float, optional, default 1e9). Out:P_VERSION(int, 1),P_HIT(bool),P_SOURCE(unsigned node ID),P_POSITION(Vector3, world),P_NORMAL(unit Vector3, world, front face normal) andP_DISTANCE(float, world units).
The pick tests all triangles (no BVH). Only front faces count. The nearest hit wins.
The root moves the ray into the space of the result node, so a scaled or rotated root gives world values.
No applied build result, a zero direction or no front face hit gives P_HIT false.
In C++ the same function is CsgRoot::Pick.
E_CSGROOTQUERYSTATS. In: none. Out:P_VERSION(int, 1),P_VALID(bool),P_BRUSHCOUNT(unsigned, operands of the build),P_TRIANGLESandP_VERTICES(unsigned, applied result model),P_REBUILDMS(float, boolean plus triangulation plus model build),P_REUSEDOPERANDS(unsigned, operands from the cached prefix),P_BUILDING(bool, a job runs) andP_ERROR(string).- The numbers describe the last applied build. A root that built nothing has zeros and
P_VALIDfalse. P_ERRORis empty for a valid result. Else it tells the reason: a failed build, an open solid, open edges, duplicate or degenerate triangles, or no volume.- The root does not know the brush that caused a problem, so the event has no brush ID. The toolbar has no "Select offending brush" button.
- A component that is not a root keeps
P_VERSIONunchanged.
Each CsgBrush has three UV attributes. They come after "Materials" in the inspector.
- "UV Mode":
LocalorRoot.Localkeeps the UV 0 of the operand mesh.Rootprojects UV 0 as a box in the local frame of theCsgRoot. - "UV Scale": the texture repeats for each unit. The default is 1.
- "UV Offset": a
Vector2that is added after the scale. The default is (0, 0).
Defaults: a CsgBrush with a model uses Local, scale 1 and offset 0. Old scenes and old results do not change. A procedural brush (CsgBoxBrush, CsgSphereBrush, CsgCylinderBrush, CsgRingBrush, CsgWedgeBrush, CsgStairsBrush, CsgArchBrush) uses Root.
Root mode rules:
- Each polygon picks the dominant axis of its plane normal. A tie goes to X, then Y, then Z. The choice is for the whole polygon.
- The UV is (U, V) for the axis X: (z, y), Y: (x, z), Z: (x, y). V is the negative of the second coordinate, so V grows down. U has a sign that keeps the texture not mirrored when seen from outside.
- uv = (U, V) * scale + offset. Only UV 0 and the tangent change. The normals and UV 1 stay.
- In
Localmode, uv = uv0 * scale + offset. A mesh without UV elements has no UV to change. - The projection uses the frame of the root. A move of the root does not change the textures. A scale of the root does.
To line up the textures of many brushes, use Root on all of them and the same "UV Scale" and "UV Offset". The UV of a point then depends only on its position in the root. A brush that moves its faces does not make the texture slide. One material for each brush is the normal case. An empty slot of a procedural brush has no material: it uses the default material. A material whose shader builds the texture coordinate from the world position (for example a world-space grid shader) ignores the UV attributes, so "UV Scale" and "UV Offset" show no change with it.
A change of a UV attribute folds again from that brush, as a change of the operation does.
Plugin.CSG.Editor adds CSG tools to the scene view of the editor. It does not link Plugin.CSG. It finds the CSG types by name at run time.
- Link
Plugin.CSG.Editorto the custom editor executable. - In
Setup(), calleditorPluginManager_->AddPlugin("RbfxCsg.EditorAddon", &RbfxCsg_EditorAddon);beforeEditorApplication::Setup(). - Include
Urho3D/CSGEditor/CsgEditorAddon.h. - Add
Plugin.CSGto the loaded plugins of the project (Project.json,PluginManager.LoadedPlugins).
If the type CsgRoot is not registered, the addon does nothing and hides its toolbar.
The hotkeys work in the scene view. You can bind them again on the "Key Bindings" page of the editor settings.
| Command | Key | Action |
|---|---|---|
Csg.AddUnion |
B | Add a union brush at the cursor. |
Csg.AddSubtract |
Shift+B | Add a subtract brush (DifferenceAB) at the cursor. |
Csg.SetUnion |
1 | Set Union on all selected brushes. |
Csg.SetDifference |
2 | Set DifferenceAB on all selected brushes. |
Csg.SetIntersection |
3 | Set Intersection on all selected brushes. |
Csg.MoveEarlier |
[ | Move the active brush one operand earlier. |
Csg.MoveLater |
] | Move the active brush one operand later. |
Csg.ToggleBrush |
H | Toggle "Is Enabled" of all selected brushes. |
The toolbar has all controls. It has no overlay in the view. The "CSG" menu of the tab context menu has all commands.
The CSG toolbar items show only if the active node is a CsgRoot node, a brush node (a child of a root) or the temporary result node of a root. For other selections, and for no selection, the addon draws no toolbar items. The "CSG" menu stays. Use it to add a brush when nothing is selected.
| Group | Visible when | Items |
|---|---|---|
| Root | A root, its result or one of its brushes is active. | The preset combo, "add union" and "add subtract" (the brush goes to the center of the view), "Bake to Asset". The bake button is off while the result builds or a rebuild is pending. Its tooltip gives the reason. |
| Brush | A brush is active. | The three operation buttons (the active brush shows the operation), "toggle brush", "move earlier", "move later". They change all selected brushes. |
| Shape | A brush with a procedural shape is active. | The handle mode buttons (only for a shape with 2 or more modes), the toggles "Show handles", "Show cage" and "Recenter pivot after drag", the button "Recenter pivot" and the "Shape settings" popup with the "Snap step" field. |
| Info | A root, its result or a brush is active. | The info button. |
The mode buttons are one group. Each button has the first letter of the mode: F, S, E, C and A for "Face", "Size", "Edge", "Corner" and "All". The active mode is highlighted. The tooltip has the name, the handle count and the hotkeys M and Shift+M. The buttons are off during a drag or if "Show handles" is off. The tooltips of the operation and add buttons show the build status of the active root.
The info button shows a tooltip when the cursor is over it. For a root or a brush, the tooltip has the root name, the build status, the line "Brushes N, tris N, last build X ms, reused K/N", the vertex count and the reason of an invalid result. For a shape brush, it adds the type, "Valid" or "Invalid", the size, the selected handles and the row of materials.
During a handle drag, a small tooltip near the cursor shows the live "Delta" and "Size".
The toolbar combo in front of the "add" buttons selects the shape of a new brush. The hotkeys B and Shift+B and the toolbar "add" buttons use it. The presets are:
Box: a proceduralCsgBoxBrush. It has no model file.Sphere: a proceduralCsgSphereBrush. It has no model file.Cylinder: a proceduralCsgCylinderBrush. It has no model file.Cone: aCsgCylinderBrushwith the top radius (0, 0). The side is smooth, as in the cylinder.Pyramid: aCsgCylinderBrushwith 4 segments, "Start Angle" 45, "Face Radius" on, the top radius (0, 0) and flat normals. The base is a square of the size (2 * radius x, 2 * radius z).Hex Prism: aCsgCylinderBrushwith 6 segments and flat normals.Ring: a proceduralCsgRingBrush. It has no model file.Wedge: a proceduralCsgWedgeBrush. It has no model file.Stairs: a proceduralCsgStairsBrush. It has no model file.Arch: a proceduralCsgArchBrush. It has no model file.Box.mdl,Sphere.mdl,Cylinder.mdl,Cone.mdl,Pyramid.mdlandTorus.mdl: aCsgBrushwith the CoreData model.
The editor settings (ui.ini) keep the choice as CsgEditor.BrushPreset. A saved name Box from an older version now selects the procedural box. An unknown name keeps the current preset. The combo hides a procedural preset if its type is not registered.
Tests.CSG builds a root with one union brush for each preset model. Each build succeeds and gives a closed and valid mesh with a positive volume. If a model file is missing, the test shows a warning and skips the model. To make a missing model a failure, set the CMake option RBFX_CSG_REQUIRE_CORE_DATA=ON or the environment variable CSG_REQUIRE_CORE_DATA=1.
CsgBoxBrush generates its mesh from parameters. It has no "Model" attribute, so a model drop does not change it.
- "Size": the box size. Each component is in [0.001, 16384]. The default is (1, 1, 1).
- "Corner 0" to "Corner 7": the corners. Index bit 0 is +X, bit 1 is +Y and bit 2 is +Z. Each component is in [-64, 64]. The default is (+-0.5, +-0.5, +-0.5). The local corner position is Size * Corner, per component.
- The scale of the node applies as for a model brush. The operand transform is
rootFrame * brush world transform, with the root frame equal to the metric scale of the root times the inverse world transform of the root. A box of size 1 on a node with the scale 0.5 under a root with the scale 1 has the volume 0.125. Under a root with the scale 2 it has the world scale 1, so the volume in the fold space is 1. The output model is in the node space of the root, so its volume there is 0.125. - "Materials": 6 slots, one for each face, in this order: -X, +X, -Y, +Y, -Z, +Z. The order is a file contract. An empty slot has no material: it uses the default material. Faces with equal materials share one output geometry.
- Each face is two triangles with a fixed diagonal. A moved corner can make a face that is not planar. The CSG accepts this.
- UV 0 is a planar projection in local units, so the texel density does not change with the size. UV 1 puts each face in one cell of a 3x2 atlas.
- Validity: at each corner, the three edges to the neighbor corners must give a positive triple product, and the volume must be positive. A corner that goes through the opposite face makes the box not valid. A box that is not valid gives no operand and logs one warning.
- A value that is not finite gets its default value.
CsgSphereBrush generates a UV sphere (an ellipsoid) from parameters. It has no "Model" attribute. See CsgGenerateSphere.
- "Radius": the radius on each axis. Each component is in [0.001, 16384]. The default is (0.5, 0.5, 0.5).
- "Segments": the number of longitude divisions, 3 to 128. The default is 24.
- "Rings": the number of latitude bands from the top pole to the bottom pole, 2 to 64. The default is 12.
- "Smooth Normals": the default is on. Smooth normals follow the ellipsoid. Off gives a flat normal for each triangle.
- "Materials": one slot for the whole surface.
- The poles are on the Y axis. A pole is one position with a fan of triangles. The seam duplicates vertices only for UV. The seam positions are bit-identical copies.
- UV 0 is (longitude / 2pi, latitude / pi). UV 1 is equal to UV 0. The tangent follows the longitude direction.
- The mesh is a polyhedron that is inscribed in the ellipsoid. Its volume is a little less than the ellipsoid volume.
- A value that is not finite gets its default value. The parameters are always valid after clamping.
CsgCylinderBrush generates a cylinder, a cone, a frustum, a prism or a pyramid from parameters. It is one class: the "Segments", "Start Angle" and "Face Radius" attributes and the radius pair give each shape. It has no "Model" attribute. See CsgGenerateCylinder.
- "Bottom Center" and "Top Center": the ends of the axis, in local space. Each component is in [-16384, 16384]. The defaults are (0, -0.5, 0) and (0, 0.5, 0). The axis can be sheared or tilted.
- "Bottom Radius" and "Top Radius": the two radii of an end along the local X and Z axes. The end lies in the plane perpendicular to the Y axis, not to the tilted axis. Each component is in [0, 16384]. The default is (0.5, 0.5).
- A pair with both components below 0.001 is (0, 0): the end is an apex. A cone has one apex position and no cap. A pair with only one zero component gets 0.001 for it.
- "Segments": 3 to 128. The default is 24. "Height Segments": 1 to 64. The default is 1.
- "Bulge": from -0.95 to 4. The default is 0. The radius at the height fraction t is lerp(bottom, top, t) * (1 + bulge * 4 * t * (1 - t)). The center line stays straight.
- "Smooth Normals": the default is on. Off gives a flat normal for each triangle. A cap normal is always flat.
- "Start Angle": the angle of the first vertex around the Y axis, in degrees. The default is 0. A value is wrapped into [0, 360). Vertex k is at 2pi * k / n + the start angle. A value that is not finite gives 0. A scene without this attribute loads with 0.
- "Face Radius": the default is off. Off: the radii reach the corners of the polygon. On: the radii reach the middle of each side face. The polygon has the apothem 1 and the radius pair scales it. The corner distance is then 1 / cos(pi / n). The area of the end is n * tan(pi / n) * rx * rz. A scene without this attribute loads with off.
- The default values (start 0, no face radius) give the same positions as before, bit for bit.
- Shapes: Cone = top radius (0, 0). Frustum = different radii. Hex prism = 6 segments. Pyramid = 4 segments, "Start Angle" 45, "Face Radius" on and one end radius (0, 0). A pyramid with the base radius (rx, rz) has the base corners at (+-rx, +-rz). The base is flush with a box of the size (2 * rx, 2 * rz). The volume is 4 * rx * rz * height / 3.
- "Materials": three slots, in this order: 0 the side, 1 the top cap, 2 the bottom cap. An apex end has no cap, and its slot stays free. The other slots keep their numbers.
- UV 0 of the side is (angle / 2pi, height fraction). UV 0 of a cap is the planar (x + 0.5, z + 0.5). UV 1 is equal to UV 0.
- Validity: the centers must be at least 0.001 apart, and also at least 0.001 apart in Y. A horizontal axis is not valid. Both ends must not be apexes. The volume must be positive. A shape that is not valid gives no operand and logs one warning.
- If the top is below the bottom in Y, the generator flips the winding. The volume stays positive and the top cap stays at "Top Center".
- A value that is not finite gets its default value.
CsgRingBrush generates a ring (a torus with an elliptic tube section) from parameters. It has no "Model" attribute. See CsgGenerateRing. The ring lies around the local Y axis: it lies in the XZ plane.
- "Radius": the major radius, from the axis to the center of the tube. It is in [0.01, 16384]. The default is 0.5.
- "Tube Radius": the radial and the axial radius of the tube. Each component is in [0.005, 16384]. The default is (0.15, 0.15). The radial radius is at most 0.99 * "Radius", so the inner edge stays at a positive radius.
- "Segments": 3 to 128, around the axis. The default is 32. "Tube Segments": 3 to 64, around the tube. The default is 12. 4 tube segments give a square section if "Tube Angle" is 45 degrees, and a diamond if it is 0.
- "Arc": the sweep around the axis, in degrees, from 1 to 360. The default is 360. An arc below 360 adds two flat end caps. Each cap is a fan from the center of the section.
- "Tube Angle": from -180 to 180 degrees. The default is 0. It rotates the start of the tube section. 0 is the outer side. The angle grows toward +Y.
- "Smooth Normals": the default is on. The normal is the analytic normal of the elliptic section. Off gives a flat normal for each triangle. A cap normal is always flat.
- "Materials": six slots, in this order: 0 the outer surface, 1 the inner surface, 2 the top (+Y), 3 the bottom (-Y), 4 the start cap, 5 the end cap. The slots of the caps of a full ring stay free. A quadrant without a quad also leaves its slot free. The other slots keep their numbers.
- The section splits in four quadrants by its axes. A quad of the tube belongs to the quadrant of the angle of its middle, including "Tube Angle". A middle angle on a quadrant border goes to the next quadrant, in the direction of growing angle.
- UV 0 is (angle around the axis / arc, angle around the tube / 2pi). A cap uses the planar section coordinates. UV 1 is equal to UV 0.
- Validity: the volume must be positive and no triangle can have two equal positions. The sanitized values always give a valid ring. A shape that is not valid gives no operand and logs one warning.
- A value that is not finite gets its default value.
CsgWedgeBrush generates a right-angle ramp from parameters. It has no "Model" attribute. See CsgGenerateWedge.
- "Size": the size of the bounding box. Each component is in [0.001, 16384]. The default is (1, 1, 1).
- "Center": the center of the bounding box in the local space of the brush. Each component is in [-16384, 16384]. The default is (0, 0, 0). Each vertex is generated around it.
- The slope rises from the front bottom edge (-Z, -Y) to the back top edge (+Z, +Y). The mesh has 6 positions and 8 triangles.
- "Materials": five slots, in this order: 0 the bottom (-Y), 1 the back (+Z), 2 the slope, 3 the left triangle (-X), 4 the right triangle (+X). The order is a file contract.
- Each triangle has a flat normal. UV 0 is a planar projection of each face in local units, relative to "Center". UV 1 is equal to UV 0.
- Handles: see the table in "Shape handles (protocol)". A face handle changes the size on its axis by the move and moves "Center" by half of the move, so the opposite face stays fixed.
- Validity: the volume must be positive and no triangle can have two equal positions. The sanitized values always give a valid wedge.
- A value that is not finite gets its default value.
CsgStairsBrush generates solid stairs from parameters. It has no "Model" attribute. See CsgGenerateStairs.
- "Size": the size of the bounding box. Each component is in [0.001, 16384]. The default is (1, 1, 1).
- "Center": the center of the bounding box in the local space of the brush. Each component is in [-16384, 16384]. The default is (0, 0, 0).
- "Steps": 1 to 64. The default is 5. Step i (from 0) has the height Size.y * (i + 1) / Steps and the tread depth Size.z / Steps. The first riser is at the front (-Z) and starts at the bottom. The top tread ends at the back top edge.
- The profile in the YZ plane is extruded along X. Each tread and each riser is one quad. Each side is a fan of triangles from the back bottom corner. The fan uses only the profile points, so the mesh has no T-junction.
- "Materials": five slots, in this order: 0 the treads, 1 the risers, 2 the two sides, 3 the bottom, 4 the back. The order is a file contract.
- Each triangle has a flat normal. UV 0 is a planar projection of each face in local units, relative to "Center". UV 1 is equal to UV 0.
- The volume is Size.x * Size.y * Size.z * (Steps + 1) / (2 * Steps).
- Handles: see the table in "Shape handles (protocol)". The face handles work as for the wedge. The inspector changes "Steps".
- Validity: the volume must be positive and no triangle can have two equal positions. Very small steps far from the origin merge their float positions. Then the shape is not valid, gives no operand and logs one warning.
- A value that is not finite gets its default value.
CsgArchBrush generates an arch from parameters: an elliptic annular sector in the XY plane, extruded along Z. It has no "Model" attribute. See CsgGenerateArch.
- "Radius": the outer radius along X and along Y. Each component is in [0.01, 16384]. The default is (1, 1).
- "Thickness": the wall thickness, in [0.005, max(Radius.x, Radius.y)]. The default is 0.25. The inner radius is Radius - Thickness per axis. If a component of the inner radius is below 0.001, the arch is a filled sector: the front and the back are fans from the center.
- "Depth": the extrusion along Z, in [0.001, 16384]. The default is 1. The arch is from z = -Depth / 2 to Depth / 2 around "Center".
- "Arc": 1 to 180 degrees. The default is 180. The arch is symmetric about +Y: the angles go from 90 - Arc / 2 to 90 + Arc / 2, measured from +X. A point on the outer curve is (Radius.x cos t, Radius.y sin t).
- "Segments": 3 to 128. The default is 16.
- "Center": the center of the curves in the local space of the brush. Each component is in [-16384, 16384]. The default is (0, 0, 0). An arc of 180 degrees stands on the plane y = Center.y, as a door top.
- "Materials": five slots, in this order: 0 the outer curved face, 1 the inner curved face, 2 the front (+Z), 3 the back (-Z), 4 the two ends. A filled sector has no inner face. Its slot stays free. The order is a file contract.
- The curved faces have smooth normals (the analytic normal of the ellipse). The other faces are flat. UV 0 of a curved face is (arc length along the curve, -z). UV 0 of a flat face is a planar projection in local units, relative to "Center". UV 1 is equal to UV 0.
- Each front and back quad between the inner and the outer curve is two triangles. The generator uses the first diagonal that gives two triangles with a positive area.
- Handles: see the table in "Shape handles (protocol)". The top handles are on the mesh if "Segments" is even. Otherwise they are on the ellipse, a little outside the mesh.
- Validity: the volume must be positive, no triangle can have two equal positions and each front quad needs a good diagonal. A very small arch far from the origin is not valid. Then it gives no operand and logs one warning.
- A value that is not finite gets its default value.
- The debug shape of a brush has the color of its operation:
Uniongreen,DifferenceABred,Intersectionblue. The table is inCsgOperationColor.h. - The selection renderer of the editor draws the debug shape of a selected brush, and of all brushes of a selected root. If a brush is active, the addon adds the debug shapes of the other operands of its root. Each shape is drawn one time.
- The addon follows the "Draw Debug Geometry" option of the tab context menu. If the option is off, the addon draws no debug shapes.
- The addon draws at most 64 operand shapes in a frame. It skips the other operands.
- A brush keeps its debug model. A frame does no resource lookup. A missing model is looked up again only after a model change.
- The view has no list of the brushes. The scene hierarchy shows the brushes of the root in operand order. A click on a face of the result selects the brush that made the face.
- A move with [ or ] is one undo step. The move skips the children that are not brushes. Undo and redo make the root rebuild.
- A held [ or ] repeats. Each repeat is one move and one undo step.
- The [ and ] bindings accept Ctrl and Alt. Some keyboard layouts need AltGr for these keys, and on Windows AltGr is Ctrl+Alt.
- A toggle with H is one undo step. A disabled brush is not an operand. The root rebuilds.
- The active root is the CSG root of the selected node or of its parent.
- "Add brush" adds a child brush with the preset model to the active root at the hit point of the ray.
- If the ray hits nothing, the brush goes to the root position. Without a root, it goes 10 units in front of the camera.
- If there is no active root, "add brush" makes a root node "CSG" next to the selected node or in the scene. The brush is its first operand.
- "Add brush" selects the new brush. One undo step removes the brush, and the new root too.
- An operation change is one undo step. The root rebuilds at once.
- The operation keys do nothing if no brush is selected.
- A new brush has a world scale of about 1. Its local scale is the inverse of the root world scale.
Drag a model (.mdl) from the resource browser into the scene view. The active selected node selects the case:
- A CSG root, or its result node: the drop adds a union brush with the model under the root, at the hit point. Hold Shift at drop time to add a subtract brush (
DifferenceAB). The new brush is selected. One undo step removes it. - A brush: the drop sets the model of all selected brushes. The brushes stay at their positions. One undo step restores the old models. A drop of the same model adds no undo step.
- Any other node, or no selection: the stock editor behavior. The editor adds a plain node with a
StaticModel.
During the drag, the scene shows a preview. The preview brush of the "add" case is disabled, so the CSG result does not change and does not rebuild until the drop. A move out of the view removes the preview.
A procedural brush has one material attribute:
- "Materials": the material of each face group. It keeps one slot for each face group. The slot count and the order do not change.
A slot uses its own material. An empty slot has no material: it uses the default material, not the material of slot 0. Equal materials merge into one output geometry. A model brush uses its "Materials" slots as before. A scene that still has a saved "Shape Material" value loses it on load. There is no migration.
Drag a material (.material) or a texture (.png, .jpg, .jpeg, .tga, .dds, .bmp, .webp, .ktx) from the resource browser onto the scene view. The default is ALL FACES of the target brush.
| Modifier | Scope |
|---|---|
| none | Set all slots of the brush. The new material replaces the existing ones. |
| Ctrl | Set only the face under the cursor. |
The hint line of the drag shows the mode: "Drop: all faces", "Ctrl: only face ". With Ctrl and no face under the cursor, the hint is "No face under the cursor" and nothing changes. The face names: box Left, Right, Bottom, Top, Back, Front (slots 0 to 5); cylinder Side, Top, Bottom; ring Outer, Inner, Top, Bottom, Start cap, End cap; wedge Bottom, Back, Slope, Left, Right; stairs Treads, Risers, Sides, Bottom, Back; arch Outer, Inner, Front, Back, Ends; sphere Surface.
The face under the cursor comes from the event E_CSGSHAPEQUERYSLOT (see CsgShapeProtocol.h). The editor picks the brush with E_CSGROOTPICK, converts the hit to the local space of the brush and sends the query. The brush finds the nearest triangle whose normal fits (|dot| > 0.9). The preview shows the new material on the target face at once. There is no outline of the face yet.
Drag ownership: the scene view gives a whole drag to ONE addon, chosen on the first frame. The stock material handler takes any material drag. So the CSG addon takes a material drag at once if the scene has a CSG root. It decides the target again in each frame and at the drop. A material over a geometry that is not a CSG result is set on that geometry, as the stock handler does. Brush nodes do not hide the result under the cursor.
Two stages decide a drop. The selection plays no role in either stage.
- Stage 1: the first relevant hit under the cursor is a CSG result (a brush node does not hide it). The CSG rules apply. The face decides the target: the brush that made the face. A face of the base model of the root targets the root ("Materials" of
CsgRoot). A plain drop sets all slots of the target. Ctrl sets only the slot of that face. - Stage 2: the first hit is another geometry. The stock rules apply: the "Material" attribute of that geometry is set, with one undo step. With no hit, nothing happens.
The pure functions ChooseDropStage and DecideDrop in CsgEditorOps.h implement the stages. The addon only calls them.
Targets:
- The cursor is over the CSG result of any root: the brush that made the face under the cursor gets the edit. The selection does not matter. A union operand that is not selected accepts the drop, also if another brush is selected. The selection does not change.
- The cursor is over a face of the base model of the root: the root gets the edit. A plain drop sets all base materials. Ctrl sets the slot of the base geometry under the cursor. The hint names it "base ".
- The cursor is over a result but no brush and no base model made the face (a removed brush): the tooltip shows "No brush under the cursor". Nothing changes.
- The cursor is not over a result: a material is set on the geometry under the cursor, as the stock editor handler does. A texture drop does nothing.
- The target is found each frame. If the cursor goes off a result during a drag, the preview goes and the release changes nothing.
A texture: the addon makes a material for the texture, then uses the same edit rules. The material file goes next to the texture file. Its name is the full texture file name plus .material. Example: Textures/Brick.png gives Textures/Brick.png.material in the same resource directory. Brick.png and Brick.jpg keep separate materials. The material uses the technique Techniques/LitOpaque.xml, the shader define PBR and the texture as the albedo (diffuse) texture. An existing .material file is reused and never overwritten. A texture that is not in a mounted resource directory (for example in a package): the addon logs one error and does nothing.
During the drag, a tooltip below the drag label shows the hint line of the mode and one line with the modifiers. A material shows as a live preview. A texture shows the preview only if its material file exists. The addon makes the file when you release the button. One drop is one undo step.
The info tooltip of the active procedural brush shows one row "Materials: : , ...". The face names come from the face handles of the box. Other slots show "Face ".
Later: an outline of the target face, an eyedropper.
The "UV Mode", "UV Scale" and "UV Offset" attributes of the brush control the texture projection. See "UV projection".
The handles change the shape of a procedural brush (CsgBoxBrush, CsgSphereBrush, CsgCylinderBrush, CsgRingBrush, CsgWedgeBrush, CsgStairsBrush, CsgArchBrush) in the view. A brush with a model has no handles.
- Select exactly one node with a procedural brush. The handles show on the brush. With two or more selected nodes, no handles show.
- A point handle is a square. It moves freely. An axis handle is a circle with a short line. It moves only along its axis.
- The colors: a white point, an orange axis, a yellow handle under the cursor, a cyan selected handle. A tooltip shows the name of the handle.
- Click a handle to select it. The click does not change the node selection.
- Shift+click a point handle to add it to the selection or to remove it. An axis handle is always alone in the selection.
- A click on no handle clears the handle selection. The click then selects in the scene as usual.
- Escape clears the handle selection.
- Click a face of the result to select its brush and face handle. A subtract brush has no surface of its own: its cut faces select it. Ctrl toggles and Shift adds the brush, as in the stock selector. Only a plain click also selects the face handle.
- The face handle is the axis handle that is in line with the face (|dot(axis, normal)| > 0.9). The nearest one along its axis wins, then the lower id. A sphere gets its radius handle only if the normal is in line with an axis. A face on the base model, or a face of a removed brush, selects the root as usual.
- Alt+click selects the root, as the stock selector does. A click or a drag on a handle or on the gizmo does not pick a face.
- The selected handles get a translate gizmo at their center. The gizmo uses the world axes, or the axes of the node if the transform gizmo is in local space.
- Drag the gizmo to move the handles. A selected axis handle shows a long line along its axis. The handle follows the part of the drag along this line.
- While handles are selected, the transform gizmo of the node does not show and does not react.
- Hold Ctrl during the drag to snap the handle to the grid of the brush space. The first selected handle snaps. An axis handle snaps only along its axis. "Snap step" sets the grid step (default 0.125). 0 turns off the snap.
- Push Escape during the drag to cancel it. The shape goes back to the state before the drag.
- A move to a shape that is not valid keeps the last valid shape of the drag. A move back to the start position gives the start shape again, also with the Ctrl snap.
- Ctrl+Z or Ctrl+Y during the drag cancels the drag first. Then the undo or redo applies as usual.
- Two handles on the same screen point (for example the -Z and +Z faces seen along Z): the click picks the handle nearer to the camera.
- The result of the root updates during the drag. One undo step reverts a full drag.
- Recenter pivot: a drag moves a face or a corner, so the shape goes off the origin of its node. Then the node gizmo and the rotation pivot are in the wrong place. "Recenter pivot" moves the shape parameters so the shape is centered around the origin of the node. It moves the node by the same amount, so the shape in the world does not change.
- The editor recenters at the end of a drag if the check box "Recenter pivot after drag" is set (default on, setting
CsgEditor.AutoRecenter). It does not recenter during the drag, after a cancelled drag or after a drag that changed nothing. The toolbar button "Recenter pivot" and the command in the CSG menu does it for the active brush at any time. - The drag and the recenter are one undo step. Ctrl+Z reverts the shape and the node position together. The handle selection stays valid after a recenter.
- A sphere and a ring are always centered, so they do not recenter.
- A brush with "UV Mode"
Localcan shift its UV after a recenter, because the UV is in the local coordinates of the brush. The defaultRootis not changed. - The info tooltip of the toolbar has a shape part: the brush type, "Valid" or "Invalid", the number of selected handles and the name of the selected handle. The toolbar has the toggles "Show handles" and "Recenter pivot after drag", the button "Recenter pivot" and the "Snap step" field in the "Shape settings" popup. The CSG menu of the tab context menu has the same items. The editor settings keep them.
The handles of each shape:
| Shape | Handles |
|---|---|
| Box | 8 corners (points), 6 faces (axes), 12 edges (points) and 3 size handles (axes): 29 handles. A face moves its 4 corners. An edge moves its 2 corners. A size handle grows the box on its axis, on both sides. |
| Sphere | 6 radii (axes) at +X, -X, +Y, -Y, +Z and -Z. |
| Cylinder | The bottom and top centers (points), 4 bottom and 4 top radii (axes), the bulge (axis) and the bottom and top scale (axes). A radius at an apex and a bulge on a thin body are not offered. A radius handle sits on the polygon boundary: a drag divides the move by the ray distance k. |
| Ring | The major radius, the radial and the axial tube radius, and the arc end (axes). |
| Wedge | 6 faces (axes): the side triangles, the front edge, the back face, the top edge and the bottom. 3 size handles (axes). |
| Stairs | 6 faces (axes): the sides, the first riser, the back face, the top tread and the bottom. 3 size handles (axes). |
| Arch | The X and Y radius, the thickness, the depth and the arc end (axes). |
A shape has many handles. A mode shows only one group of them. The brush declares the groups at run time (GetHandleGroups, P_GROUPS). The editor filters by group.
| Shape | Groups (the first is the default) |
|---|---|
| Box | Face (20 to 25), Size (50 to 52), Edge (30 to 41), Corner (0 to 7) |
| Cylinder, cone, prism | Ends (0, 1, 11, 12), Radius (2 to 10) |
| Wedge, Stairs | Face (0 to 5), Size (6 to 8) |
| Sphere | Radius (0 to 5). One group: no mode bar. |
| Ring | Shape (0 to 3). One group: no mode bar. |
| Arch | Shape (0 to 4). One group: no mode bar. |
- The editor adds the mode "All" at the end. It shows all handles. A shape with fewer than 2 groups has no modes: all handles show.
- Push M for the next mode and Shift+M for the previous mode. The list wraps. The hotkeys are "Csg.NextHandleMode" and "Csg.PreviousHandleMode". They do nothing during a drag or while the right mouse button is down.
- The toolbar has the mode buttons F, S, E, C and A. The tooltip of a button shows the handle count, for example "Face (6 handles)". A click on a button sets the mode. The tooltip names the hotkeys. The buttons are off during a drag or if "Show handles" is off.
- The mode is a UI state. It is not in the undo stack. Each shape type keeps its own mode. The setting
CsgEditor.HandleModessaves them asCsgBoxBrush=Face;CsgCylinderBrush=Ends. An unknown mode gives the default mode. - The draw, the pick, the hover and the click on a face use only the handles of the active mode. A click on a face in the mode Size selects the Size handle of the axis. The modes Corner and Edge have no axis handle: the click selects the brush and no handle. The editor does not change the mode by itself.
- The selection is parked for each mode. A mode switch keeps the selected handles of the old mode and loads those of the new mode. A new active brush clears all of them. Escape clears only the list of the active mode.
- The mode "All" shows the face handle and the size handle at the same point. A click on a face picks the face handle (the lower id). In the mode "All" a Size handle lies exactly under its Face handle and the Face handle wins the click, so the Size handles work only in the Size mode.
GetFaceSlotOfHandlemaps only the box ids 20 to 25. The material row shows face names only for the box.- All handles draw as round dots. A dot is light gray, brighter if hovered. A selected dot is white and larger. An axis handle also has a short axis line.
- The cage is a faint dashed wire between the dots. It uses all handles of the shape, also the ones that the mode hides.
So the Face mode shows the cage with only the face dots. The toggle "Show cage" in the toolbar sets it
(default on, setting
CsgEditor.ShowCage). The cage draws only if the handles show. A line is skipped if an end is behind the camera. - The gizmo of a selected handle is the translate gizmo of the editor with the 3 arrows and the 3 plane squares. A drag on a plane square moves the handle on two axes.
CsgRoot::SaveResultModel(Serializer&)saves the applied result withModel::Save. It returns false if the root has no result. The materials stay outside the file.- The command "Bake to Asset" is in the CSG menu and in the toolbar. It needs a root with a result and a parent node.
- The file is
Models/<root name>_Baked.mdlin the resource directory of the scene file. If the scene has no resource file name, the data directory of the project is used. Without both, the command logs an error. - The command never overwrites a file. It appends _1, _2 and so on to the name.
- One undo step adds the sibling node " Baked" and disables the
CsgRootcomponent. The node has the local transform of the root and the same parent, so the world transforms are equal. ItsStaticModelhas the saved model and the materials of the result. - Undo removes the new node and enables the root. The file stays on the disk.
- This command is not
Bake().Bake()works at run time and removes the brush nodes. - The command refuses while the root builds or has a pending rebuild. It logs the warning "Bake to Asset: the result is still building. Try again." and changes nothing.
- The baked node has no collision. Add a
CollisionShapeor aRigidBodyto the baked node if you need collision.
- The info tooltip of the toolbar shows "Brushes N, tris N, last build X ms, reused K/N" and the vertex count. The data comes from
E_CSGROOTQUERYSTATS. - An invalid result adds the line "Invalid: " to the info tooltip.
- The info tooltip of a selected procedural brush shows "Size X x Y x Z". It is the local bounds of the generated mesh times the world scale of the node. The tooltip says so.
- The size comes from
E_CSGSHAPEQUERYBOUNDSofCsgShapeProtocol.h(out:P_VALID,P_MIN,P_MAX, local space). The event does not change the protocol version. The pure function isComputeShapeWorldSize. - While a handle drag runs, a tooltip near the cursor shows "Delta: x y z", the total delta in the local space of the brush, and the "Size".
The editor has no test harness for addons. Do these checks by hand:
- Start the editor with the project. The log shows "CSG editor addon is registered" and "Added dynamic plugin 'Plugin.CSG'".
- Open a scene. Make sure that the toolbar shows two "add" buttons and three operation buttons.
- Clear the selection. Put the cursor on the floor and push B. A node "CSG" with one child "Brush" appears at the cursor. The brush is selected.
- Push Shift+B. A second brush appears under the same root. The box cuts the first box.
- Push 3. The result changes to the intersection. The third operation button is active.
- Select two brushes. Push 1. Both brushes change to union.
- Push Ctrl+Z three times. The scene goes back to the state of step 4, step 3 and then an empty scene.
- Click in a text field of the inspector. Type "123b". The text field gets the characters. No brush is added and no operation changes.
- Select a node without CSG. Push 1. Nothing changes.
- Select the root. Drag a model into the view. A preview of the model moves with the cursor. Drop it. A new union brush appears at the cursor and is selected.
- Select the root. Drag a model and hold Shift at the drop. The new brush cuts the result.
- Select the root. Drag a model, then move the cursor out of the view and release. No brush stays in the scene.
- Select one brush. Drag a different model into the view. The brush shape changes during the drag. Drop it. Push Ctrl+Z. The old model comes back.
- Select two brushes. Drop a model. Both brushes change. One Ctrl+Z restores both.
- Select a brush. Drag a model out of the view again and release. The old model comes back.
- Select a node without CSG. Drop a model. The editor adds a plain node with the model, as before.
- Select the root. Drop a material or a prefab. The stock behavior applies.
- Select a root with the scale (72, 1, 82). Push B. The new brush has about the size of the box model, not 72 units.
- Remove
Plugin.CSGfrom the loaded plugins. Make sure that the toolbar buttons are not visible and that B does nothing. - Select "Sphere.mdl" in the preset combo. Push B. The new brush is a sphere. Restart the editor. The combo shows "Sphere.mdl".
- Select a brush of a root with two brushes. The info tooltip shows the root name, the build status and the stats. The hierarchy shows two brushes. The union brush has a green mark and a green wireframe. The subtract brush has red. Each wireframe has one color layer, not two.
- Push [ on the second brush. It moves to line 0 and the build status changes. Push Ctrl+Z. The old order comes back and the root rebuilds. Push Ctrl+Y. The move comes back.
- Push H. The line shows "(off)" and the result loses the brush. Push Ctrl+Z. The brush comes back.
- Click a brush in the hierarchy. The brush is selected and the brush controls of the toolbar show.
- Hover a CSG toolbar button. The tooltip shows the build status of the active root.
- Turn off "Draw Debug Geometry" in the tab context menu. No brush wireframes show.
- Add many brushes. The view shows no overlay and no list. The toolbar does not change its size.
- Select "Box" in the preset combo. Push B. A
CsgBoxBrushappears as a wireframe and the root rebuilds. The hierarchy shows "CsgBoxBrush" on the new node. - Change "Size" of the box in the inspector. The wireframe and the result change at once.
- Move "Corner 7" to (-1, 0.5, 0.5). The box is not valid: the wireframe goes, the result loses the brush and the log shows one warning. Set the corner back. The brush comes back.
- Set a material in slot 3 (+Y) of the box. Only the top face of the box gets the material. Clear slot 3. The top face uses the default material.
- Select a box brush and drop a model on it. The box does not change.
- Select "Sphere" in the preset combo. Push B. A
CsgSphereBrushappears as a wireframe and the root rebuilds. The hierarchy shows "CsgSphereBrush" on the new node. - Change "Radius", "Segments", "Rings" and "Smooth Normals" in the inspector. The wireframe and the result change at once. A value outside the range is clamped.
- Set a material in the slot of the sphere. The whole sphere gets the material. Drop a model on the sphere. The sphere does not change.
- Select "Cylinder" in the preset combo. Push B. A
CsgCylinderBrushappears as a wireframe and the root rebuilds. The hierarchy shows "CsgCylinderBrush" on the new node. - Set "Top Radius" to (0, 0). The brush is a cone and the top cap goes. Set a material in slot 1 and in slot 2. Only the bottom cap gets the slot 2 material.
- Move "Top Center" to (1, 1, 0). The axis tilts and the result stays closed. Swap the two centers in Y. The shape stays solid and is not inside out.
- Set "Bulge" to 2 and "Height Segments" to 4. The body bulges. Set both centers to the same point. The wireframe goes and the log shows one warning.
- Select "Ring" in the preset combo. Push B. A
CsgRingBrushappears as a wireframe and the root rebuilds. The hierarchy shows "CsgRingBrush" on the new node. - Set "Arc" to 180. The ring opens and the two end caps appear. Set a material in slot 4 and in slot 5. Each cap gets its own material.
- Set "Tube Segments" to 4 and "Tube Angle" to 45. The tube section is a square. Set "Tube Angle" to 0. The section is a diamond. Set a material in slot 3. Only the bottom of the ring gets it.
- Set "Tube Radius" to (5, 0.1). The radial radius goes down to 0.99 times "Radius". The ring stays solid. Subtract the ring from a box. The cut stays closed.
- Select a brush of a root with a textured material. Set "UV Mode" to
Root. The texture does not stretch on the faces and is not mirrored on any face seen from outside. - Add a second box next to the first one with the same material, "UV Mode"
Rootand the same "UV Scale". The texture continues over the joint with no step. - Move the first box along X. The texture stays in place in the world. Set "UV Scale" to 2. The texture is half the size. Change "UV Offset". The texture slides.
- Add a
CsgBrushwith a model. Its "UV Mode" isLocaland the texture looks as before. SetRoot. The texture changes to the world projection. - Select a brush. Drag a
.materialfrom the resource browser to the view. The tooltip shows "Material: " and the brush shows the material. Release. Undo restores the old material. Redo sets it again. - Drag a material onto a procedural box. All six slots get the material. Hold Ctrl: only the face under the cursor gets it.
- Select one brush of two union brushes. Drop a material on a face of the other brush. Only the other brush gets it. Drop on a face of the selected brush. Only that brush gets it.
- Drag a
.pngthat has no<name>.png.materialfile next to it. The tooltip shows the name of the new material. Release. The file<name>.png.materialappears in the resource browser and the brush shows the texture. Drop the same texture again. The file does not change. - Select only a CSG root. Drag a material over a face of the result. The brush of that face gets the material, as the selection does not matter.
- Select a brush, then drag a material onto another model that is not the CSG result. The stock editor assigns the material to that model, as before. Also select a plain node with a
StaticModeland drag a material onto it. The stock editor assigns the material, as before. - Select "Box" in the preset combo. Push B. The new box shows 8 white squares and 6 orange circles. The info tooltip shows "Shape: CsgBoxBrush" and "Valid".
- Click a corner. It turns cyan and a gizmo shows at the corner. The gizmo of the node goes. Drag the X arrow. The corner and the result follow. Push Ctrl+Z. The box comes back. Push Ctrl+Y. The move comes back.
- Shift+click two more corners. The info tooltip shows "Selected handles: 3". Drag the gizmo. The three corners move together.
- Click a face circle. Only the face is selected and a long line shows along its axis. Drag a gizmo arrow at an angle to the line. The face moves only along the line.
- Hold Ctrl and drag a corner. The corner stops on multiples of "Snap step" in the brush space. Set "Snap step" to 0. Ctrl does not snap.
- Start a drag and push Escape before the release. The box goes back to its shape before the drag. No undo step is added.
- Drag a face through the opposite face. The box keeps the last valid shape. Drag back to the start. The box gets its start shape. The log shows no error.
- Click on empty floor. The handle selection clears and the scene selection changes as usual. Select two brushes. No handles show.
- Repeat step 54 with the "Sphere", "Cylinder" and "Ring" presets. Each brush shows the handles of the table above.
- Clear "Show handles" in the toolbar. The handles go. Restart the editor. The check box stays clear.
- Select the root. Click a cut face of a subtract brush in the view. The brush becomes the selection. For a box, the face handle is cyan and the info tooltip shows "Selected handles: 1". Alt+click selects the root.
- Add a box. Drag a face handle by some distance. At the release the node gizmo and the handles show at the center of the box (check box on). Ctrl+Z restores the shape and the node position. Ctrl+Y gives the centered state again.
- Clear "Recenter pivot after drag". Drag a face. The box stays off the node origin. Use "Recenter pivot" in the toolbar. The origin goes to the center and the box does not move. Ctrl+Z reverts it. Restart the editor. The check box keeps its state.
- Push Escape during a drag. The shape and the node position stay as before the drag.
- Select "Wedge" in the preset combo. Push B. A
CsgWedgeBrushappears as a wireframe ramp and the root rebuilds. The hierarchy shows "CsgWedgeBrush" on the new node. - Drag the +Y handle of the wedge up. The slope gets steeper and the bottom stays on its plane. Drag the -Z handle. The front edge moves and the back face stays.
- Set a material in slot 2. Only the slope gets it. Subtract the wedge from a box. The ramp cut stays closed.
- Select "Stairs" in the preset combo. Push B. A
CsgStairsBrushappears as a wireframe with 5 steps and the root rebuilds. The hierarchy shows "CsgStairsBrush" on the new node. - Set "Steps" to 1, then to 64. The wireframe follows at once. Set a material in slot 0. Only the treads get it.
- Drag the +Z handle of the stairs. The treads get deeper and the front riser stays. Subtract the stairs from a box. The stair-shaped cut stays closed.
- Select "Arch" in the preset combo. Push B. A
CsgArchBrushappears as a wireframe half ring and the root rebuilds. The hierarchy shows "CsgArchBrush" on the new node. - Drag the thickness handle down into the hole. The wall gets thicker. At the full radius the arch is a filled half ellipse and the inner face goes.
- Drag the arc end handle. Both ends of the arch move and the handle stays under the cursor. The arc stops at 1 and at 180 degrees.
- Put a box wall in a root. Subtract an arch with "Thickness" equal to the radius and a box under it. The door cut stays closed. Set a material in slot 1. Only the inner face gets it.
- Make a CSG root with a box floor. Set "Generate Collision" on the root. Keep "Collision Static Body" set.
- Add a node above the floor with a sphere
StaticModel, a sphereCollisionShapeand aRigidBodywith mass 1. - Start play mode. The sphere falls and stops on the floor. Stop play mode.
- Subtract a box from the floor under the sphere. Start play mode. The sphere falls into the hole.
- Clear "Generate Collision". Start play mode. The sphere falls through the floor.
- Save the scene and open the file. It has no
CsgResultnode, no collision shape of the result and no body of the result. - Save the scene in a resource directory. Add a box brush with B. Choose "Bake to Asset" in the CSG menu. The file
Models/CSG_Baked.mdlappears in the resource directory. A node "CSG Baked" with the same shape appears and is selected. The root result is gone. - Choose "Bake to Asset" again after you enable the root. The new file is
Models/CSG_Baked_1.mdl. The first file stays. - Push Ctrl+Z. The node "CSG Baked" goes and the root result comes back. The file stays. Push Ctrl+Y. The node and the disabled root come back.
- Select a root with a brush. The info tooltip shows "Brushes 1, tris N, last build X ms, reused 0/1". Add a second brush. The line shows "Brushes 2" and "reused 1/2".
- Set the base model of a root to a model with an open face. Add a subtract brush. The info tooltip shows an "Invalid:" line with the reason.
- Add a box. The info tooltip shows "Size 1.000 x 1.000 x 1.000". Scale the node to 1, 2, 3. The size shows 1.000 x 2.000 x 3.000.
- Drag a face handle. While the mouse is down, a tooltip near the cursor shows "Delta: x y z" and "Size". After the release, the tooltip is gone.
- Add a box. The box shows 26 handles: 8 corners, 6 faces and 12 edges. The edge handles are squares at the midpoints of the edges.
- Drag an edge handle with the gizmo. The 2 corners of the edge move together and the other 6 corners stay. Select an edge and one of its corners with Shift+click. The shared corner moves once.
- Add a box. The info tooltip shows one row "Materials: Left: none, Right: none, ..." with six faces.
- Drop a material on the box in the view. The whole box shows the material. The row shows its name on each face. Drop a second material. The whole box changes again.
- Hold Ctrl over the +Y face of the box and drop a third material on it. Only the top face changes. The row shows the third material for "Top". Drop a plain material again. All faces, also the top, get it.
- Hold Ctrl and drop a material on one face. Only that face changes. Ctrl+Z restores the old materials in one step.
- Hold Shift and drop a material. The result is the same as a plain drop: all faces change.
- Select box A. Drop a material on box B (not selected). Only B changes and the selection stays on A. Select A and B, then drop on A. Both change.
- Drop a material on the base model of a root (no brush). The tooltip shows "No brush under the cursor" and nothing changes.
- Hold Ctrl and aim at the empty space beside a sphere face. Drop. Nothing changes and the tooltip shows "No face under the cursor".
- Open a scene whose box has only slot 0 set. Only the -X face shows the material. Drop a plain material. The box shows the new material on all faces.
- Select "Pyramid" in the preset combo. Push B. A pyramid appears as a wireframe with 4 flat faces. The base is a square of the size 1 by 1. The hierarchy shows "CsgCylinderBrush" on the new node.
- Select the pyramid. Select "Cone" and push B. A cone with a smooth side appears. Select "Hex Prism" and push B. A prism with 6 flat sides appears.
- Select the pyramid. Set "Face Radius" off and "Start Angle" to 0. The base becomes a diamond that touches the old square in the middle of its sides. Set "Start Angle" to 45 and "Face Radius" on. The square comes back.
- Select the pyramid. Drag the handle "Bottom Radius +X". It stays on the face of the base. Drag "Bottom Scale". Both radii change with one ratio and the handle follows the cursor.
- Drag "Top Scale" of a cylinder toward its center. The top becomes an apex and the cylinder becomes a cone. Drag the handle at the apex outward. The top grows back and the handle stays under the cursor.
- Add a box and a pyramid on its top face (the base of the pyramid has the size of the face). The result has no gap and no open edge.
- Drag a material over a box and hold Ctrl over one face, then release Ctrl while the mouse stays down. The preview goes from "only that face" back to "all faces". Push Escape. The box has its original materials, also a box with only slot 0 set.
- Select a box. Drag a material over the box and press Ctrl, then release Ctrl. Push Escape. The box has its original materials.
- Repeat check 109 and drop the material while Ctrl is down. Push Ctrl+Z. The box has its original materials.
- Add a box with B. The view shows 6 face handles. The toolbar has the mode buttons F, S, E, C and A. The tooltips show 6, 3, 12, 8 and 29 handles.
- Push M three times. The view shows the size handles, then the edges, then the corners. Push M two times more. All handles show, then the Face mode comes back.
- Push Shift+M. The mode "All" shows. Click a button of the mode bar. The mode changes. Drag a handle, push M during the drag. The mode does not change.
- In the Size mode, drag "Size X" by 0.5. The box grows by 1 on X and the center stays. Ctrl+Z reverts it.
- In the Face mode, click the +Y face handle. Push M until Corner shows, then until Face shows. The +Y handle is still selected. Drag a material over the +Y face with Ctrl: only the +Y face changes.
- Select a sphere. The toolbar has no mode buttons. M does nothing. Select a box again. The mode of the box is the same as before.
- Close the editor and open it again. The mode of the box and of the cylinder are the same as before.
- Add a box with B. The view shows 6 round gray face dots and a faint dashed cage with a cross on each face. Push M until "All" shows. Corner, edge and face dots are round and the dashed lines pass through the edge dots.
- Click a dot. The dot is white and larger. The gizmo shows 3 arrows and 3 small plane squares (red, green, blue). Drag a plane square. The handle moves on two axes.
- Clear "Show cage" in the toolbar. The dashed lines go and the dots stay. Restart the editor. The check box stays clear. Clear "Show handles". Set "Show cage": no line shows.
- Select a cylinder. A dashed line joins the two center dots. Select a sphere. No dashed line shows.
Currently it is not a simple task to load arbitrary resources and plugins from other directories, therefore you have to copy compiled plugin and sample scene into your editor build (be it SDK, or a build from source).
BUILD_PRESET=linux-gcc-x64-dll
SRC_PATH=/path/to/rbfx-src
cmake --preset $BUILD_PRESET -DCMAKE_INSTALL_PREFIX=$SRC_PATH
cmake --build --preset $BUILD_PRESET-debug
yes | cp cmake-build/$BUILD_PRESET/bin/Debug/libPlugin.CSG.so $SRC_PATH/cmake-build/$BUILD_PRESET/bin/Debug/
yes | cp -r SampleData/* $SRC_PATH/bin/Data/
pushd $SRC_PATH/cmake-build/$BUILD_PRESET/bin/Debug
./Editor $SRC_PATH/bin
popd
# 1. Load the plugin
# 2. Open Data/Scenes/CsgShowcase.scene- Drag a material from the resource browser into the view. Start over empty space, then move over a procedural box (also a subtract box, with another node selected). The box shows the material at once on all faces. Drop. The material stays. Push Ctrl+Z. The old state comes back.
- Repeat check 122 and hold Ctrl over the top face. Only the top face shows the material and the hint shows "Ctrl: only face Top". Move to the front face. The top face goes back and the front face changes. Release Ctrl. The whole box shows the material again. Push Escape. The box has its original materials.
- Hold Ctrl and drop on a face. Push Ctrl+Z. Only that face goes back. Hold Ctrl and aim at the empty space beside a result face: the hint shows "No face under the cursor" and the drop changes nothing.
- Drag a material over a normal model (not CSG) in a scene that has a CSG root. The model shows the material. Drop. Push Ctrl+Z. The old material comes back.
- Select nothing, or a node that is not CSG. The toolbar shows no CSG items and the view shows no overlay.
- Select a root. The toolbar shows the preset combo, the add buttons, "Bake to Asset" and the info button. It shows no operation, toggle, move or shape buttons.
- Select the result node of a root (click the result in the view with Alt). The toolbar shows the same items as for the root.
- Select a model brush. The toolbar shows the root items and the operation, toggle and move buttons. It shows no shape buttons and no mode buttons.
- Select a box brush. The toolbar also shows the mode buttons F, S, E, C and A and the toggles and buttons of the shape. Select a sphere: the mode buttons go.
- Hover the info button on a box brush. The tooltip shows the root stats and the shape lines. On a root it shows only the root stats.
- Hover "Bake to Asset" while the result builds. The button is off and the tooltip gives the reason.
- Open "Shape settings", change "Snap step" and restart the editor. The value stays.
- Open a root with a base model and a subtract brush, for example "Floor" in Graybox.scene. Drag a material from the Resources panel onto the floor, away from the brush. A tooltip "Drop: all faces" shows below the drag label. Release. The floor takes the material. Hold Ctrl: the hint is "Ctrl: only face base 0".
