MATHS: ABS

MATHS: ABS (ABSOLUTE)

Absolute numbers are always positive or zero. Any negative number that you put into the Abs node will come back as the same positive number (-1 becomes 1 and so on). In most cases, the abs function will be used on the result of other calculations, as very few shader nodes actually produce negative results on their own (exceptions include the noise node, where the min setting can be a minus number.

The absolute function can be used to add more detail to a node. Figure One shows an example of this. Our Cellular node is producing a range of outputs from 1 (white) to 0 (black). Our subtract node doubles that (the Value_1 setting), to produce a range of 0 to 2, then subtracts 1 to produce -1 to 1, with the negative numbers in the middle of the large dark areas.

Finally, our Abs node turns all of those negative numbers back into positive ones, producing our final result.


Fig 1: Detail from the abs node.

Several nodes do produce negative results. The N and P nodes can both produce negative results. N (Normal, or direction) will produce negative results for anything facing left, backwards or down, and P (Position) does the same for items below ground level, behind the centre point and to the left of the scene (think of your translation dials).

Those nodes that do not normally produce negative results can be modified so that they do. Figure Two shows this in practise. Our Light Wood colour has been set to white. Our Add node is being used to provide the constant -1. Plugged into the Light Wood node, the white (+1) is multiplyed by the -1 to produce -1 (positive times negative = negative). Plugged into the Absolute node, we get our double banded wood. To get the colour back, plug the final output into a Color Ramp node.


Fig 2: Negative Output from colours

See also

N Node and P Node articles both refer to the abs function

PoserWorld