Alt-Mix – Shader Nodes

Example of Alt-Mix use

The alt-mix node group will mix two colours at a given altitude,
with optional variation and blending. It is particularly useful for texturing landscapes but can
also be used anywhere a horizontal boundary is required between two colours. At it’s simplest,
the node group will colour everything above the “boundary” value with “Color1” and everything
below it with “Color2”, however the other inputs may be used to vary the effect.

Inputs

Screenshot of alt-mix node group

The inputs are (from top to bottom)

  • Vector – location in 3D space. For landscapes this would normally come from the “Global”
    output of the Geometry input node, although any vector can be used.
  • Blend region size (value) – The vertical size (in Blender units) of the region in which
    “Color1” and “Color2” are smoothly blended. A value of zero produces a sharp dividing
    line.
  • Badly painted post
  • Noise region size (value) – The vertical size (in Blender units) of the region in which the
    boundary can vary. A value of zero produces a perfectly horizontal boundary. For best landscape
    results, the noise size should be similar to the blend region size, however, a non-zero noise
    with a zero blend region produces a nice effect like unevenly applied paint.
  • Noise (value) – A noise source. For landscapes, try using a clouds texture with a Perlin
    noise basis and adjust the noise size to suit your needs. A large noise region may need a
    larger noise size. The noise is used to peturb the boundary layer both up and down so for best
    results use a balanced source of noise (i.e. roughly amounts of black and white).
  • Boundary (value) – An altitude (Z coordinate, in Blender units) at which the transition
    between the two colours takes place.
  • Color1, Color2 (colors) – the two colours to be mixed. These can be plain colours, or for
    best results can be materials or textures.

Alt-Mix node groups can be combined as long as each has a different boundary level and the
input colors are connected correctly. As can be seen from the islands example, an Alt-Mix node
with a boundary of 10 units is connected to the lower color input of an Alt-Mix node
with a higher boundary (35 units).

Note that the “Shaded” mode of a 3D viewport does not correctly show shading when global
coordinates are used as the input vector, but a test render will show shading correctly. Note
also that the objects in the output preview windows are about 4 Blender units high, so any
boundary above this level will not be shown in the preview, but will be visible in the render. If
in doubt – do a test render!

If you are interested in how the node group works, I’ve written a short guide here.

Trellis – Plug-in

2D Patterns

Example of Trellis Textures

In order to understand Blender materials more fully I wrote a simple texture plug-in, called
trellis. (Click link for zipped ‘C’ source code). Trellis is an
intensity only texture that produces a variety of 2D tiling patterns such as squares, octogons,
diamonds and curving tile shapes. The blender file which produced the example to the right can be
downloaded here.

3D Cube Pattern

Example of 3D cude

It also has an option to produce a true 3D “cube” texture. This produces a lattice-like cube
with an adjustable “border” along the edges of the cube, and optionally, it can set the inside of
each cube to a random intensity. This is similar to the “cells” texture of Povray.

The blender file which produced the example to the right can be downloaded here.

User Interface

User Interface Screenshot

The top two lines of the user interface are “load plugin” and the filename. Below that is
obviously the choice between the 2D Patterns and the 3D cube texture. The plug-in can make many
different 2D patterns, but unfortunately a “drop-down combo box” control doesn’t seem to be
available in the Blender UI, so I’ve had to use numbers instead. The patterns available are as
follows:

  1. Squares
  2. Rhombuses (Rhombi?)
  3. Circles in a Square Arrangement
  4. Double Teardrops
  5. Hearts
  6. Octogons
  7. Double Headed Axes
  8. Plus (+) Shapes
  9. ‘T’ Shapes

The “Thickness” parameter is how thick the “lines” are that define the shapes. Note that very
thick lines can cause odd effects, or cause the shapes to disappear entirely. The final option is
used only for the 3D texture, if selected, a random colour is returned inside each “cell”,
otherwise a grayscale value is returned.