Freestyle integration into Blender

December 5, 2010

Weekly update November 29-December 5

Filed under: Update — The dev team @ 11:26 PM

Since the last blog update, the dev team was working on bug fixes, addition of new features, and consolidation of existing functionalities.

A compilation issue with MinGW32 was fixed thanks to a report from Dazzle, and a bug in Distance from Object modifiers due to a recent change in the trunk about matrix-vector multiplication was fixed based on a .blend file provided by Jonathan Hudson.  We really appreciate the user feedback, which helps the dev team to improve the software.

In the meantime, the Parameter Editor mode was extended with two new feature edge selection options.  One is the “Selection by Group” option and the other is the “Selection by Image Border” option, both in part of linesets in the Parameter Editor mode, as shown in the screenshot below.

The Selection by Group option allows you to select feature edges based on a group of objects (defined through the Groups tab in the Object buttons).  For each lineset, you can specify one group of objects.  The group-based feature edge selection is either inclusive or exclusive.  If inclusive, feature edges are selected when they belong to some object in the group; otherwise, those feature edges not belonging to any object in the group are selected.  When no group is specified, feature edges are selected from all objects in object layers enabled in a render layer.  In the past, render layers were the only way to apply different line styles to different objects in the same scene.  This required the use of the compositor and thus a more and less complicated workflow.  The group-based feature edge selection is intended to address this difficulty, making object-specific line stylization much easier.  The image below is a result using this new feature.  A group of objects comprising a lily in the middle was defined, based on which white lines were drawn.  A different line style was applied to lines of two lilies in the left and right using a separate object group.

The Selection by Image Border option is used to select feature edges within the border of the image being rendered.  The border is defined either by the frame size or a border region (specified by the Shift-B key in a 3D View window).  When you work on a big scene with a lot of objects outside the viewing frustum, enabling this option leads to less memory consumption and possibly shorter rendering time.

Finally, the data flow within the Freestyle renderer was revised with the aim of reducing the amount of memory consumption.  Rendering of a 3D scene in Freestyle involves several data structures holding different representations of the scene and strokes generated from the scene.  The data processing in Freestyle is summarized as follows:

  1. First of all, mesh data are imported from the 3D scene and stored in a tree-based data structure.
  2. The mesh data are transformed into a data structure called winged edges and stored in a 3D grid structure for efficient spatial search.
  3. The winged edges are used for view map calculation, and a separate view map data structure is constructed.
  4. The view map is fed to stroke generation by means of style modules (it is noted that the Parameter Editor mode is implemented as a built-in style module).
  5. Generated strokes are converted into Blender mesh data for stroke rendering.

Previously, all the data structures were kept until the end of the entire rendering process.  This makes sense in the original, stand-alone Freestyle program, in which the view map, for instance, can be reused for applying different style modules one after another.  This is not the case in Freestyle for Blender, where the view map is recalculated for each render.  Therefore, the memory resources allocated for the data structures should be released soon after they become unnecessary even in the middle of the rendering process.  For this reason, memory usage improvements were made with regard to the aforementioned data structures.  The improvements were verified by a test scene (generated using a modified version of “Arc” in Structure Synth) consisting of 34968 vertices and 52452 faces.  The left image below is a rendering result.  Using a 64-bit Windows machine, memory consumption in the latest revision 33485 was compared with that in revision 33434 without the memory-related updates.  The right image below shows the amount of allocated memory (in the vertical axis) throughout the rendering time (in the horizontal axis).  The maximum amount of allocated memory in the older revision was about 2.138 GB, which reduced to 1.439 GB through the memory usage optimization as well as the Selection by Image Border option.


