# Filename : multiple_parameterization.py # Author : Stephane Grabli # Date : 04/08/2005 # Purpose : The thickness and the color of the strokes vary continuously # independently from occlusions although only # visible lines are actually drawn. This is equivalent # to assigning the thickness using a parameterization covering # the complete silhouette (visible+invisible) and drawing # the strokes using a second parameterization that only # covers the visible portions. from freestyle import ChainSilhouetteIterator, ConstantColorShader, IncreasingColorShader, \ IncreasingThicknessShader, Operators, QuantitativeInvisibilityUP1D, SamplingShader, \ TextureAssignerShader, TrueUP1D from shaders import pyHLRShader Operators.select(QuantitativeInvisibilityUP1D(0)) ## Chain following the same nature, but without the restriction ## of staying inside the selection (0). Operators.bidirectional_chain(ChainSilhouetteIterator(0)) shaders_list = [ SamplingShader(20), IncreasingThicknessShader(1.5, 30), ConstantColorShader(0.0, 0.0, 0.0), IncreasingColorShader(1, 0, 0, 1, 0, 1, 0, 1), TextureAssignerShader(-1), pyHLRShader(), ## this shader draws only visible portions ] Operators.create(TrueUP1D(), shaders_list)
# GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software Foundation, # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # # ##### END GPL LICENSE BLOCK ##### # Filename : external_contour_smooth.py # Author : Stephane Grabli # Date : 04/08/2005 # Purpose : Draws a smooth external contour from freestyle import ChainPredicateIterator, ExternalContourUP1D, IncreasingColorShader, \ IncreasingThicknessShader, Operators, QuantitativeInvisibilityUP1D, SamplingShader, \ SmoothingShader, TrueBP1D, TrueUP1D from logical_operators import AndUP1D, NotUP1D upred = AndUP1D(QuantitativeInvisibilityUP1D(0), ExternalContourUP1D()) Operators.select(upred) bpred = TrueBP1D() Operators.bidirectional_chain(ChainPredicateIterator(upred, bpred), NotUP1D(upred)) shaders_list = [ SamplingShader(2), IncreasingThicknessShader(4, 20), IncreasingColorShader(1.0, 0.0, 0.5, 1, 0.5, 1, 0.3, 1), SmoothingShader(100, 0.05, 0, 0.2, 0, 0, 0, 1), ] Operators.create(TrueUP1D(), shaders_list)
# along with this program; if not, write to the Free Software Foundation, # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # # ##### END GPL LICENSE BLOCK ##### # Filename : blueprint_squares.py # Author : Emmanuel Turquin # Date : 04/08/2005 # Purpose : Produces a blueprint using square contour strokes from freestyle import ChainPredicateIterator, ConstantThicknessShader, ContourUP1D, IncreasingColorShader, \ Operators, QuantitativeInvisibilityUP1D, SameShapeIdBP1D, TextureAssignerShader, TrueUP1D from PredicatesU1D import pyHigherLengthUP1D from logical_operators import AndUP1D, NotUP1D from shaders import pyBluePrintSquaresShader, pyPerlinNoise1DShader upred = AndUP1D(QuantitativeInvisibilityUP1D(0), ContourUP1D()) bpred = SameShapeIdBP1D() Operators.select(upred) Operators.bidirectional_chain(ChainPredicateIterator(upred, bpred), NotUP1D(upred)) Operators.select(pyHigherLengthUP1D(200)) shaders_list = [ ConstantThicknessShader(8), pyBluePrintSquaresShader(2, 20), pyPerlinNoise1DShader(0.07, 10, 8), TextureAssignerShader(4), IncreasingColorShader(0.6, 0.3, 0.3, 0.7, 0.6, 0.3, 0.3, 0.3), ConstantThicknessShader(4), ] Operators.create(TrueUP1D(), shaders_list)
# GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software Foundation, # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # # ##### END GPL LICENSE BLOCK ##### # Filename : nature.py # Author : Stephane Grabli # Date : 04/08/2005 # Purpose : Uses the NatureUP1D predicate to select the lines # of a given type (among Nature.SILHOUETTE, Nature.CREASE, Nature.SUGGESTIVE_CONTOURS, # Nature.BORDERS). # The suggestive contours must have been enabled in the # options dialog to appear in the View Map. from freestyle import ChainSilhouetteIterator, IncreasingColorShader, \ IncreasingThicknessShader, Nature, Operators, TrueUP1D from PredicatesU1D import pyNatureUP1D from logical_operators import NotUP1D Operators.select(pyNatureUP1D(Nature.SILHOUETTE)) Operators.bidirectional_chain(ChainSilhouetteIterator(), NotUP1D(pyNatureUP1D(Nature.SILHOUETTE))) shaders_list = [ IncreasingThicknessShader(3, 10), IncreasingColorShader(0.0, 0.0, 0.0, 1, 0.8, 0, 0, 1), ] Operators.create(TrueUP1D(), shaders_list)
# along with this program; if not, write to the Free Software Foundation, # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # # ##### END GPL LICENSE BLOCK ##### # Filename : blueprint_circles.py # Author : Emmanuel Turquin # Date : 04/08/2005 # Purpose : Produces a blueprint using circular contour strokes from freestyle import ChainPredicateIterator, ConstantThicknessShader, ContourUP1D, IncreasingColorShader, \ Operators, QuantitativeInvisibilityUP1D, SameShapeIdBP1D, TextureAssignerShader, TrueUP1D from PredicatesU1D import pyHigherLengthUP1D from logical_operators import AndUP1D, NotUP1D from shaders import pyBluePrintCirclesShader, pyPerlinNoise1DShader upred = AndUP1D(QuantitativeInvisibilityUP1D(0), ContourUP1D()) bpred = SameShapeIdBP1D() Operators.select(upred) Operators.bidirectional_chain(ChainPredicateIterator(upred, bpred), NotUP1D(upred)) Operators.select(pyHigherLengthUP1D(200)) shaders_list = [ ConstantThicknessShader(5), pyBluePrintCirclesShader(3), pyPerlinNoise1DShader(0.1, 15, 8), TextureAssignerShader(4), IncreasingColorShader(0.8, 0.8, 0.3, 0.4, 0.3, 0.3, 0.3, 0.1), ] Operators.create(TrueUP1D(), shaders_list)
# Filename : sketchy_topology_broken.py # Author : Stephane Grabli # Date : 04/08/2005 # Purpose : The topology of the strokes is, first, built # independantly from the 3D topology of objects, # and, second, so as to chain several times the same ViewEdge. from ChainingIterators import pySketchyChainingIterator from freestyle import IncreasingColorShader, IncreasingThicknessShader, Operators, \ QuantitativeInvisibilityUP1D, SamplingShader, SmoothingShader, SpatialNoiseShader, \ TextureAssignerShader, TrueUP1D from shaders import pyBackboneStretcherNoCuspShader Operators.select(QuantitativeInvisibilityUP1D(0)) ## Chain 3 times each ViewEdge indpendantly from the ## initial objects topology Operators.bidirectional_chain(pySketchyChainingIterator(3)) shaders_list = [ SamplingShader(4), SpatialNoiseShader(6, 120, 2, True, True), IncreasingThicknessShader(4, 10), SmoothingShader(100, 0.1, 0, 0.2, 0, 0, 0, 1), pyBackboneStretcherNoCuspShader(20), #ConstantColorShader(0.0, 0.0, 0.0) IncreasingColorShader(0.2, 0.2, 0.2, 1, 0.5, 0.5, 0.5, 1), #IncreasingColorShader(1, 0, 0, 1, 0, 1, 0, 1), TextureAssignerShader(4), ] Operators.create(TrueUP1D(), shaders_list)
# along with this program; if not, write to the Free Software Foundation, # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # # ##### END GPL LICENSE BLOCK ##### # Filename : sketchy_multiple_parameterization.py # Author : Stephane Grabli # Date : 04/08/2005 # Purpose : Builds sketchy strokes whose topology relies on a # parameterization that covers the complete lines (visible+invisible) # whereas only the visible portions are actually drawn from ChainingIterators import pySketchyChainSilhouetteIterator from freestyle import IncreasingColorShader, IncreasingThicknessShader, Operators, \ QuantitativeInvisibilityUP1D, SamplingShader, SmoothingShader, SpatialNoiseShader, \ TextureAssignerShader, TrueUP1D from shaders import pyHLRShader Operators.select(QuantitativeInvisibilityUP1D(0)) Operators.bidirectional_chain(pySketchyChainSilhouetteIterator(3, False)) shaders_list = [ SamplingShader(2), SpatialNoiseShader(15, 120, 2, True, True), IncreasingThicknessShader(5, 30), SmoothingShader(100, 0.05, 0, 0.2, 0, 0, 0, 1), IncreasingColorShader(0, 0.2, 0, 1, 0.2, 0.7, 0.2, 1), TextureAssignerShader(6), pyHLRShader(), ] Operators.create(TrueUP1D(), shaders_list)