RDG Color Cube - an Houdini Digital Asset
Abstract
This digital Asset (HDA) generates a wide variety of colour cubes.
What is a Color Cube?
A colour cube is a three-dimensional representation of colour.
Each one of the three primary colours of the additve colour system – Red (r), Green (g) and Blue (b) – is assigned to one of the three axis that define space in a cartesian coordinate system.
The generic colour cube as entity definies a "unit cube" with rgb [0, 0, 0] at its origin
and rgb [1, 1, 1] at xyz [1, 1, 1]. Therefore it is black at the origin and white at the opposite corner. The value 0 denotes "no colour", while a value of "1" is "full colour" or 100%.
By manupilating the way the colours are mapped to the cube, such as stretching and shifting, we can represent a variety of colour palettes and systems. By manipulating the cube itself, like slicing and cutting or deleting particular parts, we can focus our attention at certain parts of colour.
This HDA enables us to generate a multiplicity of these cubes, be it to investigate colour itself or to visualise ramps and attributes to be used in other parts of Houdini – such as birthing and growing attributes for particles.
Download and Installation
You can download the HDA and a sample scene here:
- RDG Color Cube (current version 2007-03-23)
- RDG Color Cube – sample scene
After the downloading unzip the file to a directory and install it in Houdini as Operator Type Library.

Choose File -> Install Operator Type Library... and point to the directory where the rdg_colourcube_[version].otl resides. Use the Install Library To option to choose where you want the type library to be available.
How to use the RDG Color Cube
After installing you can start using the colour cube. If there is no Geometry object, create one and enter it by pressing [ENTER] or [i]. Use the TAB Menu start typing [r][d] ... and choose the "RDG Color Cube".

In the Viewer Panel now should appear a generic colour Cube:

Parameter and Options
The RDG Color Cube offers 4 parameter folders to adjust almost every aspect of its appearance.
[1] The Generic Folder
The Generic Folder controlls the overall look.
The sliders Width (R), Height (G) and Length (B) scale the unit cube, while the related Segments sliders divide the axis into segments. A segment is called "swatch" as it reprensents a descrete colour.
The slider Swatch Scales scales the swatches.
It is not possible top create overlapping swatches in the generic cube.
*** Note: If you use the External Distibution Object Option (see below) some of the parameters have no effect and should be disabled. This will be fixed in the next release.

