I'm still learning blender, and I had some idea to implement, but I'm unsure whether this is possible at all: Visualizing 3D colorspaces. I did some Internet searches for examples, but could not find one, so here it goes:

Assuming I want to model the standard RGB cube, I could use a plain cube and generate the surface texture with some external program, and then apply the texture. That would look OK from the outside, but actually I want to "slice" the color-space to find colored voxels inside. Obviously the cube created that way will be "empty" inside.

So the questions are:

  1. Is it possible to generate colored voxels in Blender as some gradient, interpolating colors (similar to PostScript's L3 Shading)?

  2. If it's not possible to create in Blender, what is a preferable simple import format to create the colored voxels in Blender?

  3. How can a "slice through" the color-space with an animation?

  4. Did someone create typical color-spaces models in Blender already? If you have no idea what I mean, you might look at Example of a cut through a color-space

While waiting for an answer I created a template surface texture for an RGB-Cube for illustration. Feel free to print, cut an glue ;-)


I want a "solid" cube with colored voxels inside, however, however.


1 Answer 1


You don't need volumetric shading to do this - you just need to return where surfaces intersect a 3D texture space.

To make a solid color cube:

enter image description here

  • The Geometry node returns the 3D coordinates of the point being shaded in World space, measured in Blender units from World 0,0,0. As a first shot, all we have to do is plug the X, Y and Z values straight into the R,G and B values of the color of a diffuse shader. (The elements cast automatically from position XYZ to color RGB in the range 0 - 1, and clamp outside the range.)
  • But it would be nice to have our X, Y and Z measured from the origin of the cube, not the world, whatever translation, scale or rotation the cube is subjected to. The Vector Transform derives the (cube) object space coordinate from the world space coordinate, so you can move the cube around, and the color sticks to it. (The cube was made 1x1x1, with its origin at its minimum XYZ, when untransformed.)
  • The Math > Power nodes roughly map the linear coordinates to sRGB to display OK with my color management settings. 0 and 1 remain where they were, the curve between them is altered.. (gamma correction).
  • Cycles bounces light around the scene from one surface to another. Scattering of color between faces wasn't helpful, so the Light Path and Mix nodes make the material black, as far as the diffuse bounces are concerned (but not to the camera).

This shows the color cube with a Boolean modifier .. another (unrendered) cutting cube is taking a chunk out of it. You may see artifacts from the Boolean in the preview, but they don't appear in the final render.

enter image description here

A 'Voxel' representation ..

enter image description here

  • An applied array , 10x10x10, of small cubes in a 1x1x1 volume, whose origin is at minimum X,Y,Z.
  • Most of the details as above, but this time, to get per-voxel-cube shading, using an Object Info node, which can return the world coordinates, not of the shading point, but of the origin of the currently shaded object. When that is plugged into RGB, each voxel-cube is colored with the XYZ of its origin.
  • I can't think of a brief, general, way to measure those locations in another object's space. So as it stands, this one is sensitive to being moved about. You could obviously tweak by hand to deal with changing scale, other transformations, but.., I'll be posting this as a question myself. Suggestions welcome in the comments.

enter image description here

  • $\begingroup$ Thanks you for all this very useful information. Is it possible to download your Blender file you used to makes these images? As a beginner it would most likely save me a lot of time and prevent mistakes trying to "Put this in". $\endgroup$
    – U. Windl
    Commented Mar 10, 2019 at 15:07
  • $\begingroup$ @U.Windl See edit ..Hope this is OK .. Solid version on layer 1, Voxel version on layer 6 .. Different cameras.. Ctrl-Numpad-0 on selected camera to make active. $\endgroup$
    – Robin Betts
    Commented Mar 10, 2019 at 15:58
  • 1
    $\begingroup$ Trying to rebuild the nodes I had a problem locating the "Power" node: I found out that a "Math" node changes its name when you change the function ;-) Finally, I got a cube that looks yellow on the bottom and white on the top... So I tried your .blend file, seeing the "back surface" shows a wave-like circular artefact for the facing surface in the back in "render" view, but not in "material" view ("displaying" the transparent "CutterCube" causes this artefact). Also I could not find out where the color of the cube corner points is defined. Sorry, I have to learn a lot in Blender, still. $\endgroup$
    – U. Windl
    Commented Mar 11, 2019 at 20:37
  • $\begingroup$ The color of the corners is not defined explicitly .. this just takes the coordinates of objects/shading points in a 3D texture space and maps/translates them into colors.. If you get stuck, ask anything you like in the comments .. if the commentary gets too long, we can move it to chat. $\endgroup$
    – Robin Betts
    Commented Mar 11, 2019 at 21:14
  • $\begingroup$ Maybe add the explanation of mapping 3D points to color to your answer (for me and others). When I move or scale the cube, the colors still "stick to the corner points". I still fail to understand where the colors come from. $\endgroup$
    – U. Windl
    Commented Mar 11, 2019 at 21:50

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .