Age | Commit message (Collapse) | Author |
|
If one of the faces connected to a vertex is hidden in the face sets, we
can assume that the vertex is part of a boundary edge, so it should be
cosidered like that in all automasking and edge detection functions.
Reviewed By: jbakker
Differential Revision: https://developer.blender.org/D7126
|
|
The idea of the visibility system is that tools should behave like
hidden vertices do not exist, so the flood fill operation should ignore
hidden vertices for all operators.
Reviewed By: jbakker
Differential Revision: https://developer.blender.org/D7125
|
|
The face set ID is sequential, so implementing this was straightforward.
Suggested by Jeroen Bakker
Reviewed By: jbakker
Differential Revision: https://developer.blender.org/D7123
|
|
The face_set_set function which sets a face sets given a vertex index
can ignore all modifications to hidden face sets, so we can skip all
vertex visibility checks outside that function. This makes the code
faster, simpler and fixes multiple bugs.
Reviewed By: jbakker
Differential Revision: https://developer.blender.org/D7122
|
|
colors
The previous solution was also working fine as the white face set has no
meaning, but now it is a little bit more random. Also, bigger face sets
have more chance of getting the white color.
Reviewed By: jbakker
Maniphest Tasks: T74646
Differential Revision: https://developer.blender.org/D7111
|
|
The mesh provided in the report has 0 area faces and overlapping
vertices, causing the relax code to fail when calculating the plane to
constraint the vertex movement. Now it works fine both in the brush and
in the mesh filter.
Reviewed By: jbakker
Maniphest Tasks: T74648
Differential Revision: https://developer.blender.org/D7109
|
|
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
|
|
Reviewers: pablodp606
Differential Revision: https://developer.blender.org/D7095
|
|
All sculpt operators and brushes need to use ID_RECALC_SHADING even when
PBVH rendering is not used.
|
|
I could not reproduce the issue, but it looks like it was produced by
this division by 0. In any case, the code here was wrong.
Reviewed By: jbakker
Maniphest Tasks: T74354
Differential Revision: https://developer.blender.org/D6987
|
|
This automasking option protects the open boundary edges of the mesh from the brush deformation. This is needed to sculpt cloths and it works nicely with the cloth brush.
It has a Propagation Steps property that controls the falloff of the mask from the edge.
Limitations:
- The automask is recalculated at the beginning of each stroke, creating a little bit of lag in high poly meshes, but it is not necessary. This can be fixed in the future by caching the edge distances, increasing a little bit the complexity of the code.
- The boundary vertex detection in meshes is not ideal and it fails with triangulated geometry, but it is the same as in the smooth brush. After fixing this, we should refactor the smooth brush to use the API and let the automasking option manually control the affected vertices.
- It does not work in Multires (it needs to be implemented in the API). The smooth brush in Multires is also not making boundary vertices.
- The falloff has a visible line artifact on grid patterns. We can smooth the final automasking factors several iterations, but it will make the initialization much slower. This can also be added in the future if we decided to cache the distances.
Reviewed By: jbakker
Differential Revision: https://developer.blender.org/D6705
|
|
This introduces a variable to store a face set ID which is going to be
rendered white. When initializing a mesh or randomizing the colors, this
variable gets updated to always render a white face set. This way the
face set overlay can be enabled without adding colors to the mesh if
face sets are not in use. After creating the first face set, new colors
are generated randomly like usual.
The face set stored as default does not have any special meaning for
tools or brushes, it just affects the rendering color.
Reviewed By: brecht
Differential Revision: https://developer.blender.org/D7035
|
|
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
|
|
Create face sets by visibility needs to check if all face sets of a
vertex are visible to set the new face set. I renamed the functions to
make this more cleare in the API.
I also added a visibility check when creating by mask to avoid modifying
hidden areas.
Reviewed By: brecht
Maniphest Tasks: T74499
Differential Revision: https://developer.blender.org/D7048
|
|
Hardness is now a property implemented for all brushes, so this is no
longer needed.
Reviewed By: brecht
Differential Revision: https://developer.blender.org/D7078
|
|
The operator was resetting the mask data when cancelling instead of the
face set data, so it was crashing because mask data was not available
when starting the operator in expand face set mode.
Reviewed By: brecht
Maniphest Tasks: T74492
Differential Revision: https://developer.blender.org/D7043
|
|
While it might be handy to have type-less functionality which is
similar to how C++ math is implemented it can not be easily achieved
with just preprocessor in a way which does not have side-effects on
wrong usage.
There macros where often used on a non-trivial expression, and there
was at least one usage where it was causing an actual side effect/bug
on Windows (see change around square_f(sh[index++]) in studiolight.c).
For such cases it is handy to have a function which is guaranteed to
have zero side-effects. The motivation behind actually removing the
macros is that there is already a way to do similar calculation. Also,
not having such macros is a way to guarantee that its usage is not
changed in a way which have side-effects and that it's not used as an
inspiration for cases where it should not be used.
Differential Revision: https://developer.blender.org/D7051
|
|
Missing changes from one of the renamings of the initial face sets
patch.
Reviewed By: brecht
Maniphest Tasks: T74513
Differential Revision: https://developer.blender.org/D7054
|
|
The initial iteration for all symmetry areas is always 0. We were using
1 for the main stroke, so it was 1 step behind.
This was broken for expanding masks and face sets, but with face sets it
is more noticeable.
Reviewed By: brecht
Maniphest Tasks: T74501
Differential Revision: https://developer.blender.org/D7050
|
|
By using PBVH_ITER_UNIQUE hidden vertices are skipped, like in the rest of
the brushes and tools.
Reviewed By: brecht
Maniphest Tasks: T74498
Differential Revision: https://developer.blender.org/D7047
|
|
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
|
|
|
|
It was missing this local space conversion before calculating the rake
angle.
Reviewed By: jbakker
Differential Revision: https://developer.blender.org/D7008
|
|
Clay Thumb was using a custom hardness implementation and value to make
it functional. Hardness is now a property of brushes and it is
implemented for all brushes, so this is no longer needed.
Reviewed By: brecht
Differential Revision: https://developer.blender.org/D6981
|
|
The hardness property moves the brush falloff towards the edges, making
the brush sharper.
This should be the intended way to control the brush falloff instead of
tweaking the falloff curve manually, as it can be mapped to pressure to
make the falloff variable during the stroke.
It is also a good idea to show in the UI that the custom curves is an
advance features and it should almost never be modified when sculpting/
painting unless you want to create some advanced effects. By modifying
the curves freely it is really easy to break the brushes and make them
produce artifacts. This needs to be done in a later after merging the
pending projects to reorganize all the brush properties accordingly.
Reviewed By: brecht
Differential Revision: https://developer.blender.org/D6902
|
|
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
|
|
The coordinates should be read from the PBVH when using deform modifiers.
This is needed for the cloth brush to work with subdivisions, as it reads the
vertex coordinates using this function when building and updating the
constraints.
Reviewed By: jbakker
Differential Revision: https://developer.blender.org/D6967
|
|
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
|
|
Reviewers: brecht
|
|
|
|
|
|
|
|
|
|
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
|
|
The IK chain was using an anchor point by default as it makes sense for
posing, but for creating curved shapes it is useful to be able to
disable it.
Reviewed By: jbakker
Differential Revision: https://developer.blender.org/D6584
|
|
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
|
|
Reviewed By: brecht
Differential Revision: https://developer.blender.org/D6788
|
|
Reviewed By: brecht
Differential Revision: https://developer.blender.org/D6792
|
|
This reverts commit 394b48029c5335381f774f83524ad6ee5cb986da.
Leaving this here does not affect performance in any significant way and it may be useful in the future.
Reviewed By: brecht
Differential Revision: https://developer.blender.org/D6688
|
|
Note that `BKE_library.h`/`library.c` were renamed to
`BKE_lib_id.h`/`lib_id.c` to avoid having a too generic name here.
Part of T72604.
|
|
- Replace 'unsigned' used on it's own with 'uint'.
- Replace 'unsigned const char' with 'const uchar'.
|
|
|