Page MenuHome

Sculpt: Cloth Snake Hook Brush
ClosedPublic

Authored by Pablo Dobarro (pablodp606) on Aug 18 2020, 11:40 PM.
Tags
None
Tokens
"Dat Boi" token, awarded by shader."Love" token, awarded by ZohaibAli."Love" token, awarded by Raimund58."Love" token, awarded by DaveDeer."Burninate" token, awarded by lopoIsaac."Like" token, awarded by YAFU."Love" token, awarded by n-pigeon."Love" token, awarded by Anubis."Burninate" token, awarded by DiogoX2."Love" token, awarded by SteffenD."Like" token, awarded by Frozen_Death_Knight.

Details

Summary

This implements Snake Hook as a deform type for the cloth brush. This
brush changes the strength of the deformation constraints per brush step
to avoid affecting the results of the simulation as much as possible. It
allows to grab the cloth without producing any artifacts in the surface
and create more natural looking folds than any of the other deformation
modes.

Diff Detail

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

Event Timeline

Pablo Dobarro (pablodp606) requested review of this revision.Aug 18 2020, 11:40 PM
Pablo Dobarro (pablodp606) created this revision.
Sergey Sharybin (sergey) requested changes to this revision.Aug 19 2020, 9:50 AM
Sergey Sharybin (sergey) added inline comments.
source/blender/blenkernel/BKE_paint.h
289

eSculptClothConstraintType type;

source/blender/editors/sculpt_paint/sculpt.c
6637–6650

I would say that the following is easier to follow:

if (ELEM(brush->sculpt_tool,
         SCULPT_TOOL_GRAB,
         SCULPT_TOOL_POSE,
         SCULPT_TOOL_BOUNDARY,
         SCULPT_TOOL_THUMB,
         SCULPT_TOOL_ELASTIC_DEFORM))
{
  return true;
}

if (brush->sculpt_tool == SCULPT_TOOL_CLOTH &&
    brush->cloth_deform_type == BRUSH_CLOTH_DEFORM_GRAB)
{
  return true;
}

return false;
This revision now requires changes to proceed.Aug 19 2020, 9:50 AM

For some other brushes a "Deformation Target" option as added rather than adding a mode to the cloth brush. I assume there is a reason that isn't done here.
The combination of the two changes, "Deformation Target" and "Deformation" option in the cloth brush might be confusing, i.e. if we end up with some brushes having a cloth "mode" and others with a corresponding deformation type in the cloth brush it's not clear at the user level why that difference exists.

I may be missing something though, it would just be nice to know this was considered.

Pablo Dobarro (pablodp606) marked 2 inline comments as done.
  • Review Update

@Hans Goudey (HooglyBoogly) Brushes that support cloth deformation target are just moving the deformation coordinates of the simulation to make the cloth adapt to a new shape. The deformation modes of the cloth brush modify the simulation in different ways (by using forces, by changing the constraints properties...) in order to achieve the best cloth effects possible. Even if this is called shake hook, the deformation code of this brush has nothing to do with the regular snake hook brush (which is something that also happens with the rest of the cloth deform modes).
After having the asset manager and a brush management system this won't be an issue because users will be able to choose a cloth brush preset directly without knowing if it is a regular brush deforming the simulation or something else implemented in a different way as part of the cloth brush.

@Pablo Dobarro (pablodp606) Thanks for the explanation!

...the deformation code of this brush has nothing to do with the regular snake hook brush

In that case it would probably make sense to use different naming for this deformation type. I tested it and didn't really notice any overlap between this and the snake hook brush.

@Hans Goudey (HooglyBoogly) It is using a similar way to deform the mesh, but the implementation is different. Also, the default preset for geometry snake hook is quite different from this, but you can make them almost the same.

Not related to this patch, but this is what I was talking about here https://developer.blender.org/T70412#988717. Even if we change the name or add better descriptions, in order to make the cloth brushes work like in my demos you need to configure a lot of parameters in a particular way, an currently, a brush tool can only reset to one preset. Those presets should include all the options correctly configured and ready to use, so unless you want to tweak a brush for a specific purpose you should not be using any of the menus and properties we currently have. With the current UI and brush management design, tools like cloth, pose or boundary are almost impossible to use, and a lot of brush functionalities in the other tools is hidden because we started to merge brushes into deform modes just to reduce the number of icons in the toolbar so it can be used as a replacement for a brush management system.

Yes, brush management will hugely improve this whole situation, that will be really nice. However, IMO, the fact that we can ship better
defaults in the future with preconfigured settings doesn't mean we don't have to consider proper naming and clarity for all the settings.

It just seems odd to use the name of a tool that the cloth brush could possibly look like with this deformation mode with the right settings.

Actually, I'll go back to your original patch description:

It allows to grab the cloth without producing any artifacts in the surface
and create more natural looking folds than any of the other deformation
modes.

Based on this, it seems like a better version of the grab deformation type. Why not update that one?

I'm sorry if my scrutiny seems unwarranted-- it is probably a bit unfair to comment without knowledge of many of the intricacies of the area.
But I'm noticing that it's becoming common to add new options rather than improving the behavior of existing ones, and I'm worried that will
have the effect of making the tools more overwhelming to use than they need to be.

@Hans Goudey (HooglyBoogly) Grab uses an anchored position for the delta and deformation coordinates, Snake Hook is incremental per brush iteration based on the previous position. So basically, grab allows to create brushes that do this, snake hook does not

Also, as you see in the video of my previous comment, snake hook stops grabbing the cloth when the structural constraints prevent it from stretch further, grab never releases the cloth, no matter how much you deform it.

The code seems fine.

The naming I will leave up to you to come to conclusion before commit.

source/blender/editors/sculpt_paint/sculpt_cloth.c
741–742

(cloth_sim->deformation_strength[v1] + cloth_sim->deformation_strength[v2]) * 0.5f;

Less CPU instructions ;)

This revision is now accepted and ready to land.Aug 24 2020, 9:34 AM
This revision was automatically updated to reflect the committed changes.
Pablo Dobarro (pablodp606) marked an inline comment as done.

@Hans Goudey (HooglyBoogly) I committed this because I need the constraints type flags to continue developing the solver, but I want to revisit all the UI naming for all the deformers during 2.91 bcon2 once the design is more polished. If I change the solver for 2.91 probably most of these brushes won't behave like you are seeing in the current demos.

@Hans Goudey (HooglyBoogly) I committed this because I need the constraints type flags to continue developing the solver, but I want to revisit all the UI naming for all the deformers during 2.91 bcon2 once the design is more polished. If I change the solver for 2.91 probably most of these brushes won't behave like you are seeing in the current demos.

Sounds good! Thanks for letting me know.