db&w documentation wiki

finest software | finest docs

Site Tools



This node takes an input integer number to output a number within the range of 0 to 1.0 (0 is not included). This can be used to create a gradient input from a polygon number, or to create a RGB colour instead (for item or surface ID outputs using shaderMeister).

Here is a short explanation of the inner workings:

It starts off with 0.5 as the initial number

It takes the index number, looks at the lowest bit. If the bit is odd it adds 0.25 to the number If the bit is even then it subtracts 0.25 The index is shifted by one bit, and the value to be added/subtracted is halved.

This loops until the index is 0

The only exception is the Input 0, this is when it returns 1.0. 0 is never returned.

A sequence would thus be: 1.0, 0.5, 0.75, 0.25, 0.125, 0.675, 0.375 and so on… (more or less 1) ). The more IDs there are, the smaller the difference between the output values. But they never overlap/repeat (within the limits of floating point numbers).

For the RGB output the ID is divided by three first and the remainder determines which of the three channels it's writing into.The RGB colours will thus be either Red, Green or Blue, but never a mix of them.

Basically it's a variant of the Hammersley Sequence that is used in quasi-monte carlo sampling.

within the confines of floating point accuracy
tools/sequencer.txt · Last modified: 2013/10/18 15:32 by lightwolf