[Bf-blender-npr] Feature/improvement idea for Freestyle

Tamito KAJIYAMA rd6t-kjym at asahi-net.or.jp
Tue Apr 8 07:47:07 CEST 2014


Terry,

I agree that what we like to have is a number quantifying how close to a
contour.

Contour lines appear at the boundary between visible and hidden areas of
surface. The point on the surface at which contours show up moves
according to camera movement. Contours disappear when they move from
convex to concave areas. This boundary between convex and concave areas
is referred to as an inflection point. So what we want to quantify is
how close to an inflection point a contour is.

Curvatures come in handy to do this kind of geometry analysis (see
Reference below). For a 2D curve, the curvature at a point on the curve
is the reciprocal of the radius of a circle that best approximates it
locally. For a 3D surface, we can consider a 2D curve at the cross
section by a plane including the surface normal and the view line. The
curvature at a point of the cross section curve is called radial curvature.

Reference:
http://gfx.cs.princeton.edu/proj/sg05lines/course7-5-linetypes.pdf

Radial curvatures are positive in convex areas, negative in concave
areas, and zero at inflection point. So the magnitude (absolute value)
of radial curvature could represent the closeness of a contour to an
inflection point.

In Freestyle, radial curvatures are computed at individual input mesh
vertices, only when the Face Smoothness option is enabled and mesh faces
are flagged as smooth shading. Radial curvatures are only available
through the Freestyle Python API at the moment.

I did a quick test again: https://vimeo.com/91383521 .

In the video clip, line thickness is a function of the magnitude of
radial curvatures. Since curvatures are computed at input mesh vertices,
the input mesh have to be very fine (I used subsurface division at the
maximum level 6). The high mesh resolution translates to a long view map
computation time. That is a downside of this solution. The upside is a
smooth transition of line thickness when the lines appear and disappear.

What do you think?

Suggestive contours as in Freestyle for Blender tend to produce
unpredictable and noisy line results as you may have noticed. By noisy I
mean jagged, discontinuous pieces of line segments. I did not rely on
them this time, although these lines might be a starting point toward
what we like to have.

Best regards,

-- 
KAJIYAMA, Tamito <rd6t-kjym at asahi-net.or.jp>


On 08/04/2014 04:05, Terry Hancock wrote:
> TK,
>
>> I have seen many cases too where lines suddenly showing up and
>> disappearing are distracting, so I see the point of your post.
>>
>> Concerning crease lines, they are independent of the view point [...]
>
> Actually I knew that. Or should have remembered! (I've read the paper about
> the Freestyle algorithms). So that's not what I was seeing, of course.
>
>> Changing the thickness of a crease line depending on the angle between
>> the two faces on both sides of the line is technically possible. I just
>> did a proof-of-concept implementation using the Python Scripting mode of
>> Freestyle in Blender. See https://vimeo.com/91306354 for a quick test
>> result. Implementing this crease angle dependent line thickness in the
>> Parameter Editor mode needs further coding (that could be a short term
>> goal).
>
> That was pretty neat, though! I may have to look into how you did that. That
> would matter when it's the model that's changing rather than the camera.
>
>> Contours, on the other hand, are view dependent lines.
>
> Clearly that has to be the source of the problem I was talking about.
>
> It is the "suggestive contour" algorithm that I think offers a chance for
> improvement here.
>
> As I understand it, these are "almost contours", meaning that they do not
> quite undercut, but have a very steep angle relative to the line of sight.
>
> Freestyle currently must just have some cutoff point for this. (?)
>
> So then my request would amount to extracting the steepness -- "how close to a
> contour is it?" -- as a numerical value and making that available for
> modifiers.
>
> Typically, when a contour disappears, it should be a "suggestive contour" for
> a short time after. So if you have a modifier with a rapid fall-off in thickness
> and/or alpha, it would implement a softer disappearance.
>
>> Maintaining
>> inter-frame properties of lines (such as stability and gradually varying
>> thickness) is a problem called temporal coherence.
>
> Yep. That would get complicated.
>
> But I think the suggestive contour modifier idea would only depend on the
> instantaneous geometry of the current frame, so it doesn't fall into that
> category.
>
>> For now it is unlikely that the
>> temporal coherence problem is solved in Freestyle for Blender.
>
> Yeah, that's understandable, and even this contour issue is something I expect
> I'll just have to accept as a flaw for the present. Just thinking about ways to
> improve it. :-)
>
> Cheers,
> Terry


More information about the Bf-blender-npr mailing list