Freestyle integration into Blender

April 3, 2012

Development updates on April 2

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

The Blender Freestyle branch spent a few months of relatively less development activities due to limited time resources.  Here is a short summary of new features and bug fixes since the last blog update.

New features and changes in the Parameter Editor mode

The following two stroke geometry modifiers have been added.

  • 2D Offset: Adds two-dimensional offsets to stroke backbone geometry.
  • 2D Transform: Applies two-dimensional scaling and rotation to stroke backbone geometry.

The 2D Offset geometry modifier has four parameters: start, end, X and Y.  The first two parameters add offset values in the direction perpendicular to the stroke direction.  The offset values are linearly interpolated from the beginning to the end of a stroke.  The X and Y parameters add absolute horizontal and vertical offset values.  The following image illustrates the effects of these parameters.

The 2D Transform modifier transforms stroke geometry by X and Y scaling factors and a rotation angle.  The center (pivot) of these 2D transformations can be: the stroke center, the beginning and the end of the stroke, a point along the stroke (specified by a value between 0 and 1, called stroke pivot parameter), and absolute 2D point (specified by X and Y coordinate values).

Example renders below demonstrate the effects of 2D offset, scaling and rotation (from left to right), where three external contours were modified separately with different modifier parameters.

   

With a view to a better use of screen space, the locations of edge type options within the Selection by Edge Types have been rearranged as shown below.  Frequently used edge types come first, and less used ones come after.

The two edge types “Ridge” and “Valley” have been unified into “Ridge & Valley”, since the Valley edge type is merely an alias of Ridge in the present Freestyle implementation.

Sphere radius and Kr derivative epsilon were removed from the Parameter Editor mode.  Now sphere radius of 1.0 and Kr derivative epsilon of 0.0 are used by default.  The rationale of the removal is two-fold: little predictability and very minor artistic values.  The effects of these parameters are hard to estimate in advance, which likely leads to a frustration of users due to repeated trials and unpredicted results.  Therefore, the two parameters are considered to have quite limited artistic values.  Proper definitions of the two parameters more and less require the knowledge of differential geometry and would not make sense to most artists for which the Parameter Editor is intended.

Sphere radius and Kr derivative epsilon are still available in the Python Scripting mode, but now in an “advanced options” section that is disabled and hidden by default.  In this way new users are properly warned, while expert users with specific technical needs can enable these options if they want.  The same default values mentioned above are used when the two parameters are disabled in the Python Scripting mode.

Fix for degenerate triangles in imported mesh data

A line visibility issue was identified by means of a .blend file supplied by a branch user.  The issue was caused by so-called degenerate triangles that are triangular faces whose area is zero.  It is useful to distinguish two types of degenerate triangles as follows.  Let A, B and P denote the three vertices of a triangle.  The triangle is said a degenerate triangle if:

  1. A and B are in the same position in the 3D space; or
  2. the distance between point P and line segment AB is zero.

Note that the former condition is a special case of the latter.  Degenerate triangles in the first form can be (and have been) addressed in the same way as the standard Remove Doubles command in Blender.  Those in the second form, on the other hand, are more difficult to address and thus require special treatment.

For what concerns line visibility in Freestyle, degenerate triangles become harmless if they are transformed into non-zero area triangles.  Hence, a preprocessor of imported mesh data from Blender to Freestyle was implemented to resolve degenerate triangles in the second form, where two different approaches to the solution of the issue have been attempted.

One approach is to check if a degenerate triangle is part of a quad face.  This checking is easily done by testing if three of the four vertices are colinear (i.e., they are lying on a line).  If that is the case, then depending on how the quad is separated into two triangles, one of them can be a degenerate triangle.  Degenerate triangles of this form is addressed by rotating the diagonal edge of the quad face without affecting the visual outcome.

The other approach is to add a very small offset to P so that the resulting triangles have a non-zero area.  The visual side-effect of this solution is likely to occur at a sub-pixel level, and thus considered negligible.

Several other attempts were made to explore the best way to handle degenerate triangles, and the two solutions above are found the most effective.  The dev team still keeps close eyes to the line visibility issue due to degenerate triangles.  More fixes will follow if some other sources of degenerate triangles are identified.  Problem reports on this matter are very welcome.

Bug fixes and miscellaneous improvements

The following user-visible bugs were fixed, many of which were kindly reported by branch users.

  • Color management was not working properly with Freestyle.
  • Color ramps were not immediately updated during the manipulation of a color picker.
  • The Selection by Image Border was not working correctly.
  • A crash due to invalid pointers within a copied line set was fixed.  Now the line set buffer is cleared when a new .blend file is opened, so that a line set may not be copied and pasted between .blend files.
  • The Backbone Stretcher geometry modifier had a hard-coded limit that the effect was applied to stokes with 2D length longer than 50.  Now the geometry modifier can be applied to strokes of any length.
  • A crash with FSAA enabled and Freestyle disabled was fixed.
  • Line style names were not made unique after a new name was set.

The dev team is grateful to branch users for their active testing of the software and problem reports.

Freestyle artwork by branch users

An increasing number of Blender artists have been sharing their results with Freestyle, through the BlenderArtists.org Freestyle thread, personal blogs, tweets and so on.  Here, two excellent pieces of artwork by RONIN (left) and s12a (right) are presented.

 

Many thanks for your contributions, RONIN and s12a!

About these ads

12 Comments »

  1. killer update. Thank you!

    Comment by Jikz — April 3, 2012 @ 3:51 AM

  2. Thanks!!!

    Comment by Ciriaco — April 4, 2012 @ 7:36 AM

  3. such a great update! Thanks to the entire freeStyle team.

    Comment by 3d — April 4, 2012 @ 10:53 AM

  4. hey guys, the core change of blender meshes (B-Mesh) in 2.63, affects the freestyle develop ???

    Comment by Cristian Hasbun B. — April 4, 2012 @ 12:48 PM

    • There is no negative impact of BMesh on Freestyle. As a matter of fact, Freestyle receives a number of tris and quads from Blender as a result of all mesh modifiers applied. This means that Freestyle did not (and won’t) have to deal with new mesh editing functionality provided by the BMesh integration.

      Comment by The dev team — April 11, 2012 @ 12:39 AM

  5. Thanks for the update. Awesome work!

    Comment by ikeahloe — April 5, 2012 @ 7:11 AM

  6. Thanks for the development of this render engine. I wonder when will this be put in the offical Blender?

    Comment by alpharesearch — April 6, 2012 @ 7:25 PM

    • No ETA can be presented at the moment because of limited time resources and the amount of pending work planned to be done before the merge into the trunk is asked.

      Comment by The dev team — April 11, 2012 @ 12:42 AM

  7. Thank you all for the welcoming comments (:

    Comment by The dev team — April 11, 2012 @ 12:43 AM

  8. That´s a great development for the Blender. Congratulations to the dev team!
    I worked with an old version of Freestyle to finish an animation and used a lot the sphere radius and Kr derivative epsilon parameters to give a better look to it. So I missed this parameters in the Parameter Editor mode of the new version. Could you give the option to enable this parameters in the Parameter Editor as you give in the Python Scripting mode?

    Comment by Frederick Montero — May 17, 2012 @ 12:46 PM

  9. Congrats on moving forward!

    I would sure want to see this become part of regular Blender, even with less functionality than it currently has, but stable and usable. Still, I have been with Freestyle since the times of old blog, andI still support its development whole-heartedly.

    Keep up the good work!

    Comment by barts706 — May 21, 2012 @ 11:04 AM

  10. Just a quick question – which sourceforge freestyle build is the working one? I’ve downloaded two and they don’t seem to work – but the problem may be on my end.

    Comment by ClipArtIllustration.com — June 21, 2012 @ 3:12 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:

WordPress.com Logo

You are commenting using your WordPress.com 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

The WordPress Classic Theme. Create a free website or blog at WordPress.com.

Follow

Get every new post delivered to your Inbox.

Join 57 other followers

%d bloggers like this: