# and, second, so as to chain several times the same ViewEdge. from freestyle.chainingiterators import pySketchyChainingIterator from freestyle.predicates import ( QuantitativeInvisibilityUP1D, TrueUP1D, ) from freestyle.shaders import ( IncreasingColorShader, IncreasingThicknessShader, SamplingShader, SmoothingShader, SpatialNoiseShader, pyBackboneStretcherNoCuspShader, ) from freestyle.types import Operators Operators.select(QuantitativeInvisibilityUP1D(0)) ## Chain 3 times each ViewEdge independently 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), IncreasingColorShader(0.2, 0.2, 0.2, 1, 0.5, 0.5, 0.5, 1), ] Operators.create(TrueUP1D(), shaders_list)
# that do not belong to the external contour of the scene from freestyle.chainingiterators import ChainSilhouetteIterator from freestyle.predicates import ( AndUP1D, ExternalContourUP1D, NotUP1D, QuantitativeInvisibilityUP1D, TrueUP1D, ) from freestyle.shaders import ( BackboneStretcherShader, IncreasingColorShader, IncreasingThicknessShader, SamplingShader, SpatialNoiseShader, ) from freestyle.types import Operators upred = AndUP1D(QuantitativeInvisibilityUP1D(0), ExternalContourUP1D()) Operators.select(upred) Operators.bidirectional_chain(ChainSilhouetteIterator(), NotUP1D(upred)) shaders_list = [ SamplingShader(4), SpatialNoiseShader(4, 150, 2, True, True), IncreasingThicknessShader(2, 5), BackboneStretcherShader(20), IncreasingColorShader(1, 0, 0, 1, 0, 1, 0, 1), ] Operators.create(TrueUP1D(), shaders_list)
# 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 freestyle.chainingiterators import pySketchyChainSilhouetteIterator from freestyle.predicates import ( QuantitativeInvisibilityUP1D, TrueUP1D, ) from freestyle.shaders import ( IncreasingColorShader, IncreasingThicknessShader, SamplingShader, SmoothingShader, SpatialNoiseShader, pyHLRShader, ) from freestyle.types import Operators 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), pyHLRShader(), ] Operators.create(TrueUP1D(), shaders_list)
from freestyle.predicates import ( AndUP1D, ContourUP1D, NotUP1D, QuantitativeInvisibilityUP1D, SameShapeIdBP1D, TrueUP1D, pyHigherLengthUP1D, ) from freestyle.shaders import ( ConstantThicknessShader, IncreasingColorShader, pyBluePrintEllipsesShader, pyPerlinNoise1DShader, ) from freestyle.types import Operators 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), pyBluePrintEllipsesShader(3), pyPerlinNoise1DShader(0.1, 10, 8), IncreasingColorShader(0.6, 0.3, 0.3, 0.7, 0.3, 0.3, 0.3, 0.1), ] Operators.create(TrueUP1D(), shaders_list)
# Filename : contour.py # Author : Stephane Grabli # Date : 04/08/2005 # Purpose : Draws each object's visible contour from freestyle.chainingiterators import ChainPredicateIterator from freestyle.predicates import ( AndUP1D, ContourUP1D, NotUP1D, QuantitativeInvisibilityUP1D, SameShapeIdBP1D, TrueUP1D, ) from freestyle.shaders import ( ConstantThicknessShader, IncreasingColorShader, ) from freestyle.types import Operators Operators.select(AndUP1D(QuantitativeInvisibilityUP1D(0), ContourUP1D())) bpred = SameShapeIdBP1D() upred = AndUP1D(QuantitativeInvisibilityUP1D(0), ContourUP1D()) Operators.bidirectional_chain(ChainPredicateIterator(upred, bpred), NotUP1D(QuantitativeInvisibilityUP1D(0))) shaders_list = [ ConstantThicknessShader(5.0), IncreasingColorShader(0.8, 0, 0, 1, 0.1, 0, 0, 1), ] Operators.create(TrueUP1D(), shaders_list)
from freestyle.chainingiterators import ChainPredicateIterator from freestyle.predicates import ( AndUP1D, ExternalContourUP1D, NotUP1D, QuantitativeInvisibilityUP1D, TrueBP1D, TrueUP1D, ) from freestyle.shaders import ( IncreasingColorShader, IncreasingThicknessShader, SamplingShader, SmoothingShader, ) from freestyle.types import Operators 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)
from freestyle.predicates import ( AndUP1D, ContourUP1D, NotUP1D, QuantitativeInvisibilityUP1D, SameShapeIdBP1D, TrueUP1D, pyHigherLengthUP1D, ) from freestyle.shaders import ( ConstantThicknessShader, IncreasingColorShader, pyBluePrintCirclesShader, pyPerlinNoise1DShader, ) from freestyle.types import Operators 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), IncreasingColorShader(0.8, 0.8, 0.3, 0.4, 0.3, 0.3, 0.3, 0.1), ] Operators.create(TrueUP1D(), shaders_list)