The cube to the left is a unit cube with three segments.
It shows all possible blends between the three primary colours for 0%, 50% and 100%.
The center cube is a Alfred Hicketier Colour Cube (1952) [1]. It's got 10 segments and enables us to compare 1000 colours. The Hicketier Color Cube was origanaly used to compare and identify subtracting colours for print processing.
The third cube is a streched cube with a non-uniform segment number and scaled swatches.
We could also create a cube with 256 segements for each colour. This cube will contain all 16,777,216 colour swatches that todays truecolour grafic adapters can display (One byte (eight bits) per channel gives 256 (28) [2]
[2] The colour Tab
The colour tab is used to manipulate the colour space.
The first option "Interpolation" defines the way the colours are mapped to the coordinate system.
From left to right: linear, quadric, easeIn and easeOut.
In the generic unit cube each colour is mapped 1:1 to a descrete point in space. Changing the interpolation type we can accentuate defined regions in space. Currently the interpolation is applied to all the axis. It is not possible to define a per axis interpolation.

This are the 4 standard curves. The position of the swatch in space is marked at the X axis of the curve.
The Y axis tells us what colour then will be displayed. Left most is the linear 1:1 mapping.
For more control we can choose a fifth option: custom interpolation. Shift+MMB on 'Custom' opens a floating channel editor where we can define you own interpolation curve. The curve's range is frames 1 to 25.
This enables us to generate non generic colour cubes:

To offer even more controll there are several additional sliders for each colour:
Scale, Offset, Normalise and Invert. The following images demonstrate their effect:
Scale

The Scale parameter was changed [R, G, B]:
[0,0,0] – [0.5, 0, 0] – [0, 1, 0] – [0, 0, 2]
The Color of the swatch is multiplied by this value. Multiplied by 0 results in 0: The colour is gone.
This way we can also overexpose colours. While our monitors cannot display these colours and clamp them to 1, HDR (High Dynamic Range) Images can store this information. Nodes in other parts of Houdini can parse these values, too.
Offset

The Offset parameter was changed [R, G, B]:
[0,0,0] – [0.5, 0, 0] – [1, 0, 0] – [0.5, 0.5, 0.5]
This parameter shifts the colour range on the axis. The red colour part is shifted from 0 to 1. The result is black traveling from one side to the other.
The cube on the left was manupulated in a way so all eight corners now have the value [1, 1, 1] = white and its center is [0, 0, 0] = black.
Normalise

The cubes colours were offset by [0.5, 0.5, 0.5] first.
Then the Normalise parameter was changed [R, G, B]:
[0,0,0] – [0.5, 0, 0] – [0, 0.5, 0.5] – [1, 1, 1]
This slider blends between the original and the normalised values of each colour.
Normalising is the process to fit the values of a function into a "normalised" range. The normalised range for colour are the values 0 to 1. By shifting the colour range it can happen that the range doesn't fill all its potential values. In the left most example the shifting resulted in a colour space with values between 0 and 0.5, the process of normalising "streches" the range to use 0 to 1. This can be compared to the Level function in imaging applications.
*** Note: if the interpolation type is set to custom, it is recommended to start with a Normalise value of 0 to see the real effect of the curve.
Invert

The Invert parameter was changed [R, G, B]:
[false, false, false] – [true, false, false] – [true, true, false] – [true, true, true]
The Invert parameter flips the colour ramp with this formula: v' = 1 - v.
On a generic colour cube this has the same effect as rotating the cube. However on modified cubes this can cause interesting effects.
Fade to Gray
The last option in this folder offers grayscale conversion.
The slider Fade to Gray blends between the colourised cube and a grayscale version. The drop down menu can be used to change the conversion algorithm. In a grayscale colour space each swatch has the same R, G and B values. The algorithm defines in which manner the colour swatches [R, G, B] are converted to grayscale [R = G = B]

The Fade to Gray parameter was chaged: 0, 0.33, 0.66, 1
The effect is similiar to the desaturation function in imaging applications.
Left to right different conversion algorithms are used:
Average: V = (R + G + B) / 3
Default: V = 0.15 * R + 0.55 *G + 0.3 * G
Default (Brighter): min(1,
0.35 * R + 0.75 *G + 0.5 * G)
Intensity only: max(R, G, B) – the cube is also inverted in all channels.
*** Note: The common NTSC to gray algotithm (0.33 * R + 0.5 G + 0.17 * B) is currently not supported, because I simply forgot it. Future version of the RDG Color Cube could offer an option to enter your own conversion algorithm.
[3] The External Objects Folder
The External Objects Folder allows us to override the default appearance of the colour cube by replacing swatches and/or the cube with custom geometry
The RDG Color Cube HDA offers two inputs:
The left input takes the custom swatch geometry, the right one is used to replace the cube with our own "colour space". Even if there are nodes connected to the inputs, we still have to enable this feature in the External Objects Folder.
The Custom Swatches can be adjusted in size with the Swatch Scale slider.
If your distribution object has defined point groups you want to use you can set them in the template group. If there are no groups, a default group containing all points will be created automatically.
*** TIP: If the new cube doesn't look like expected: double checking the Template Group in the External Object Folder often fixes this. It is set to swatches by default, but can be set to any point group name that is defined in the distribution geometry.

In this example the swatches of a colour cube are replaced with platonic solids.
Here the cube is replaced by Custom Distribution Geometry:
A grid with random selected points, a dodecahedron and a resampled line (in this case also the swatches are replaced by soccerballs). Flat objects like the plane can be recoloured using the colour offset sliders, this is like shifting the geometry through colour space.
*** Note: The External Object Option can generate huge amounts of data! It is recommended to turn the settings down before enabling this option, or your system may slow down or even crash Houdini when running out of memory.
*** Note: Copy stamping parameters is currently not supported.
This option also clearly shows the limits of this system:
As it is a Colour Cube you cannot display colour systems that depend on more than three axis. To morph the cube into a sphere you will need to post process the resulting cube in other nodes.
In the sample file you also find a setup where you can cut and slice through the cube using a slice plane object:
[4] Delete by colour
This folder allows us to remove swatches in the cube based on their colour.
There are two ways to use this features: Expression or Expresion Set.
Expression Set
The Expression Set Option is somewhat more userfriendly therfore it is explained first:
The dropdown menues and sliders are used to describe an expression to select swatches. These swatches are grouped and deleted.
Here all swatches where R = 1 and G = 1 and B = 1 are deleted, this is just the white swatch.
Now the Combine Option is set to OR, the expression now says:
Delete every swatch where R = 1 or G = 1 or B = 1, this are the complete first rows/columns of the cube.
This expression is set to delete every swatch where R != 0.5 and G != 0.5 and B != 0.5. Now everything exept the center rips are deleted. ("!=" is the operator for "not equal").
Expression
To define more complex expression we set the Delete by Color option to Expression.
The function string entered in the field Expression is used to group the points. We can use the local variables $CR, $CG and $CB to refer to the three colours, the comparison operators (==, !=, <, <=, >, >=) to compare them to various values and the logical (&&, ||, and !) and bitwise (& |, ^, and ~) operators to combine multiple expressions:

($CR < .2 || $CR > .8) && ($CG < .3 || $CG > .7) || $CB == .5

($CG > .6 || $CG < .4) && ($CB != 1 || $CR != 1) && ($CB != 0 || $CR != 0)

($CG == $CR <= .25) && ($CG == $CB <= .25)
Depending on the setting in the Generic Folder the precision may vary. Often the green channel seems to stop responding to expressions like $CG == .5 though swatches with this value exist. In this case we need to define expressions that cover ranges like ($CG >.45 && $CG < .55).
*** TIP: The floating spreadsheet is accessible with RMB -> Spreadsheet ... on the RDG Color Cube Node. It displays all colour values of the current cube and is very handy when it comes to defining expressions.
*** NOTE: Due to the current expression parser evals(chsraw("../delexpr")) it seems not possible to use spare parameters to animate the values in the expression. Maybe this is possible in future versions of the HDA.
Conclusion
The RDG Color Cube HDA enables us to investigate the additve colour space in every dimension.
It can be gray and dull under its colourful cover or hide a gay interiour under a worn coat. It can cause you to turn away in horror facing its lurid colours or capture you with its rangy gradients.
Howsoever your colour cube is painted, always remember: hell is pastell-coloured.
Reseach and Teachings can use this tool to demonstrate the various coherences of colours, FX Artists can generate trendy eyecandy and I learned a lot about the internal dataflow in Houdini.
Feel encouraged to unlock the HDA by RMB -> Allow Editing of Contents just to take a look at its guts or just to implement a missing feature. If you do so please drop me a line.
23.03.2007 Georg Dümlein
References
[1] http://www.3d-meier.de/Plugins/Hickethier/Hickethier.html
[2] http://en.wikipedia.org/wiki/Truecolour