cancel
Showing results for 
Search instead for 
Did you mean: 

Carve Brush?

keldor314
Level 3
One of the hardest things to do in Medium is carving in features into an only somewhat smooth surface.  This is needed to carve a nice clean line between lips, bore in nostrils (especially for animal noses, which have very complex geometry), and so forth.  It can be done to some extent with the clay tool, but getting clean geometry is quite difficult since the tool lacks fine control and the smooth tool is iffy at best around edges and creases.

I did some brainstorming and I think I've come up with a way to implement a tool that should (hopefully) do the job.

The idea is to create a tool that interacts with the sculpt much in the way a physical gouge, knife, file, or finger would, depending on the parameters (more on these later) and the active stamp.  The issue with the clay tool is that cutting with it is like cutting with a lightsaber.  One slip of the hand and you've taken out a large chunk of your model!  Instead, we want a tool that removes clay at a steady controlled pace, following the user's hand as if they were dragging a gouge behind them.

In order to achieve this, there seem to be two natural parameters (in addition to scale, of course), strength and friction.  Strength controls the rate at which clay is removed, with the maxed out setting behaving pretty much like the clay tool.  A low strength would mean the tool can only cut at a limited rate as it drills its way through the sculpt following the user's hand.  This should enable much more control.

Friction reflects the tools ability to slide across the contours of the surface.  Think of gravity pulling a sled down a hill.  The sled moves in a downward direction, but slides down the hill rather than drilling straight on through.  A tool with the friction maxed out will drill its way toward the user's hand in a straight line.  A tool with low friction will skate across the surface, behaving much like a file.  In between we might have an ideal setting for cutting in grooves that we want to mostly follow the surface but also bite in.

It may be useful to introduce a bit of anisotropy to low friction cuts.  The idea is that we actually want the cut to be shallow but follow the surface for a long distance, i.e. form a groove.  To do this, we might weight the calculated removal volume reverse proportionally to the cosine of the angle between the local normal of the sculpt and the direction to the user's hand.  Maybe something like this:

VoxelWeight = 1 - (1 - Friction) * cos(theta)

The VoxelWeight is clamped to 0 for empty voxels.

Then in order to calculate the movement vector of the cutting tool toward the user's hands, we first need to compute the direction of motion.  We do this by simple gradient descent, modulating the surface integral of VoxelWeight for a given movement angle across the surface of the stamp intersecting the sculpt by -cos(deflectionAngle).  It may be possible to calculate the integral for only three orthogonal directions -x>  -y> and -z> as such:

MovementVector = Strength * (-x> / xIntegral + -y> / yIntegral + -z> / zIntegral) / Scale^3

I'd have to check the math.  Please forgive my horribly mangled ASCII linear algebra.  For convenience, we define division of a vector by a scaler to be equivalent to multiplication of that same vector by the inverse of the scalar.

After this, we perform the actual cut just like with the clay tool, using the previous stamp position and the movement vector to drive the motion.

Care must be taken when computing if a given voxel on the surface of the stamp intersects the sculpt since the tool will typically have dug a cavety out for itself in the previous frame.  Thus, we should consider a voxel intersecting the sculpt if the value in the distance field is lower than some epsilon, indicating that the cutting tool is "touching" the sculpt at this point.  Consider scaling epsilon according to the strength and scale of the tool to approximate the fact that the brush will collide with more bits of nearby geometry as it moves.

A nice feature of this implementation is that this tool can be inverted to grow ridges too.  It would be very useful if you could see a faint ghost of the tooltip when it's beneath the surface so you can actually see what you're doing.  This also goes for the clay tool when in add mode.



Anyhow, what does everyone think of the concept of the tool?  Also, would such an implementation actually work?

*EDIT*
All of this can be folded into the clay tool since the behavior with 100% Strength and 100% Friction is identical to the clay tool's current behavior.
1 REPLY 1

P3nT4gR4m
Level 12
Try constrain to surface? For lips and stuff I tend to go with multiple layers then merge them when I'm happy.