Bitmap Node 2 (R.9.5)
Xpresso – by: base80
September 7th, 2005
Here is my second experimentation with the bitmap node.
I’ll show how to extract colors from an image and relay it to a set of cubes.
Follow up:
I started by making a very small image of 10×10 pixels as to make the xpresso light and the example more comprehensible.
Here is the image;
What I want to do is make a set of spheres that represent each pixel in the image.
So I continued by creating 100 spheres placed in a 10×10 grid, a very nice occupation. They are actually cubes in a HN.
One part of the xpresso is the hierarchy-node that points to all the cubes. So I connect the null-object containing all the cubes (All Cubes) to the object (in)port of the hierarchy-node and connect the object-(out)port of the hierarchy-node to an object node. The Hierarchy is set to D-N.
We can now “talk” to all the cubes.
What I want now is to get the information of the image and give it to the cube’s display color.
I connect a Object-Index node to the object (out)port of the hierarchy node, this node will give me an index, that is the number of the cube that is talked to right a that moment.
As I have 100 cubes the index will output in a range from 0 to 99. We have to convert this to the 10×10 rows(X) and columns(Y) of the picture in the bitmap-node. Oh and by the way I have created a bitmap node and I have loaded my picture in it.
To convert the 0 to 99 range to a 10×10 range I had to think very hard, but I found a solution. (@maxon: an iteration port would be very nice on the bitmap-node)
The solution consists of Math-Dividing the 0-99 range by 10 and output an integer that we feed to the X (in)port of the bitmap-node. As for the Y (in)port we do a Math:Modulo set to 10, You will understand this after a good night of sleep.
Now our calculation passes the color data of each single pixel to the individual cubes.
The result is exactly what I expected and looks like this.