From BlenderWiki

Jump to: navigation, search
Note: This is an archived version of the Blender Developer Wiki. The current and active wiki is available on wiki.blender.org.
Now in trunk
This feature is now in trunk, please refer to the release notes for up-to-date documentation


Texture Marks for freestyle strokes

The standalone freestyle render could draw textures on rendered strokes. This project is about adding texture support for freestyle in blender. The design consists of two steps:

  • Adding a BlenderTextureShader to the freestyle module taking a blender mtex as argument
  • Adding a texture_slot type to linestyles to allow UI
  • Also adding a StrokeTextureStep(float) shader to affect the spacing of texture coordinates along the stroke.

The goal is being able to use more textures stacked one on the other, like blender classic shading system, and being able to map them with different coordinates (Generated, View, Along Stroke), map to color or alpha (or both), and use different blending options. Each texture mapped along stroke can be either a freestyle brush texture, like corpus, tip, tail, or just plain left to right texture.

  • Manifest Task: [1]
  • Diff patch for review: [2]
  • Discussion Thread: [3]


UI Usage (Parameter Editor)

Panel for Linestyle Textures

When a Line Style is used, textures can be enabled from a new Textures panel. The Spacing Along Stroke parameter allows to set the "pace" of textures along the lenght of strokes. Settings specific to textures can be found in a new texture context specific to line styles. The "Go to LineStyle Textures" button is a shortcut to these settings.

LineStyle Texture Context

Linestyle Texture Options

Textures for each LineStyle strokes can be assigned the usual way inside the LineStyle texture context.

Coordinates types available for linestyle textures are Generated, Global, Window, and Along Stroke. The first three are common to other texture contexts, Along Stroke Mapping is the dedicated one for stroke marks.

Lastly, the Influence section sets how the texture will affect Color and Alpha of the resulting stroke.

Mapping Along Strokes

Along Stroke Mapping

Along Strokes Means that the texture will be drawn along the stroke length, making it possible to mimick pencil or brush marks.

Options for Along Strokes Mapping

Options forAlong Stroke Mapping

When the Along Stroke mapping is used, an option for Use tips will appear, it sets wether the texture lower quarters are used for start and end of the stroke.

Along Stroke mapping depends by the LineStyle spacing parameter that can be found in the linestyle settings. It sets how much the texture will be stretched along the stroke length. Higher spacing means less tiling.

Texture Tips Scheme
    __________
   |          |
   |    A     |
   |__________|
   |     |    |
   |  B  | C  |
   |_____|____|

A : The stroke's corpus texture
B : The stroke's left extremity texture
C : The stroke's right extremity texture
Linestyle charcoal.png
Texture without tips
Linestyle brush.png
Texture with tips


Texture Influence

Influence parameters for linestyle textures

The Influence section allows to set how the texture will affect the final result. Like in the Material texture options,there are both toggles and factor sliders, but only for Color and Alpha. The Blend Type option sets the Blending Mode for the linestyle texture.

Other blending controls behave like Material options as well:

Negative
The effect of the Texture is negated. Normally white means on, black means off, Negative reverses that.
Stencil
The active texture is used as a mask for all following textures. This is useful for semitransparent textures and "Dirt Maps". Black sets the pixel to "untexturable". The Stencil mode works similar to a layer mask in a 2D program. The effect of a stencil texture can not be overridden, only extended. You need an intensity map as input.
RGB to intensity
With this option enabled, an RGB texture (affects color) is used as an intensity texture (affects a value).


Node Textures

Node textures over Freestyle strokes

Line styles support Node Textures as well. Setting texture type to LineStyle in the Node Editor when in Texture mode, it's possible to use nodes for the active texture of the active linestyle.