This module contains stroke shaders used for creation of stylized strokes. It is also intended to be a collection of examples for shader definition in Python.
User-defined stroke shaders inherit the freestyle.types.StrokeShader class.
Class hierarchy: freestyle.types.StrokeShader > BackboneStretcherShader
[Geometry shader]
Builds a BackboneStretcherShader object.
Parameters: | amount (float) – The stretching amount value. |
---|
Stretches the stroke at its two extremities and following the respective directions: v(1)v(0) and v(n-1)v(n).
Parameters: | stroke (freestyle.types.Stroke) – A Stroke object. |
---|
Class hierarchy: freestyle.types.StrokeShader > BezierCurveShader
[Geometry shader]
Builds a BezierCurveShader object.
Parameters: | error (float) – The error we’re allowing for the approximation. This error is the max distance allowed between the new curve and the original geometry. |
---|
Transforms the stroke backbone geometry so that it corresponds to a Bezier Curve approximation of the original backbone geometry.
Parameters: | stroke (freestyle.types.Stroke) – A Stroke object. |
---|
Class hierarchy: freestyle.types.StrokeShader > BlenderTextureShader
[Texture shader]
Builds a BlenderTextureShader object.
Parameters: | texture (bpy.types.LineStyleTextureSlot or bpy.types.ShaderNodeTree) – A line style texture slot or a shader node tree to define a set of textures. |
---|
Assigns a blender texture slot to the stroke shading in order to simulate marks.
Parameters: | stroke (freestyle.types.Stroke) – A Stroke object. |
---|
Class hierarchy: freestyle.types.StrokeShader > CalligraphicShader
[Thickness Shader]
Builds a CalligraphicShader object.
Parameters: |
|
---|
Assigns thicknesses to the stroke vertices so that the stroke looks like made with a calligraphic tool, i.e. the stroke will be the thickest in a main direction, and the thinest in the direction perpendicular to this one, and an interpolation inbetween.
Parameters: | stroke (freestyle.types.Stroke) – A Stroke object. |
---|
Class hierarchy: freestyle.types.StrokeShader > ColorNoiseShader
[Color shader]
Builds a ColorNoiseShader object.
Parameters: |
|
---|
Shader to add noise to the stroke colors.
Parameters: | stroke (freestyle.types.Stroke) – A Stroke object. |
---|
Class hierarchy: freestyle.types.StrokeShader > ColorVariationPatternShader
[Color shader]
Builds a ColorVariationPatternShader object.
Parameters: |
|
---|
Applies a pattern to vary the original color. The new color is the result of the multiplication of the pattern and the original color.
Parameters: | stroke (freestyle.types.Stroke) – A Stroke object. |
---|
Class hierarchy: freestyle.types.StrokeShader > ConstantColorShader
[Color shader]
Builds a ConstantColorShader object.
Parameters: |
|
---|
Assigns a constant color to every vertex of the Stroke.
Parameters: | stroke (freestyle.types.Stroke) – A Stroke object. |
---|
Class hierarchy: freestyle.types.StrokeShader > ConstantThicknessShader
[Thickness shader]
Builds a ConstantThicknessShader object.
Parameters: | thickness (float) – The thickness that must be assigned to the stroke. |
---|
Assigns an absolute constant thickness to every vertex of the Stroke.
Parameters: | stroke (freestyle.types.Stroke) – A Stroke object. |
---|
Class hierarchy: freestyle.types.StrokeShader > ConstrainedIncreasingThicknessShader
[Thickness shader]
Builds a ConstrainedIncreasingThicknessShader object.
Parameters: |
|
---|
Same as the IncreasingThicknessShader, but here we allow the user to control the thickness/length ratio so that we don’t get fat short lines.
Parameters: | stroke (freestyle.types.Stroke) – A Stroke object. |
---|
Class hierarchy: freestyle.types.StrokeShader > GuidingLinesShader
[Geometry shader]
Builds a GuidingLinesShader object.
Parameters: | offset (float) – The line that replaces the stroke is initially in the middle of the initial stroke bounding box. offset is the value of the displacement which is applied to this line along its normal. |
---|
Shader to modify the Stroke geometry so that it corresponds to its main direction line. This shader must be used together with the splitting operator using the curvature criterion. Indeed, the precision of the approximation will depend on the size of the stroke’s pieces. The bigger the pieces are, the rougher the approximation is.
Parameters: | stroke (freestyle.types.Stroke) – A Stroke object. |
---|
Class hierarchy: freestyle.types.StrokeShader > IncreasingColorShader
[Color shader]
Builds an IncreasingColorShader object.
Parameters: |
|
---|
Assigns a varying color to the stroke. The user specifies two colors A and B. The stroke color will change linearly from A to B between the first and the last vertex.
Parameters: | stroke (freestyle.types.Stroke) – A Stroke object. |
---|
Class hierarchy: freestyle.types.StrokeShader > IncreasingThicknessShader
[Thickness shader]
Builds an IncreasingThicknessShader object.
Parameters: |
|
---|
Assigns thicknesses values such as the thickness increases from a thickness value A to a thickness value B between the first vertex to the midpoint vertex and then decreases from B to a A between this midpoint vertex and the last vertex. The thickness is linearly interpolated from A to B.
Parameters: | stroke (freestyle.types.Stroke) – A Stroke object. |
---|
Class hierarchy: freestyle.types.StrokeShader > PolygonalizationShader
[Geometry shader]
Builds a PolygonalizationShader object.
Parameters: | error (float) – The error we want our polygonal approximation to have with respect to the original geometry. The smaller, the closer the new stroke is to the orinal one. This error corresponds to the maximum distance between the new stroke and the old one. |
---|
Modifies the Stroke geometry so that it looks more “polygonal”. The basic idea is to start from the minimal stroke approximation consisting in a line joining the first vertex to the last one and to subdivide using the original stroke vertices until a certain error is reached.
Parameters: | stroke (freestyle.types.Stroke) – A Stroke object. |
---|
Class hierarchy: freestyle.types.StrokeShader > SamplingShader
[Geometry shader]
Builds a SamplingShader object.
Parameters: | sampling (float) – The sampling to use for the stroke resampling. |
---|
Resamples the stroke.
Parameters: | stroke (freestyle.types.Stroke) – A Stroke object. |
---|
Class hierarchy: freestyle.types.StrokeShader > SmoothingShader
[Geometry shader]
Builds a SmoothingShader object.
Parameters: |
|
---|
Smoothes the stroke by moving the vertices to make the stroke smoother. Uses curvature flow to converge towards a curve of constant curvature. The diffusion method we use is anisotropic to prevent the diffusion across corners.
Parameters: | stroke (freestyle.types.Stroke) – A Stroke object. |
---|
Class hierarchy: freestyle.types.StrokeShader > SpatialNoiseShader
[Geometry shader]
Builds a SpatialNoiseShader object.
Parameters: |
|
---|
Spatial Noise stroke shader. Moves the vertices to make the stroke more noisy.
Parameters: | stroke (freestyle.types.Stroke) – A Stroke object. |
---|
Class hierarchy: freestyle.types.StrokeShader > StrokeTextureShader
[Texture shader]
Builds a StrokeTextureShader object.
Parameters: |
|
---|
The format of a texture image including tips:
___________
| |
| A |
|___________|
| | |
| B | C |
|_____|_____|
Assigns a texture and a blending mode to the stroke in order to simulate its marks system.
Parameters: | stroke (freestyle.types.Stroke) – A Stroke object. |
---|
Class hierarchy: freestyle.types.StrokeShader > StrokeTextureStepShader
[Texture shader]
Builds a StrokeTextureStepShader object.
Parameters: | step (float) – The spacing along the stroke. |
---|
Assigns a spacing factor to the texture coordinates of the Stroke.
Parameters: | stroke (freestyle.types.Stroke) – A Stroke object. |
---|
Class hierarchy: freestyle.types.StrokeShader > TextureAssignerShader
[Texture shader]
Builds a TextureAssignerShader object.
Parameters: | preset (int) – The preset number to use. |
---|
Assigns a texture to the stroke in order to simulate its marks system. This shader takes as input an integer value telling which texture and blending mode to use among a set of predefined textures. Here are the different presets:
Any other value will lead to the following preset:
Parameters: | stroke (freestyle.types.Stroke) – A Stroke object. |
---|
Class hierarchy: freestyle.types.StrokeShader > ThicknessNoiseShader
[Thickness shader]
Builds a ThicknessNoiseShader object.
Parameters: |
|
---|
Adds some noise to the stroke thickness.
Parameters: | stroke (freestyle.types.Stroke) – A Stroke object. |
---|
Class hierarchy: freestyle.types.StrokeShader > ThicknessVariationPatternShader
[Thickness shader]
Builds a ThicknessVariationPatternShader object.
Parameters: |
|
---|
Applies a pattern (texture) to vary thickness. The new thicknesses are the result of the multiplication of the pattern and the original thickness.
Parameters: | stroke (freestyle.types.Stroke) – A Stroke object. |
---|
Class hierarchy: freestyle.types.StrokeShader > TipRemoverShader
[Geometry shader]
Builds a TipRemoverShader object.
Parameters: | tip_length (float) – The length of the piece of stroke we want to remove at each extremity. |
---|
Removes the stroke’s extremities.
Parameters: | stroke (freestyle.types.Stroke) – A Stroke object. |
---|
Class hierarchy: freestyle.types.StrokeShader > fstreamShader
[Output shader]
Builds a fstreamShader object.
Parameters: | filename (str) – The output file name. |
---|
Streams the Stroke in a file.
Parameters: | stroke (freestyle.types.Stroke) – A Stroke object. |
---|
Assigns a color (greyscale) to the stroke based on the curvature. A higher curvature will yield a brighter color.
Stretches the stroke’s backbone, excluding cusp vertices (end junctions).
Stretches the stroke’s backbone by a given length (in pixels).
Draws the silhouette of the object as a circle.
Replaces the stroke with a directed square.
Assigns a constant color to the stroke.
Assigns a constant thickness along the stroke.
Increasingly thickens the stroke, constrained by a ratio of the stroke’s length.
Inverse of pyIncreasingThicknessShader, decreasingly thickens the stroke.
Assigns a thickness to the stroke based on the stroke’s distance to the camera (Z-value).
Iteratively adds an offset to the position of each stroke vertex in the direction perpendicular to the stroke direction at the point. The offset is scaled by the 2D curvature (i.e. how quickly the stroke curve is) at the point.
Assings thickness to a stroke based on the density of the diffuse map.
Controlls visibility based upon the quantative invisibility (QI) based on hidden line removal (HLR).
Assigns thickness based on distance to a given point in 2D space. the thickness is inverted, so the vertices closest to the specified point have the lowest thickness.
Assigns thickness based on distance to a given point in 3D space.
Fades from one color to another along the stroke.
Increasingly thickens the stroke.
Fades from one color to another and back.
Stretches the stroke’s backbone proportional to the stroke’s length NOTE: you’ll probably want an l somewhere between (0.5 - 0). A value that is too high may yield unexpected results.
Assigns the color of the underlying material to the stroke.
Limits the stroke’s alpha between a min and max value.
Assigns thickness to a stroke based on an exponential function.
Displaces the stroke using the curvilinear abscissa. This means that lines with the same length and sampling interval will be identically distorded.
Displaces the stroke using the strokes coordinates. This means that in a scene no strokes will be distorded identically.
More information on the noise shaders can be found at: freestyleintegration.wordpress.com/2011/09/25/development-updates-on-september-25/
Assigns a color to the stroke based on given seed.
Assigns thickness to a stroke based on spherical linear interpolation.
Resamples the stroke, which gives the stroke the ammount of vertices specified.
Displaces the stroke in the shape of a sine wave.
Removes t-vertices from the stroke.
Thickens TVertices (visual intersections between two edges).
Assigns a greyscale value that increases for every vertex. The brightness will increase along the stroke.
Removes the tips of the stroke.
Undocumented
Assigns thickness based on an object’s local Z depth (point closest to camera is 1, point furthest from camera is zero).
Class hierarchy: freestyle.types.StrokeShader > streamShader
[Output shader]
Builds a streamShader object.
Streams the Stroke into stdout.
Parameters: | stroke (freestyle.types.Stroke) – A Stroke object. |
---|