TG Slope

PARAMETERS

A Note About The Parameters :

The more flexible versions of TG Slope extend upon the parameters from the simpler versions. This parameters listing starts with TG Slope Basic, then TG Slope Advanced, and finally TG Slope Bands - however, each shader only lists the parameters which are new to it, rather than repeat any parameters that have already been described for one of the simpler versions.

Listing :

TG Slope Basic :
  Bias
  Overall Noise Freq
  Noise Type
  Shallow Colour
  Steep Colour
  Min, Max, Octaves
  Noise Frequency

TG Slope Advanced :
  Slope Point Distance
  Local Slope Point
  Slope Point Position

TG Slope Bands :
  Colour1, 2 and 3 : Shallow and Steep Angle
  Colour1, 2 and 3 : Fade
  Type, Local, Blank

TG Slope Basic

TG Slope Basic is the first of the Slope shaders. Since it has less parameters, it is easier to use, and faster to render, but also offers less control over the results than the other 2 Slope shaders. It always compares the surface point with the vertical, so it always colours an object based on the surfaces which are facing upwards (in the Z direction) in the 3D world.

Bias

Range : 0 to 1

A simple way of changing the range of the two colours. Closer to 0 will mean more of the Steep Colour, while closer to 1 will mean more of the Shallow Colour. A value of 0.5 will mean even amounts of each.

Varying the Bias

Bias of 0.001, 0.5 and 0.75.

Overall Noise Freq

Range : 0 to 100

Sets the overall frequency for the noise, scaling it in all directions equally. Higher values will mean squash the noise pattern, while lower values will stretch the noise pattern.

Noise Type

Range : 0, 1 or 2

Sets the type of noise to be used - 0 is Perlin, 1 is Classic, and 2 is Sparse.

Shallow Colour and Steep Colour

Range : RGB values

These set the colours for the surface. The Shallow Colour sets the colour for the areas which are flat (that is, which face directly upwards). The Steep Colour sets the colour for the areas which are facing downwards. The colour blends between the two through the various angles (so at right angles, the colour is halfway between Shallow Colour and Steep Colour). The balance between the two colours can be affected using the Bias parameter.

Min, Max, Octaves

Range : RGB values (-10 to 10)

This sets the parameters for the noise, which affects the boundaries between the colours.

The first part sets the Minimum shift, which causes the noise to shift the Shallow Colour toward the Steep Colour. Lowering this value below zero will make the Shallow Colour shift toward the Steep Colour, increasing the amount of Steep Colour in the result.

The second part sets the Maximum shift, which causes the noise to shift the Steep Colour toward the Shallow Colour. Raising this value above zero will make the Steep Colour shift toward the Shallow colour, increasing the amount of Shallow Colour in the result.

When both Minimum and Maximum shift are set to 0, the noise has no effect on the result, and the noise processing is turned off to optimize the speed of the shader.

Varying the Min and Max Shift

Max, Min values of (-0.75, 0.75);  (-0.2, 0.2);  (-1, 0)

Use the Minimum and Maximum shift to control the noise effect at the boundaries between the colours.   If you keep them equivalent (so that the Minimum shift is equal to the negative of the Maximum shift), this keeps the boundary at the same location, but increases the strength of the noise (see image to the left).

The third part controls the Octaves of the noise. Higher values result in more detail in the noise pattern (but will result in the shader rendering more slowly). There is little visible effect in increasing the Octaves above a value of 4 or so. Note that Octaves only responds to whole numbers - for example, a value of 2.5 will give the same result as a value of 2.

Noise Frequency

Range : RGB values (-10 to 10)

Sets the frequency for the noise in the x, y and z directions independently. Use this to stretch or squash the noise in certain directions.

Some examples can be seen in the image to the right.

Varying the Noise Frequency in different directions

Noise Frequencies of  (5, 1, 1);  (1, 5, 1);  (1, 1, 5)

TG Slope Advanced

TG Slope Advanced is the second of the Slope shaders. It offers more control than the Basic version, as now the surface of the object can be compared to different angles, which means that the colouring from the shader need not be relative to the vertical.

The parameters listed below are those unique to TG Slope Advanced - the descriptions for the TG Slope Basic parameters still apply to this shader, so are not re-listed here.

Slope Point Distance

Range : 0 to 100

For more unusual effects, this shader lets you compare the object’s surface with a Local point. If using a Local Slope Point, the Slope Point Distance parameter lets you scale the distance of the point without having to alter the individual settings in the Slope Point Position parameter. See later examples of use of a Local Slope Point.

Local Slope Point

Range : On or Off

If this is unchecked, the TG Slope Advanced will calculate the colours in the same way as TG Slope Basic,  using an Infinite Slope Point. If checked, then TG Slope Advanced will use a Local Slope Point, and the object’s surface will be compared using its angle relative to a particular point in 3D space.

Both of the images below use a Slope Point Position of (1.5, 0, 1.5)

Local Slope Point

Using Local Slope Point

Infinite Slope Point

Using Infinite Slope Point

