Freestyle integration into Blender

August 11, 2010

Weekly update July 12-August 11

Filed under: Update — The dev team @ 8:59 AM

Since early June, the dev team has been working on the new Parameter Editor mode that is intended to be an artist-friendly graphical user interface (GUI) for the Freestyle renderer.  A number of new UI elements have been introduced, and most of them are now considered functional.  Although the Parameter Editor mode is still a work in progress, a brief description of the new UI elements would be useful both from branch users’ perspective and for the purpose of GUI design review.

With the aim of organizing a number of stylization parameters in a clean and easy-to-understand form, two new notions of lineset and line style have been introduced. Lineset is a set of selected feature edges that are subsequently chained to create strokes.  Line style is a set of stylization parameters that define the appearance of a lineset.  Each render layer may have an arbitrary number of linesets, each of which is associated with a line style.  Line style is a new data block type in Blender, meaning that a line style is shared by different linesets (like the materials that can be shared by multiple objects).

A lineset accommodates a set of options for selecting feature edges on which you want to draw strokes.  First, you specify the types of selection criteria based on which feature edges are selected.  There are two types of selection criteria: edge visibility and edge types.

  • By edge visibility, you can select all visible edges, all invisible (hidden) edges, or the edges within a range of quantitative invisibility (QI).  It is recalled that the QI of a feature edge is the number of occluding faces between the edge and the camera (i.e., the QI value is integer).
  • Feature edges can also be selected by their types: silhouette, border, crease, ridge, valley, suggestive contour, material boundary, contour, and external contour.  Conditions on edge types can be combined by logical OR and logical AND.  In addition, there are two options named Inclusive and Exclusive.  By enabling the Inclusive option, the feature edges that satisfy the given AND/OR-combined edge type conditions are selected.  With the Exclusive option enabled, the feature edges that do not satisfy the given conditions are selected.

At the moment, there are no options for controlling how to chain selected feature edges to create strokes and how to split strokes into pieces.  New UI elements for chaining and stroke splitting will be added later.  For now, a specific chaining rule is used to convert selected feature edges to strokes.

A line style comprises a number of stylization parameters that define the appearance of strokes to be drawn on the feature edges selected by a lineset.  New UI elements for controlling line color, alpha transparency, and line thickness among many other stylization parameters are available in the Freestyle: Line Style tab.  A line style defines the base line color, base alpha transparency, and base line thickness.  In addition, these base values can be altered by modifiers.  Color, alpha and thickness are independently modified by a list of modifiers as shown below.  Modifiers are processed in the order within a list, namely in such a way that a base value is first modified by modifier #1, then modified by modifier #2, and so on.

Modifiers have two common properties: blend type and influence.  The blend type specifies the way how the modifier changes a base value, whereas the influence (on the interval 0 to 1) determines how much the modifier changes the base value.  An example of blend types is Mix to blend the base value and a new value based on the influence as follows.  Let B be the base value, X be the new value, and F be the influence.  Then, the base value is changed to B(1 – F) + XF.  If F = 1, then B is set equal to X.

As of this writing, there are three modifiers: Along Stroke, Distance from Camera, and Distance from Object.  These modifiers are all available as color modifiers, alpha modifiers, and thickness modifiers.

Along Stroke modifiers alter a base value (i.e., color, alpha, or thickness) by a new value that is defined along a stroke.  Suppose that a point moves along the stroke from the beginning to the end, and the location of the point is expressed by parameter T on the interval 0 to 1.  The Along Stroke modifiers yield a new value based on the T value.  The Along Stroke color modifier has a color ramp which is used to translate the T value to a new color, as illustrated in the figure below:

Both the Along Stroke alpha and thickness modifiers have a mapping that translates T to a new alpha/thickness value.  The mapping is either linear or curve.  The linear mapping is used for linear fade-out (see panel (a) in the figure below).  The linear mapping has the “invert” option for linear fade-in (see panel (b)).  The curve mapping allows you to specify a non-linear variation of new alpha/thickness values (see panel (c)).

The Along Stroke thickness modifier also has the Value Min and Value Max options that specify the range of the new thickness values.

Using all the Along Stroke color, alpha and thickness modifiers (with the curve mappings enabled for the latter two) gives the following render.

Distance from Camera modifiers change a base value by a new value that is determined based on the distance from the camera to a point lying on a stroke.  The distance is measured in the three-dimensional space and is expressed by parameter T on the interval 0 to 1.  The Distance from Camera color, alpha and thickness modifiers commonly have the Range Min and Range Max options.  When the distance from the camera to the point is equal to or less than the Range Min, the parameter T takes the value zero.  The T value approaches to one as the distance gets close to the Range Max.  The parameter T takes the value one if the distance is equal to or greater than the Range Max.

The Distance from Camera color modifier has a color ramp option for translating the T value to a new color, which is then blended with the base color (see panel (a) in the figure below).  The Distance from Camera alpha and thickness modifiers commonly have a mapping (either linear or curve) to translate T to a new alpha/thickness value (see panels (b) and (c)).  The Distance from Camera thickness modifier also has the Value Min and Value Max options to define the range of new thickness values.

Enabling all the three Distance from Camera modifiers above results in the following render:

Distance from Object modifiers are similar to the Distance from Camera modifiers, and the difference is that the distance is measured from a specified object (more specifically, from the center point of the object) instead of the camera.  Distance from Object modifiers have all options the Distance from Camera modifiers have, plus an entry to specify an object from which the distance to a point lying on a stroke is measured.

Enabling all the three Distance from Object modifiers above gives the following render:

That’s all for now.  More updates to the Parameter Editor mode are anticipated in the next weeks.  Feedback of any kind concerning the design and implementation of the Parameter Editor mode is much appreciated.

Blog at WordPress.com.