Page MenuHome

Sculpt: Cloth Brush Soft Body strength property
ClosedPublic

Authored by Pablo Dobarro (pablodp606) on May 26 2020, 10:00 PM.
Tags
None
Tokens
"Love" token, awarded by gilberto_rodrigues."Burninate" token, awarded by Dir-Surya."Love" token, awarded by franMarz."Pterodactyl" token, awarded by AnityEx."100" token, awarded by Frozen_Death_Knight."Love" token, awarded by CodyWinch.

Details

Summary

This property adds constraints to the simulation using the initial
location of the vertices, making it behave like a soft body. The
strength of these constraints can be modified with the brush parameter.
This makes some deformation modes more subtle and predictable, making it
possible to use the cloth brush to add surface detail in a more
controllable way without loosing completely the original shape of the
mesh.

Diff Detail

Repository
rB Blender
Branch
sculpt-cloth-softbody (branched from master)
Build Status
Buildable 8228
Build 8228: arc lint + arc unit

Event Timeline

Pablo Dobarro (pablodp606) requested review of this revision.May 26 2020, 10:00 PM
Pablo Dobarro (pablodp606) created this revision.

Is there a more descriptive name that could be used like "Shape Preservation" or similar? Soft body doesn't tell me anything like that as an artist.

Sergey Sharybin (sergey) requested changes to this revision.May 27 2020, 9:48 AM
Sergey Sharybin (sergey) added inline comments.
source/blender/blenkernel/BKE_paint.h
261–265

What are the v's and p's here?
Surely you can find better naming and comment what exactly that is.

source/blender/editors/sculpt_paint/sculpt_cloth.c
133

This seems weird to me.
You advance the number of constraints and write to the new constraint, and only then do reallocation. Sounds like you've got write past array boundaries here.

144–151

You can avoid having repetitive cloth_sim->length_constraints[cloth_sim->tot_length_constraints]. by storing constraint you're writing to in a variable:

SculptClothLengthConstraint *length_constraint = &cloth_sim->length_constraints[cloth_sim->tot_length_constraints];
length_constraint->v1 = v;
...

Same goes to the cloth_brush_add_length_constraint().

533–535

Can move this outside of if() statement, (aka, always do it) and then have if (v1 != v2) { /* madd v2 */ }.

source/blender/makesrna/intern/rna_brush.c
2398–2399

I don't think strength is a correct word here. It is usually called influence in other areas of Blender. But then semantic seems to be inverted: higher the strength closer to original shape object is (so influence is actually lower?)

This revision now requires changes to proceed.May 27 2020, 9:48 AM
Pablo Dobarro (pablodp606) marked 5 inline comments as done.
  • Review update
source/blender/makesrna/intern/rna_brush.c
2398–2399

I renamed the property to influence only in the UI. I would like to check what you think before renaming all the internal properties because my idea would be to use this same implementation to add controls for the tension/compression, shear and bending constraints in the future. This property should just be another one on that list. In that case, it would be the influence of the original shape in the result, not the influence of the brush.

I renamed the property to influence only in the UI. I would like to check what you think before renaming all the internal properties because my idea would be to use this same implementation to add controls for the tension/compression, shear and bending constraints in the future. This property should just be another one on that list. In that case, it would be the influence of the original shape in the result, not the influence of the brush.

I feel weird about such "inversed" meaning of slider in the brush settings: something in the brush settings which means brush has less effect when slider is at higher values? Seems counter-intuitive and not aligned with the rest of Blender UI.

@Julian Eisel (Severin), can I have input and suggestions from the UI team here? ;)

source/blender/blenkernel/BKE_paint.h
270

Add a note that elem_position points to the position which is owned by the element.

'Soft Body Strength' is kinda unclear if i were u i would consider another name, my suggestion is 'Deformation Resistance'

Pablo Dobarro (pablodp606) marked an inline comment as done.
  • Review Update

@Sergey Sharybin (sergey) @Julian Eisel (Severin) I think this is now ready, the only thing missing is to decide a final name for the property. To me, it makes sense to have it as it is now because the property controls the strength of a set of constraints (similar to what is being developed in D8062). The strength of these constraints is what limits the effect of the brush, not the other way around. The mass property also works this way, the higher the mass the weaker the brush deformation is.

@Sergey Sharybin (sergey) Is it ok to commit this? I need the softbody constraints to fix a bug with the simulation of the grab brush

From my side its fine.

Still didn't hear anything from Julian. Not sure if he wants to have a pass here.

This revision is now accepted and ready to land.Jul 28 2020, 10:08 AM