Freestyle integration into Blender

February 9, 2010

Weekly update February 1-7

Filed under: Update — The dev team @ 12:32 AM

Now that the instability issues listed in the new to-do list have been mostly addressed, the next target is to recover missing features enumerated in the to-do list.  To begin with, the dev team was working on transparent stroke colors during the last week.

In Freestyle, strokes to be rendered are represented with triangle strips.  Stroke colors can be constant throughout a stroke, as well as variable for each triangle.  Therefore, strokes are rendered by means of vertex colors in Blender.  Stroke colors are specified in the RGBA format, whereas vertex colors do not have an alpha component (as a matter of fact, the internal MCol data structure for holding vertex colors has an alpha value, but the Blender internal renderer does not use it).  This latter fact makes it difficult to render transparent stroke colors using the Blender internal renderer.

One approach to realize transparent stroke colors is to define transparent materials and assign them to triangles, instead of relying on vertex colors.  It is remarked, however, that the maximum number of materials per mesh is 65536.  This means that variable stroke colors cannot attain a very high gradient resolution.

Another approach is to employ a different general-purpose 2D rendering engine (such as Cairo) instead of using the Blender internal renderer.  In fact, using the internal renderer for stroke rendering in Freestyle is a tricky idea, because Freestyle is a post-processing engine like the compositor and sequencer and thus the internal renderer is considered to have finished its job before Freestyle is invoked.  Freestyle creates a temporary scene of its own to render strokes using the internal renderer, which Brecht described as “it looks like a hack.”  However, employing an external 2D rendering engine imposes an extra software dependency that would complicate not only code maintenance by the dev team but also user-side build processes in various platforms.  These considerations have motivated the use of the Blender internal renderer for stroke rendering in Freestyle.

Back to the problem of implementing transparent stroke colors, we decided to remain with the Blender internal renderer.  Since vertex colors do not directly deal with transparency, we here employ a two-pass rendering approach as follows.  First, the alpha component of an image is rendered by utilizing the red component of vertex colors as the alpha component of stroke colors (1st pass).  The render result is saved into a temporary buffer.  Then, the vertex colors of stroke meshes are replaced with RGB values, and the RGB components of the image are rendered (2nd pass).  Finally, the alpha and RGB components are merged to produce the render result in the RGBA format.  This method has been implemented in revision 26695 of the Freestyle branch.  Any kind of feedback on this matter would be greatly appreciated.



  1. :) nice progress

    Comment by dd — February 9, 2010 @ 2:23 AM

  2. Looks like a build might have already been posted in Graphicall, time to test it out.. RGBA with freestyle will save me many current compositor steps I perform for blender freestyle use in my current projects. Thank you for the continued deveoplment of the freestyle branch.

    Comment by blenderificus — February 9, 2010 @ 7:40 AM

  3. cool uodate, thankyou.

    But is little bit hard to found tutorials :(, so I work in japan and we use 3dsmax +pensil for render ANIME, freestyle would be a great feature for use :)

    Comment by Max Puliero — February 9, 2010 @ 10:10 AM

  4. Hi,
    Textured stroke couldn’t help you with this alpha issue ?

    Comment by Steren — February 9, 2010 @ 6:18 PM

  5. Steren,
    I don’t think textured strokes would help with the alpha issue,
    because AFAIK textures in Blender are part of materials and thus share
    the limination regarding the maximum number of materials per mesh.
    Anyway thanks for the comment and your interest on the software.

    Comment by The dev team — February 10, 2010 @ 9:38 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 )

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

Blog at

%d bloggers like this: