Since the last blog update, the Freestyle branch made a slow but steady progress. Here is a brief summary of new elements and user-visible changes in the Freestyle rendering engine and its user interface.
General usability improvements
1. New options for specifying unit line thickness has been added in the Post Processing tab in the Render buttons. These options allow you to define unit line thickness in two different modes:
- Absolute mode: The unit line thickness is given by a user-specified number in units of pixels. The default value is 1.
- Relative mode: The unit line thickness is scaled by the proportion of the present vertical image resolution to 480 pixels. For instance, the unit line thickness is 1 with the image height set to 480, 1.5 with 720, and 2 with 960.
2. A long-standing bug due to an inappropriate removal of singular points in stroke creation was fixed.
The previous stroke creation procedure was trying to clean stroke topology by removing overlapping stroke vertices in the same 2D location. The idea was to avoid having to address this kind of singularity during subsequent stroke shading. In-depth analyses revealed, however, that this was a wrong way to ensure clean stroke topology, since just deleting overlapping vertices may break the continuity of the underlying series of FEdges on top of which the stroke has been built. Such a break of linked FEdges was a major cause of frequent failure in CurvePoint::getFEdge().
The implemented solution aims to address the singularity issue by adding small offsets to the 2D location of overlapping vertices and making them non-overlapping to each other. Since the offsets only result in sub-pixel differences, the impact on visual outcomes is expected to be negligible.
In addition, an attempt was made to fix an instability issue in stroke rendering due to a failure of Normal2DF0D with smooth FEdges. The fix is to avoid generating new FEdgeSmooth instances whose length is shorter than epsilon.
3. The response of the ESC key for stopping Freestyle rendering has been improved throughout the rendering process. The rendering with Freestyle consists of several steps including: (1) mesh data loading, (2) winged edge construction, (3) silhouette edge detection, (4) view map construction, and (5) stroke drawing. All these steps have been extended to frequently check if the ESC key is pressed, so that users can abort time-consuming rendering at any point of time.
4. New operators have been introduced for adding the data paths to Freestyle edge/face mark properties of selected edges/polygons into the active keying set. These operators are intended to make it easy to keyframe a number of Freestyle edge/face marks.
- Add Edge Marks to Keying Set (bpy.ops.scene.freestyle_add_edge_marks_to_keying_set)
- Add Face Marks to Keying Set (bpy.ops.scene.freestyle_add_face_marks_to_keying_set)
These operators are accessible from the Space bar menu by entering the operator names, as illustrated in the following screen captures.
5. The lower limit of Kr derivative epsilon has been changed from 0 to -1000 so as to permit a negative value.
New elements in the Parameter Editor mode
1. New options for controlling the position of stroke thickness have been introduced. These options enable a better control on the position of stroke thickness with respect to stroke backbone geometry. Three predefined positions are:
- center: thickness is evenly split to the left and right side of the stroke geometry.
- inside: strokes are drawn within object boundary.
- outside: strokes are drawn outside the object boundary.
Another option called “relative” allows you to specify the relative position by a number between 0 (inside) and 1 (outside).
The following renders show the effects of the three predefined positions.
The following render is an example of the relative position with the thickness ratio set to 0.3.
The thickness position options are applied only to strokes of the edge types SILHOUETTE and BORDER, since these are the only edge types defined in terms of object boundary. Strokes of other edge types are always drawn using the “center” option.
The thickness position options are also applied only when chaining is disabled or the Plain chaining is used with the Same Object option enabled (as shown below). The default “center” positioning is used otherwise.
2. Sphere radius and Kr derivative epsilon have been recovered in the Parameter Editor mode. Several users requested the recovery as the removal of the two parameters was considered over-simplification for advanced users (see the blog article on April 2 for the rationale of the removal). As in the Python Scripting mode, the two parameters are in the “advanced edge detection options” section and disabled by default.
- Fix for Freestyle-related UI components showing up in the Render buttons when Cycles was selected.
- Fix for NaN (not a number) in the Z component of projected points. This issue arose when the Z depth of the bounding box of the scene being rendered is zero.
- Fix for emitted objects of a particle system not rendered properly. The problem was reported by octane98 with a sample .blend file. Thanks!
- Fix for the WithinImageBorderUP1D predicate not working with a ViewEdge such that none of the SVertices are within the image boundary but an FEdge intersects with the image boundary.
- Fix for X and Y aspect ratios not working properly with Freestyle stroke rendering. The problem was reported by octane98 through the BA Freestyle thread. Thanks!
- Fix for the Selection by Group not working correctly when the specified group was empty. The problem was reported by vicentecarro with an example .blend file to reproduce the issue. Thanks!
- Fix for a crash due to a corruption of data for addressing degenerate triangles in imported mesh data.
- Fix for a crash in the single layer mode with Freestyle enabled.
Freestyle user activities
Freestyle branch users are active and keep sharing their results and new ideas through the BlenderArtists.org, personal blogs, and so on. Recently mclelun has started new project “the Overweight Boss” using Blender and Freestyle. Here is a couple of excellent results from him. The dev team is very grateful for his achievement!
BlenderNPR.org is a new hub site for gathering information about non-photorealistic (NPR) rendering with Blender. Freestyle tips and results are part of the new site’s main topics. In addition, a new discussion thread has been open for collecting feature requests, new ideas and thoughts to improve Freestyle. If you have something that you want to see in Freestyle in the future, you are definitely encouraged to post it in this discussion thread.