This week the Freestyle branch received a few commits aimed at consolidation of the Python API. In addition, type checking of boolean arguments in class constructors and methods was relaxed so as to accept not only True and False but also various other boolean expressions such as 0, 1, and None.
Test renders of the week is concerned with quantitative visibility. In Freestyle, the visibility of a view edge (i.e. a line segment in a projected 2D scene) is described based on the notion of quantitative visibility. Simply put, the quantitative visibility of a view edge is the number of surfaces that hide the view edge. If the view edge is not hidden by any surface in the scene, the quantitative visibility of the view edge is 0. If the view edge is hidden by a surface, then the quantitative visibility is 1. If hidden by 2 surfaces, the value is 2, and so on. In style modules, this value can be tested with the QuantitativeVisibilityUP1D predicate. For example, the expression
QuantitativeVisibilityUP1D(0) is true if the quantitative visibility of a view edge is 0 (i.e., the view edge is visible) and false otherwise. Consequently,
Operators.select(QuantitativeVisibilityUP1D(0)) is an operation to select all visible view edges in the scene.
The notion of quantitative visibility was originally proposed by Arther Appel in a paper published in 1967. The image shown below is a test render intended to reproduce Figure 1B in the paper using Freestyle. You may notice that the quantitative visibility values shown in the test render are slightly different from the values presented in Figure 1B. In fact, the paper defines quantitative visibility as a value that increases or decreases when a line in question passes a contour line. For the purpose of a stylization API for human artists, Freestyle’s modified definition of quantitative visibility looks a bit more intuitive. By means of the QuantitativeVisibilityUP1D predicate, you have a fine control on view edge visibility.