Freestyle Status, What is it?!

It’s not all bad new with Freestyle integration into Blender. In this article (email to bf-commiters), developer, Tamito KAJIYAMA explains the inner working of Freestyle and why it is NOT an external render engine, but “… Freestyle is best described as a post-processing option of the BI.“. And as always Ton is the cool guy in this type of scene.

Hi,

> to me it seems we should first try to grasp and evaluate what has been done
> and how this integrates with Blender's features, our other render engines,
> compositor, etc.
I think it is worth presenting a general overview of the integration work, to
help all of us evaluate the work that has been done and how Freestyle works
with other components of Blender.

Freestyle as a post-processing option
-------------------------------------

As Dan and Thomas pointed out, Freestyle works as a post-processing component
of the Blender Internal (BI) rendering engine.

Line rendering with Freestyle takes place just after the rendering of BI
passes (e.g., Combined and Z depth) has been done and before the compositor is
executed.  The line rendering is performed as follows:

1. Mesh data are imported from Blender by accessing Render::instancetable
   (i.e., a list of ObjectInstanceRen instances).  Only vlak objects are
   considered.

2. A 2D representation of the imported mesh data, referred to as view map, is
   constructed.  It consists of feature edges identified in the imported mesh
   data, such as silhouettes (view dependent) and crease lines (view
   independent).

3. Feature edges of interest are selected by user-defined edge selection
   criteria, and transformed into strokes according to stylization parameters
   given either in the form of a Python script (called style module) or a set
   of parameters (called line style).  Stylization concerns stroke color,
   alpha transparency, thickness and stroke backbone geometry.  These style
   elements are parameterized in terms of 2D/3D geometry and other scene
   components (e.g., camera location and object materials) as well as
   image-space information (such as pixels in the Combined and Z passes).

4. Strokes are rendered using the BI.  To this end, a temporary scene
   populated by new meshes representing the strokes is constructed.  The
   rendering results are composited into the Combined pass.

Freestyle works well with render layers and the compositor, since the rendered
strokes are part of the Combined pass.  Full sample anti-aliasing (FSAA) is
also supported.  When the FSAA is enabled, each sample of a Freestyle render
is composited into the corresponding sample of the Combined pass.  Note that
there is no "Freestyle pass".  Such a Freestyle-only pass can be obtained by
disabling all Combined components but Freestyle.

Freestyle respects most BI rendering options, including image resolution,
percent scaling factor, pixel aspect ratio, and border rendering (with and
without the Crop option).

It is recalled that the BI splits the entire image into small tiles and
renders them one after another (possibly in parallel).  This tile-based
rendering is not applicable to line rendering in Freestyle, since it is often
the case that users want to manipulate all the selected feature edges at once
during the stroke generation and stylization in Step 3 mentioned above.  In
addition, Freestyle makes BI passes accessible for stroke stylization.  For
these reasons, line drawing with Freestyle is performed just after the
rendering of BI passes and before the compositing.  In this sense, Freestyle
is best described as a post-processing option of the BI.

Because of all these functionalities, Freestyle has been tightly integrated
into the BI rendering pipeline.  Freestyle is by no means an external
rendering engine.

Additional Freestyle extensions
-------------------------------

In addition to the enhanced rendering pipeline, Blender has been extended to
implement the following Freestyle-specific components:

* Line styles are a new data block (ID_LS).  This allows users to reuse line
  styles among render layers, scenes and multiple .blend files (the Link and
  Append commands work as expected).

* Mesh data have new edge and face attributes called Freestyle edge/face
  marks.  These marks permit fine control of feature edge selection in Step 3.
  Users can interactively mark specific edges and faces in the Edit mode
  (using the Ctrl-E and Ctrl-F menus).  The Subsurface Division modifier works
  fine with Freestyle edge/face marks.

Freestyle and GUI
-----------------

For what concerns GUI design, all Freestyle-related options are currently
located in the Render panel of the Properties window as detailed below:

* A global option for enabling Freestyle is located in the Post Processing
  tab.

* Freestyle can also be enabled/disable for each scene render layer using the
  Freestyle toggle in the Include: section of the Layers tab.

* When a render layer with Freestyle enabled is active, the Freestyle tab
  appears to allow users to specify conditions for feature edge selection.  A
  set of edge selection criteria is called a line set.  For each line set, a
  line style is associated.  Render layers can have multiple line sets each,
  so that different sets of feature edges in a render layer can be drawn with
  different line styles.

* Options defining a line set are shown in the Freestyle: Line Set tab.

* Line style options are provided in the Freestyle: Line Style tab.

Line sets are part of render layer options, and it is often useful to
manipulate line sets and associated line styles altogether.  For these
reasons, all the Freestyle-related options are shown in the Render panel of
the Properties window.

Proposals for improving the present GUI design are highly welcome.

That is all for now.  Comments and suggestions are much appreciated.

Regards,
T.K.

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

-----Original Message-----
From: Ton Roosendaal
Sent: Tuesday, May 22, 2012 6:50 PM
To: bf-blender developers
Subject: Re: [Bf-committers] Freestyle branch status report May 2012

Hi,

Cartoon render is very useful as a feature.

Whether that's as separate download, as engine (like yafaray) or integrated
we can always check on later... to me it seems we should
first try to grasp and evaluate what has been done and how this integrates
with Blender's features, our other render engines, compositor, etc.

-Ton-

TK has given a great explanation, we hope to see a full and robust integration as soon as possible. More dialog can be found here: http://lists.blender.org/pipermail/bf-committers/2012-May/036870.html if you are interested!