Freestyle integration into Blender

December 19, 2011

Development updates on December 18

Filed under: Update — The dev team @ 1:02 AM

Since the last blog update, the development in the Blender Freestyle branch mainly focused on stability improvements, as well as on an extended capability of the Parameter Editor mode, which is intended to be an artist-friendly GUI for interactive manipulation of line style parameters.  Major additions and changes are highlighted as follows.

Updates in the Parameter Editor mode

The function of the ‘+’ button to the right of a line style name in the Freestyle: Line Style tab has been changed so as to make a copy of the active line style instead of creating a new line style with default settings.  This is meant to be consistent with the creation of new data blocks in other parts of Blender (for instance, creating a new material will result in a copy of the active material).  Also a button to make a single-user copy of a line style (i.e., the button that indicates the number of users) has been implemented.

Copy and paste operations for line sets have been added to make it easy to duplicate the settings of a line set.

It is recalled that line sets have a reference to a line style.  When the settings of a line set A having a reference to a line style X is pasted into a line set B, the latter line set will have a reference to X.  That is, the paste operation changes the line style references, but does not modify the settings of line styles.  If you also want a copy of the referenced line style after the paste operation, you have to make it using the copy operation for line styles as described above.

An extended set of conditions for feature edge selection by edge types has been introduced.  Each edge type check button in the Selection by Edge Types has now an associated toggle button to exclude the edge type from the feature edge selection.  This allows you to select, for instance, those edges that are silhouette lines but not external contours by enabling the two edge types and also the toggle button for external contours, as shown in the screen shot below.

A new option for disabling the chaining of feature edges has been added to the ‘Stroke’ panel of the Freestyle: Line Style tab.  This option is useful for examining the initial set of feature edges in the view map.

New options for splitting chains of feature edges by a minimum and maximum 2D angle and by a 2D length limit have been added to the ‘Stroke’ panel of the Freestyle: Line Style tab.  These options are useful for splitting long strokes into small pieces.  See the example renders of the Guiding Lines geometry modifier below for an example use of splitting by 2D length.

Three new stroke geometry modifiers have been implemented.

  • Polygonization
  • Guiding Lines
  • Blueprint

The Polygonization geometry modifier transforms smooth strokes into jagged polylines.  The “error” parameter specifies how much deviation is allowed from the original stroke geometry (the larger the error parameter is, the more jagged the resulting polylines are).  The following test renders illustrate the effect of the Polygonization modifier: (a) without applying the modifier, strokes along arcs are smooth; (b) with the polygonization modifier applied with the error parameter set to 5, the strokes are transformed into jagged polylines; and (c) the error parameter set to 20 gives more jagged polylines.


The Guiding Lines geometry modifier replaces a stroke with a straight line connecting both ends of the stroke.  This modifier will produce reasonable results when strokes are short enough, because shorter strokes are more likely to be well approximated by straight lines.  Therefore, it is recommended to use this modifier together with the splitting options (by 2D angle or by 2D length) mentioned above.  The following images show how splitting and geometry modifiers can be combined: (a) smooth strokes along arcs are split into small pieces by the 2D Length option; (b) the Guiding Lines gemoetry modifier is then applied to approximate the split stroke segments by straight lines; and (c) the Backbone Stretch geometry modifier is further applied to extend both ends of each straight stroke.


The render below is a combination of the Guiding Lines and Spatial Noise geometry modifiers.  Both modifiers were applied to two identical line sets to duplicate the guiding lines.  The line sets contain only external contours.  The Spatial Noise modifier was applied before the Guiding Lines modifier, so that two sets of guiding lines display some variability.

The Blueprint geometry modifier produces a blueprint using circular, elliptic, and square contour strokes.  A blueprint here refers to those lines drawn in the beginning of free-hand drawing to capture the silhouette of objects with a simple shape such as circles, ellipses and squares, as illustrated below.


The Perlin Noise 1D geometry modifier had an issue that noise frequency was relative to the stroke length (i.e., the number of noise displacement values was the same for strokes of different lengths).  This resulted in very noisy short strokes and much less noisy long strokes.  Now the noise frequency is relative to the distance from the starting point of a stroke.  That is, two strokes of the same length will be distorted by the same number of noise displacement values, whereas longer strokes will have more noise displacement values along stroke.

Stability improvements

  • A fix was made to address duplicated feature edges due to a numerical instability of line clipping by near/far Z planes.
  • View map construction was not properly taking face marks into account.  This caused incorrect (and unpredictable) feature edge selection results when face marks were used.
  • A crash caused by temporary scenes for stroke rendering was fixed.  Freestyle generates a temporary scene containing a number of stroke meshes to achieve stroke rendering using the Blender internal renderer.  This temporary scene may appear in the outliner and undergo user interaction when the stroke rendering takes a long time.  The crash was due to the deletion of the scene without taking care of references to the scene from screens, one of which was the outliner.
  • The interaction between Blender and Freestyle was revised to address a crash when two scenes in the compositor have different render resolution (i.e., image width and height, scaled by a percent parameter).
  • Stroke rendering instability with stroke geometry shaders was addressed.  Stroke::Resample(int nPoints) was not properly working when a wrong value was returned from Stroke::getLength2D(), resulting in repeated warning messages “Warning: incorrect points number” during stroke rendering.  The main cause was that stroke geometry shaders did not update the two-dimensional (2D) length (also referred to as curvilinear abscissa) after they modified the 2D points of stroke vertices.  Now all stroke geometry shaders make explicit calls for Stroke::UpdateLength() that has been introduced for recomputing the 2D length.
  • A bug in Operators.recursiveSplit() that splitting could not take place within the last segment of a chain was fixed.

Remarks on the merge into the trunk

The dev team has been receiving an increasing number of questions from branch users concerning the merge into the trunk (i.e., official release of Blender).  It is remarked that the merge has already been agreed with the core Blender developers of the trunk, and the only major question is when the merge is done.

In June 2010, the dev team defined a list of unfinished components that need to be done before the merge is finally asked.  The list includes three major components: (a) GUI for the Parameter Editor mode; (b) feature edge detection at the intersection of two faces; and (c) Freestyle Python API improvements.  Subjective achievement rates of the three components are 90%, 0%, and 80%, respectively.  In other words, the Freestyle branch needs more development before it gets ready for code review that is required for the merge to happen.

At the moment the official release of Blender 2.62 is planned in February 2012, but it is unlikely that Freestyle is included into this release because of the short deadline for code review in January.

Considering an admittedly limited amount of time resources, it is still difficult to predict when all the unfinished components are done and the code review for the merge can be asked.  We appreciate the understanding and patience of branch users.

Blog at