Page MenuHome

Sculpt: Elastic deform type for Snake Hook
ClosedPublic

Authored by Pablo Dobarro (pablodp606) on Nov 14 2020, 12:11 AM.
Tags
None
Tokens
"Love" token, awarded by shader."Love" token, awarded by verbal007."Love" token, awarded by n-pigeon."Like" token, awarded by MetinSeven."Love" token, awarded by jmztn."Love" token, awarded by ThomasJohann."Love" token, awarded by kouza.

Details

Summary

This adds deformation types to snake hook and the elastic deformation
type. This mode deforms the mesh using a kelvinlet instead of applying
the displacement directly inside the brush radius, which is great for
stylized shapes sketching.

Changes in rake rotation when using elastic are too strong when set
to 1, so I'll add a nicer way to support rake rotations with smoother
transitions in the future.

Diff Detail

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

Event Timeline

Pablo Dobarro (pablodp606) requested review of this revision.Nov 14 2020, 12:11 AM
Sergey Sharybin (sergey) requested changes to this revision.Nov 16 2020, 9:56 AM

Interesting results, but from quick glance:

  • Seems that deformation propagates way further away than the brush radius.
  • The behavior doesn't really look to be snake hook so much. It is something like grab or something. If sculpt team thinks it's clearest to have it in hook, then fine.

@Julien Kaspar (JulienKaspar) @Dalai Felinto (dfelinto), @Pablo Dobarro (pablodp606) I am also very curios of what is the roadmap for adding more options, more tools, making it easy to use new tools, working on brush management and topics like that. This is a reoccurring topic, without clear answer to me.

source/blender/editors/sculpt_paint/sculpt.c
4249–4265

First do cheap check, then the expensive one,.

5739–5742

Please move this to an inlined function, where you can more easily split branches and document every one of them.

This revision now requires changes to proceed.Nov 16 2020, 9:56 AM
Pablo Dobarro (pablodp606) marked an inline comment as done.
Pablo Dobarro (pablodp606) edited the summary of this revision. (Show Details)
  • review update
source/blender/editors/sculpt_paint/sculpt_intern.h
440–455

I'd say the following is easier to read, understand, and tweak in the future.
The amount of comparisons is the same as in the "compact" form.

if (brush->sculpt_tool == SCULPT_TOOL_ELASTIC_DEFORM) {
  /* Elastic deformations in any brush need all nodes to avoid artifacts as the effect
    * of the Kelvinlet is not constrained by the radius. */
  return true;
}

if (brush->sculpt_tool == SCULPT_TOOL_POSE) {
  /* Pose needs all nodes because it applies all symmetry iterations at the same time
    * and the IK chain can grow to any area of the model. */
  /* TODO: This can be optimized by filtering the nodes after calculating the chain. */
  return true;
}

if (brush->sculpt_tool == SCULPT_TOOL_POSE) {
  /* Boundary needs all nodes because it is not possible to know where the boundary
    * deformation is going to be propagated before calculating it. */
  /* TODO: after calculating the boudnary info in the first iteration, it should be
    * possible to get the nodes that have vertices included in any boundary deformation
    * and cache them. */
  return true;
}

if (brush->sculpt_tool == SCULPT_TOOL_SNAKE_HOOK && brush->snake_hook_deform_type == BRUSH_SNAKE_HOOK_DEFORM_ELASTIC) {
  /* Snake hook in elastic deform type has same requirements as the elastic deform tool. */
  return true;
}

The feature seems fine to me.

Pablo Dobarro (pablodp606) marked an inline comment as done.
  • review update
Sergey Sharybin (sergey) requested changes to this revision.Dec 3 2020, 10:21 AM
Sergey Sharybin (sergey) added inline comments.
source/blender/editors/sculpt_paint/sculpt.c
4260–4262
float fade;
if (do_elastic) {
  fade = 1.0f;
} else {
  fade = bstrength * SCULPT_brush_strength_factor(...)
}
This revision now requires changes to proceed.Dec 3 2020, 10:21 AM
Pablo Dobarro (pablodp606) marked an inline comment as done.
  • review update
This revision is now accepted and ready to land.Dec 4 2020, 10:14 AM