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.