Freestyle integration into Blender

February 17, 2010

Weekly update February 8-16

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

Since the last blog update, the Freestyle branch has been improved in several directions as described below.

First, further consolidation of the view map creation was carried out to address “2D intersection out of range” warnings.  These warnings lead to “3D intersection out of range” warnings, which are in fact a sign of a possible crash.  The cause of the issue was in the way of handling a tolerance threshold for floating-point arithmetic errors.  Previously, the Freestyle renderer was calculating the threshold (referred to as the computed epsilon) based on the minimum edge size within the scene being rendered.  The computed epsilon could be zero when the minimum edge size was very small.  This does not seem to make any sense, so that the epsilon calculation was completely omitted.  Now a constant epsilon value is used throughout the view map creation regardless of scenes to be rendered.

Next, pixel-based density and Z depth information was recovered.  Availability of the pixel-based density and Z depth information depends on enabled passes of a render layer being rendered.

  • Density information is available if the diffuse pass of the render layer is enabled.  It is accessible through the DensityF0D and DensityF1D functors provided by the Freestyle Python API.  These functors return 0 if the diffuse pass is disabled.
  • Z depth information is available if the Z pass is enabled.  It can be accessed through LocalAverageDepthF0D and LocalAverageDepthF1D.  These functors return 0 if the Z pass is disabled.

In the meantime, the support for transparent stroke colors was once reverted and a new implementation was attempted.  The previous approach (described in the last blog article) turned to be inappropriate because of incomplete functionality.  When two transparent strokes were overlapping, the stroke drawn first was completely overridden by the stroke drawn after the first stroke, instead of two stroke colors being blended.  The new approach relies on a native support of transparent vertex colors in Blender.  To make it possible, Blender’s internal renderer has been slightly extended to directly support transparent vertex colors (for those who are interested in internal changes: When Material::vcol_alpha is non-zero, the internal renderer takes MCol::a into account).  Now overlapping transparent strokes result in color blending as expected.  The left image below shows three opaque strokes having variable stroke colors from red to yellow.  The right image shows the same strokes but with variable alpha values from 0.8 (red) to 0.2 (yellow).

The new implementation of transparent stroke colors is considered a kind of dirty hack.  It may pose an issue when the Freestyle branch is merged into the trunk.  Yet another implementation without modifications to the internal renderer would be much acceptable for the core developers.  The dev team is going to look for a better approach.

In addition to the planned updates mentioned above, some improvements were made according to suggestions by the branch users.  First, changes were made to allow for escaping from rendering by pressing the ESC key.  Key press checks are performed 1) before entering Freestyle, and 2) after the completion of the view map creation.  Further additions were made to show the progress of the Freestyle rendering process in the status bar of the render result window.  Mesh loading, view map creation, and stroke rendering will be reported as the rendering proceeds.

It is remarked that the latest revision 26980 of the Freestyle branch has incorporated all changes included in the Blender 2.5 alpha 1 release.



  1. thankyou for the week update :)

    Comment by Max Puliero — February 17, 2010 @ 3:06 AM

  2. Still here, still following, still hoping you can manage to complete it in time for 2.5 / 2.6.

    All the best!

    Comment by Barts — February 17, 2010 @ 1:22 PM

  3. Hi,
    What I like with the weekly updates, it is that they are technical. We can learn from them. Thanks!

    Comment by steren — February 17, 2010 @ 7:33 PM

  4. I continue to appreciate your work along with the other developers on the Blender trunk. I have been building Freestyle (up to r27019) for for Win32 and Linux64 successfully with some info from others. Teaching myself some Python 3.1, and I have not been able to port your Parameter editor over to Blender 2.51 and Python 3.1. Could you adjust that code for now, until the more complete integration is effected. I have made the changes to all of the functioning modules and will gladly repost them, if the Parameter Editor was working. Thank you again for the efforts.
    Paul (paulhart2)

    Comment by Paul Hartsuyker — February 20, 2010 @ 10:48 PM

  5. Hi Paul,
    Thanks for your interest in the Freestyle Parameter Editor (FPE). Frankly to say,
    I am not interested in porting the FPE to Blender 2.5 as it was in Blender 2.4x
    because the FPE has a number of limitations. I prefer to take a more comprehensive
    approach to provide a graphical user interface for manipulating style module parameters.
    This latter approach will take a considerable amount of time. Since we have a list of
    to-do things with higher priority and human resources are limited, I feel like it
    is not a good time to proceed with the FPE improvements now.

    That said, if someone is willing to port the FPE to Blender 2.5, I will be available
    for help. My impression on Python scripting in Blender 2.5 (through the SVGWriter
    case study
    ) is that once you get familiar with the so-called RNA API, you will find
    it relatively easy to create a custom GUI and integrate it into Blender 2.5. Maybe in the SVGWriter package will give you some ideas on how a Python
    extension script in Blender 2.5 looks like. For those who are interested in porting
    the FPE to 2.5, please feel free to go ahead and ask me for help.

    Comment by The dev team — February 22, 2010 @ 9:59 PM

  6. […] DensityF0D and LocalAverageDepthF0D functors are used to read pixels from the diffuse and Z depth passes, the callers of these functors specify […]

    Pingback by Weekly update March 29-April 4 « Freestyle integration into Blender — April 7, 2010 @ 12:41 AM

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

Create a free website or blog at

%d bloggers like this: