Age | Commit message (Collapse) | Author |
|
Sculpt Vertex Colors is a painting system that runs inside sculpt mode, reusing all its tools and optimizations. This provides much better performance, easier to maintain code and more advanced features (new brush engine, filters, symmetry options, masks and face sets compatibility...). This is also the initial step for future features like vertex painting in Multires and brushes that can sculpt and paint at the same time.
This commit includes:
- SCULPT_UNDO_COLOR for undo support in sculpt mode
- SCULPT_UPDATE_COLOR and PBVH flags and rendering
- Sculpt Color API functions
- Sculpt capability for sculpt tools (only enabled in the Paint Brush for now)
- Rendering support in workbench (default to Sculpt Vertex Colors except in Vertex Paint)
- Conversion operator between MPropCol (Sculpt Vertex Colors) and MLoopCol (Vertex Paint)
- Remesher reprojection in the Voxel Remehser
- Paint Brush and Smear Brush with color smoothing in alt-smooth mode
- Parameters for the new brush engine (density, opacity, flow, wet paint mixing, tip scale) implemented in Sculpt Vertex Colors
- Color Filter
- Color picker (uses S shortcut, replaces smooth)
- Color selector in the top bar
Reviewed By: brecht
Maniphest Tasks: T72866
Differential Revision: https://developer.blender.org/D5975
|
|
This operator performs an edit operation in the active face set defined
by the cursor position and updates the visibility. For now, it has a
Grow and Shrink operations, similar to Select More/Less in edit mode or
to the mask filter Grow/Shrink modes. More operations can be added in
the future.
In multires, this updates the visibility of an entire face from the base
mesh at once, which makes it very convenient to edit the visible area
without manipulating the face set directly.
Reviewed By: sergey
Differential Revision: https://developer.blender.org/D7367
|
|
Instead of accumulating displacement for each vertex into the neighbors, accumulate the opposite displacement from each neighbor into the vertex. I think this is the same and it does not produce artifacts in Multires.
Reviewed By: sergey, brecht
Differential Revision: https://developer.blender.org/D7508
|
|
This tool is similar to the cloth brush, but it applies the cloth
simulation deformation to the whole mesh in an uniform way. The
simulation can be controlled using the mask to pin vertices and the face
sets to define force action areas.
It uses the same solver as the cloth brush which now no longer depends
on StrokeCache.
Reviewed By: sergey
Differential Revision: https://developer.blender.org/D7857
|
|
This was propsed in D7059, so I applied it to the rest of the code
Reviewed By: campbellbarton, sergey
Differential Revision: https://developer.blender.org/D7480
|
|
|
|
The grab mode was not correctly implemented, so the way it was working
was confusing for users.
- Grab delta was calculated in increments from the last stroke position, so it did not match the behavior of a grab brush. I refactored the grab delta calculation to make this change more explicit.
- Grab displacement was not calculated from the original coordinates
- Grab was using an incorrect strength
Grab is now setting the position of the affected vertices directly and
the constraints solve the rest of the cloth. I also tried to implement
an alternative version based on applying forces to move the vertices to
the grab position, but I think this is more controllable and the grab
falloff can be adjusted by tweaking the simulation falloff.
Reviewed By: sergey
Differential Revision: https://developer.blender.org/D7756
|
|
The only possible name for the iterator was ni, this should fix that.
Reviewed By: sergey
Differential Revision: https://developer.blender.org/D7774
|
|
|
|
|
|
This implements the restore function for Draw Face Sets and Layer, which
don't affect coordinates or masks directly. This is needed for the
anchored and dot brush strokes.
Layer frees the current displacement and a new one is created on each
stroke sample. Draw Face Sets copies the data back from the first undo
node to the mesh datalayer.
Also fixes T75727
Reviewed By: jbakker
Maniphest Tasks: T75727
Differential Revision: https://developer.blender.org/D7442
|
|
The Layer brush was in Blender before 2.81, when the sculpt API was
introduced. It had a huge amount of bugs and glitches which made it
almost unusable for anything but the most trivial cases. Also, it needed
some hacks in the code just to support the persistent base.
The brush was completely rewritten using the Sculpt API. It fulfills the
same use case as the old one, but it has:
- All previous artifacts fixed
- Simpler code
- Persistent base now works with multires thanks to the sculpt API
- Small cursor widget to preview the layer height
- More controllable and smoother strength and deformation
- More correct masking support
- More predictable invert support. When using persistent base, the brush invert mode resets to layer height 0, instead of jumping from +1 to -1. The brush can still be inverted in the brush direction property.
Reviewed By: jbakker
Differential Revision: https://developer.blender.org/D7147
|
|
This mesh filter sharpens and smooths the mesh based on its curvature,
resulting in pinching hard edges and polishing flat surfaces. It fixes
most of the artifacts of the voxel remesher and those produced when
sculpting hard surfaces and stylized models with creasing and flattening
brushes.
It needs and accumulate_displacement step before each filter iteration which
can't be multithreaded in an easy way (it would need something to sync the
threads when modifying the data of neighbors in a different node), but this
does not affect performance in a significant way.
Reviewed By: brecht
Differential Revision: https://developer.blender.org/D7335
|
|
The idea is to push both base mesh geometry and PBVH coordinates
so it is possible to undo everything without loosing data which was
not flushed from sculpt session to base mesh.
It is possible do memory optimization to avoid push custom data
layers which are not touched by operator, but before doing that
better to ensure this is a correct and working approach.
Differential Revision: https://developer.blender.org/D7381
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Differential Revision: https://developer.blender.org/D7018
|
|
|
|
Made it so there is a single UNDO node in the list which has
both original and modified mesh state.
Makes it easier to achieve "interleaved" undo nodes stored in
the undo step (as opposite of either storing geometry or other
data).
Should be no functional changes, just preparing for an upcoming
work to support undo of operation like Apply Base.
Differential Revision: https://developer.blender.org/D7290
|
|
This commit introduces a new mode for calculating the positions and
weights of the IK segments in the Pose Brush based on the Face Sets.
The first segment of the chain will always include all face sets inside
the brush radius and it will propagate until the boundary of the last
face sets added in the flood fill. Then consecutive connected face sets
are added to the chain until the chain length limit is reached or all
face sets of the mesh are already part of the chain.
This feature enables complete control over the pose brush origins in
case that is needed. Also, with this mode, the user can have a library
of base meshes with face sets already configured to get to the initial
pose as fast as possible.
Reviewed By: jbakker
Differential Revision: https://developer.blender.org/D7235
|
|
Previously, all vertices inside the brush radius were taken into account
equally when calculating the sculpt normal and area. This was causing
artifacts and unpredictable results with large brushes or meshes with
curvatures, as the strongest deformation point of all brushes is usually
in the center. By weighting the vertex normal and position towards the
center when sampling, all brushes should now behave in a more
predictable way in non-uniform surfaces.
Reviewed By: jbakker
Differential Revision: https://developer.blender.org/D6989
|
|
Also use sculpt prefix for SCULPT_CLAY_STABILIZER_LEN.
|
|
This implements the Surface Smooth Brush as a mode inside the Smooth tool,
which uses the HC algorithm from "Improved Laplacian Smoothing of Noisy Surface Meshes".
Comparted to the regular smooth brush with laplacian smooth, this brush removes
the surface while preserving the volume of the object.
The smooth result can be controlled by tweaing the original shape preservation,
displacement and iteration count.
The same surface smooth operation is also available as a mesh filter.
Reviewed By: jbakker
Differential Revision: https://developer.blender.org/D7057
|
|
|
|
If the relax mesh filter was used on a non manifold mesh with open
boundaries, all the vertices were relaxed and the mesh was shrinking.
This was an unintended behavior that was making the filter unusable with
these meshes.
The mesh filter is now initializing an automasking buffer using the same
boundary automasking function from the brush code. Now edges are
preserved and the relax filter works as it should.
Reviewed By: jbakker
Differential Revision: https://developer.blender.org/D7097
|
|
This enables a relax operation that works only on face sets boundaries,
which smooths the jagged edges that are produced when painting or
expanding face sets by sliding the topology without affecting the shape
of the mesh. This has many uses in hard surface sculpting for things
like sculpting panels or smoothing surfaces. It can also help when
working with remeshed topology as it makes the face sets looks better
and more organized if needed.
The operation is implemented as an Shift smooth in the Draw Face sets
tool, similar to the Slide/Relax tool.
The same operation is also available in the mesh filter to smooth all
the face sets boundaries uniformly or to smooth the face set under the
cursor with the Use Face Sets option.
Reviewed By: brecht
Differential Revision: https://developer.blender.org/D7034
|
|
The cloth brush was not using the automasking values when calculating
the mask value on each vertex.
Reviewed By: brecht
Differential Revision: https://developer.blender.org/D7083
|
|
The old convention was easy to confuse with ScrArea.
Part of https://developer.blender.org/T74432.
This is mostly a batch rename with some manual fixing. Only single word
variable names are changed, no prefixed/suffixed names.
Brecht van Lommel and Campbell Barton both gave me a green light for
this convention change.
Also ran clan clang format on affected files.
|
|
|
|
|
|
|
|
|
|
Face Sets are the new system to control the visibility state of the mesh in sculpt and paint modes. They are designed to work in modes where brushes are the primary way of interaction and they provide much more control when working with meshes with complex shapes and overlapping surfaces.
This initial commit includes:
- Sculpt Face Sets data structures and PBVH rendering.
- Face Set overlay and opacity controls.
- Sculpt Undo support.
- Remesher reprojection support. The visibility state of the mesh is also preserved when remeshing.
- Automasking and Mesh filter support.
- Mask expand operator mode to expand Face Sets (Shift + W) and flood fill areas by connectivity (press Ctrl while expanding).
- Sculpt Mode Face Sets and Visibility API.
- Sculpt Face Sets creation and visibility management operators.
- Operator to randomize the Face Sets colors.
- Draw Face Sets brush tool to create and edit the Face Sets. Drawing on the mesh creates a new Face Set. Pressing Ctrl before drawing modifies the Face Set under the brush at the beginning of the stroke.
- Updated keymap and menu to work with Face Sets from Sculpt Mode (H to toggle visibility, Alt + H to show all, Shit + H to hide).
- Pie menu on the W key with Face common Sets operations.
Know limitations:
- Multires support. The Face Sets and Visibility API needs to be implemented for Multires.
Reviewed By: jbakker, #user_interface, Severin
Differential Revision: https://developer.blender.org/D6070
|
|
Use of undefined GSQueue type was causing build errors.
|
|
Reviewed By: brecht
Differential Revision: https://developer.blender.org/D6973
|
|
This includes the following changes:
- Use always the angle stored in the StrokeCache when deforming
- Interpolate between the previous and the new sampled angles
- Calculate the cursor matrix only on the 0 radial symmetry iteration
Reviewed By: brecht
Maniphest Tasks: T73947
Differential Revision: https://developer.blender.org/D6901
|
|
This brush has a simple physics solver that helps when sculpting cloth.
- The mass and the damping properties of the simulation are properties of the brush.
- It has two additional radius control to limit the influence and falloff of the simulation.
- Masked vertices are pinned in the simulation, and it applies the sculpt gravity directly in the solver.
- The Cloth Brush has 7 deformation modes with 2 falloff types (radial and plane).
The brush can create the constraints only on the required PBVH nodes, so the simulation is isolated on high poly meshes. As long
as the brush size is not too big it should be possible to keep it real time.
Known issues:
- The way constraints are created is extremely basic and it creates repeated constraints. Maybe there is another way to create fewer constraints while keeping the simulation quality decent. This part can also be multithreaded. (As it is it works ok, but it could be better)
Reviewed By: jbakker
Differential Revision: https://developer.blender.org/D6715
|
|
By pinching this way, we can fix some artifacts when sculpting following
the topology direction. It does not make much difference with dyntopo/
remesher, but I think this should improve the quality of the brush when
working with Multires.
Reviewed By: JulienKaspar, jbakker
Differential Revision: https://developer.blender.org/D6587
|
|
|
|
This enables an extra layer of control in the sculpt brushes.
For now it is enabled only in Scrape, but it should work in all brushes (like normal radius). In the future it may also be enabled in other brushes.
You can tweak in this property in the scrape brush to achieve a much better behavior when working on curve surfaces and control how much volume you want to trim. In most cases, it also fixes the bug where the brush keeps trimming in the same area without disabling accumulate.
It should be possible to fix some other artifacts in other brushes by tweaking this default property.
Reviewed By: jbakker
Differential Revision: https://developer.blender.org/D5993
|
|
This patch allow to change the brush tip shape between a square and a
circle using a brush property.
After this change we are no longer testing the distance against a cube
(the Z axis is not used). I did not test this in depth, but if it does
not produce any artifacts I think we can keep it this way instead of
adding more complexity to the code.
In this new distance test the brush falloff is only applied on the
rounded parts of the square to avoid sharp artifacts in the
diagonals. Because of this, the round version is much softer than
the square one. The planned hardness property will fix this, but
this can also be avoided by setting the fallof to a custom curve.
Reviewed By: jbakker
Differential Revision: https://developer.blender.org/D6165
|
|
This brush simulates deforming clay with your fingers, accumulating
material during the stroke. It has a plane that tilts during the stroke
in the front part of the brush to achieve this effect.
Reviewed By: jbakker
Differential Revision: https://developer.blender.org/D6238
|
|
|
|
PoseIKChain for example reads as if this is related to armature/pose
when it's a sculpting feature.
|
|
This commits introduces the pose_ik_segments brush property in the Pose Brush. When increasing the IK segments count, the brush generates more segments and weights associations following the topology of the mesh. When moving the brush, these segments are transformed using an IK solver and they are used to deform the mesh.
When pressing Ctrl, the brush controls the segments' roll rotation instead of using the IK solver. The brush falloff controls how much rotation is propagated from the first to the last segment in the chain.
Reviewed By: jbakker
Differential Revision: https://developer.blender.org/D6389
|
|
Some other areas in the brush code outside sculpt mode assume that
pressure is multiplied directly on top of the initial size. This patch
calculates the pixel radius correctly using the brush size from sculpt
mode to get the dyntopo detail size.
When the new brush input system is in place, all these values will come
directly from the brush input code with all the custom curves applied
per brush, so all paint modes will have a correct brush behavior and all
this sculpt mode specific code won't be necessary.
Reviewed By: jbakker
Maniphest Tasks: T72092
Differential Revision: https://developer.blender.org/D6339
|