Experiments with several other test scenes showed that the extent of memory usage reduction depends on scenes.  We hope the reported updates will allow branch users to render big scenes without an out-of-memory crash.


  1. “VAAAHOOOOO!!!!” (einstein)

    selection by group. THIS. IS. HUGE.
    does freestyle have a logo? if it does i want to draw it on my chest and run around nude.

    Comment by ike — December 6, 2010 @ 2:22 AM

  2. oh and i forgot the data structures. thats particularly valuable to my project more than anything else! thanks a lot guys. at some point i’m going to have to get a list of the main team’s names so i can credit them in my project’s credits

    Comment by ike — December 6, 2010 @ 2:44 AM

  3. This seems useful. I can’t wait to make use of it when I’m done with my low poly character XD

    Great work you’re doing, guys, thanks a lot!

    Oh, and you mean December 5 in the tittle XD

    Comment by @Omar_Ramirez — December 6, 2010 @ 5:14 AM

  4. This projects is really something.
    I have two questions though if anybody know…
    1: Is it possible to export lines as a vector file format..?
    2: I can imagine that the lines are approximations in many cases of curves, but what about when the lines are straight edges from ex. the boxes on the picture above? for ex. is it possible to get an accurate drawing of an object in orthographic projection..?

    Thanks for the good work. I have been keeping an eye on this project for a long time and it is really shaping up :)
    Good Luck.

    Comment by Ejnaren — December 6, 2010 @ 11:35 AM

  5. Great work you’re doing, guys, thanks a lot!

    There is a bug with the stroke option. When i use round or square i can’t render the scene.

    Comment by ati — December 6, 2010 @ 11:46 AM

  6. Congratulations on another valuable update and another great explanation. One of these days I am going to get enough time on my hands to mess with the code; I have wanted to contribute to freestyle since forever. Until then, I can reasonably keep up with the structure of the project, thanks to the excellent technical explanations spread out through these update descriptions. Good job all arund!

    …and that test scene is kinda cool :-)

    Comment by yoff — December 6, 2010 @ 1:35 PM

  7. Thank you all for the kind comments!

    Yes, there is a Freestyle logo, see the web site of the original Freestyle :)

    I fixed the title, thanks :)

    1. There is an experimental style module called SVGWriter for exporting Freestyle
    rendering results in SVG format. See for
    more information.
    2. All lines drawn by Freestyle are polylines (i.e., a series of straight line
    segments). If you have straight edges in your mesh data, they appear as straight
    strokes unless you ditort stroke geometry yourself. Also, orthographic cameras
    are supported in Freestyle.

    An attempt to fix an issue related to the round/square caps was made in revision
    33518. Could you please try it and see if the problem no longer exists on your side?

    Comment by The dev team — December 6, 2010 @ 11:50 PM

  8. thank you for the optimization & new groups selection features!!!!

    Comment by Blenderificus — December 7, 2010 @ 8:43 AM

  9. hello hope this is the right place to ask for some help. i want to try frestyle standalone in my fedora but i dont have the knowledge to follow the instrution abaut setting up FREESTYLE_DIR environment variable and edit the $FREESTYLE_DIR/src edit the libconfig.pri. i really want to use this software in my drawing class if i manage to mage it work.i already have make some experiences in a costume blender with Freestyle, but dont have time to learn blender now, if anyone can help me in the right direction will be great, many thxs

    Comment by vitor s — December 8, 2010 @ 3:53 AM

  10. sorry i forgot to say thxs for your work.

    Comment by vitor s — December 8, 2010 @ 3:56 AM

  11. Hello,
    I try again with version 33518 (mac) and the problem persists with the “rounded stroke”. Thank you and bravo for this great work. I await impatiently the next versions.
    Sorry for my approximatively english.

    Comment by ati — December 9, 2010 @ 1:58 PM

  12. ati,
    Thanks for the report. If possible, please consider sending me a .blend file for
    reproducing the problem by email (rd6t-kjym at or via some file
    hosting service (e.g., specifically desined for
    uploading .blend files). If such a .blend file is available, bug hunting is much

    Comment by The dev team — December 9, 2010 @ 7:27 PM

    • I will send you one. blend when the problem will appear again with “rounded strokes. For now everything works perfectly. Freestyle is great and helps me enormously in my work. Thank you very much.

      Comment by ati — December 10, 2010 @ 1:31 PM

  13. I’m looking at this project for months, although I haven’t tried it yet (had no idea it exists since 2010). When will it become part of the official Blender? I wanna use it too, but don’t wish to use a custom Blender build for my animations. Any news or plans on this, and has anyone spoken with the Blender devs to ask them to put this in? Even as an addon disabled by default it would be nice…

    Comment by MirceaKitsune — June 7, 2012 @ 3:07 PM

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s

Create a free website or blog at

%d bloggers like this: