Пример #1
0
from freestyle.chainingiterators import pySketchyChainingIterator
from freestyle.predicates import (
    AndUP1D,
    ExternalContourUP1D,
    NotUP1D,
    QuantitativeInvisibilityUP1D,
    TrueUP1D,
)
from freestyle.shaders import (
    IncreasingColorShader,
    IncreasingThicknessShader,
    SamplingShader,
    SmoothingShader,
    SpatialNoiseShader,
    TextureAssignerShader,
)
from freestyle.types import Operators

upred = AndUP1D(QuantitativeInvisibilityUP1D(0), ExternalContourUP1D())
Operators.select(upred)
Operators.bidirectional_chain(pySketchyChainingIterator(), NotUP1D(upred))
shaders_list = [
    SamplingShader(4),
    SpatialNoiseShader(10, 150, 2, True, True),
    IncreasingThicknessShader(4, 10),
    SmoothingShader(400, 0.1, 0, 0.2, 0, 0, 0, 1),
    IncreasingColorShader(1, 0, 0, 1, 0, 1, 0, 1),
    TextureAssignerShader(4),
]
Operators.create(TrueUP1D(), shaders_list)
#  Date     : 04/08/2005
#  Purpose  : The topology of the strokes is built
#             so as to chain several times the same ViewEdge.
#             The topology of the objects is preserved

from freestyle.chainingiterators import pySketchyChainSilhouetteIterator
from freestyle.predicates import (
    QuantitativeInvisibilityUP1D,
    TrueUP1D,
)
from freestyle.shaders import (
    ConstantColorShader,
    IncreasingThicknessShader,
    SamplingShader,
    SmoothingShader,
    SpatialNoiseShader,
)
from freestyle.types import Operators

upred = QuantitativeInvisibilityUP1D(0)
Operators.select(upred)
Operators.bidirectional_chain(pySketchyChainSilhouetteIterator(3, True))
shaders_list = [
    SamplingShader(4),
    SpatialNoiseShader(20, 220, 2, True, True),
    IncreasingThicknessShader(4, 8),
    SmoothingShader(300, 0.05, 0, 0.2, 0, 0, 0, 0.5),
    ConstantColorShader(0.6, 0.2, 0.0),
]
Operators.create(TrueUP1D(), shaders_list)
Пример #3
0
#  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)