Note that the colouring provided by the shader works in much the same way as the illumination provided by a light source, so it may be helpful to keep that in mind. The difference between a Local Slope Point and an Infinite Slope Point is the same as the difference between a Local and Infinite light (this is also the same processing used in TG Virtual Light).

Slope Point Position

Range : RGB values (-10 to 10)

For an Infinite Slope Point, this sets the vector (direction) that the surface normal is compared with. For a Local Slope Point, this sets the position in 3D space that the surface normal is compared with.

Being able to alter the direction that the shader works from allows you to slant or angle the effects of the shader. For example, this would let you use the shader to place green “moss” on only one side of a tree, or to place white “snow” on a landscape as if blown from a particular angle rather than from “straight down”.

TG Slope Bands

This is the most flexible, but most complex, of the Slope shaders. It allows you to set 3 different colours, specifying the fade in and fade out points of each. Since these colours can overlap, it is possible to create more than just 3 colours in the result.

This can help add more detail to the result, but it does make the shader a little harder to use!

The core of the processing remains the same as in TG Slope Basic and TG Slope Advanced, so only the parameters unique to TG Slope Bands are listed here.

Colour1, 2 and 3 - Steep Angle, Shallow Angle and Fade

Range : -10 to 10 (for Steep and Shallow Angles);  0 to 1 (for Fade)

The Steep and Shallow angles for all 3 colours work in the same way as before, only now they define the point at which the colour fades to zero (black). The Fade value sets the range over which the colour fades to black.

Shallow 1, Steep 0.6, Fade 0.2

Shallow Angle 1, Steep Angle 0.6, Fade 0.2

For example, if you have a Shallow Angle of 1 and a Fade of 0.2, then the colour will begin to fade toward black from an angle of 0.8, and will reach black at an angle of 1. This will mean that the colour fades to black BEFORE the surface is facing the Slope Point Position.

This is shown in the image to the left, where Colour2 and 3 and have been set to black. The Steep Angle was set to 0.6, which means that Colour1 reaches black at 0.6, having started to fade at 0.8.

To ensure that the colour doesn’t fade out before it faces the Slope Point Position, you need to add the Fade value onto the Shallow Angle.

The picture to the right shows the same texture, but using a Shallow Angle of 1.2. This means that the colour reaches black at an angle of 1.2, which is never reached. It begins to fade at a value of 1, which means that the fade is never actually seen.

Shallow 1.2, Steep 0.6, Fade 0.2

Shallow Angle 1.2, Steep Angle 0.6, Fade 0.2

Smooth fade between colour bands, by matching the fades

Getting a smooth fade between Colour 1 and Colour 2.

To get colours to overlap exactly, you need to ensure that they have the same Fade values. If Colour1 has a Shallow Angle of 0.6, and a Fade of 0.2, then it reaches black at 0.6 and begins to fade at 0.8.

To get a smooth overlap, Colour2 needs to reach black at a Steep Angle 0.8 (when Colour1 reaches full intensity), and begin to fade at 0.6 - this means it needs a Fade value of 0.2 as well.

So for smooth fades, the Shallow Angle of the “lower” colour needs to be the same as the Steep Angle of the “higher” colour + the Fade value.

You can overlap the fades, though, to get more colours in the result.

The image on the right shows the same settings as before, except Colour 1 Steep Angle has been lowered to 0.55 rather than 0.6, and Colour 2 Shallow Angle has been raised to 0.85 rather than 0.8.

This means that one colour doesn’t fade out as the other fades in, but instead the colours overlap to a degree, producing a new colour (note that the image still has Colour 3 set to black, even though 3 colours are shown).

Extra colours as a result of overlapping the fades

Overlapping the fades to get new colours..

Dark band as a result of moving the fades apart

Getting one colour to fade out before the other fades in.

Alternatively, you can make the colours fade out a little early, so that a dark band appears at the boundary between the colours.

The image on the left returns to the smooth blend, and then changes the Colour 1 Steep Angle from 0.6 to 0.63. This means that the green colour fades to black more quickly that the red colour fades in, resulting in a darker band between the colours.

 

Setting the blends between the colours can be a bit tricky, but it does give a lot of flexibility and adds a way of adding more detail to the result.

Type, Local, Blank

Range : RGB values (but see the meaning of the values below)

This actually sets the Noise Type (0 Perlin, 1 Classic, 2 Sparse), and Local Slope Point (0 is Infinite Slope Point, any other value is Local Slope Point). The third parameter has no effect.

These parameters are the same as in the other 2 versions of the Slope shaders, but have been moved into a “colour” parameter owing to a lack of space in the interface!

Note that only the whole number makes any difference to Type - a Type of 0.45 is the same as a Type of 0, and a Type of 1.6 is the same as a Type of 1.

For Local Slope Point, 0 sets the shader to use an Infinite Slope Point, and any non-zero value sets the shader to use a Local Slope Point.

TG Slope Intro

TG Slope Parameters

TG Slope Tips

TG Slope FAQ

TG Slope Samples

TG Pack Index