Bitmap Node 2 (R.9.5)

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.

colorblocks

Follow up:

I started by making a very small image of 10x10 pixels as to make the xpresso light and the example more comprehensible.
Here is the image;

colorblocks

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 10x10 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.

colorblocks tut

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 10x10 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 10x10 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.
colorblocks


3 comments

Comment from: joelafrite [Visitor] : 2005-09-09 @ 21:26
Hi Base. Nice Job. But you make a mistake. I never seen any cube in this picture. Some spheres perhaps.
Lol
Comment from: Jeff Andrews [Visitor] : 2005-09-13 @ 22:10
No mistake. If you read all the way through you'll see that he says they are indeed cubes, albeit cubes placed inside hyperNURBS which gives them the curvature so they appear to be spherical.

Great stuff, base80, as usual. I really enjoy your various XPresso pursuits and other feature exercises.

Regards,

Jeff Andrews
Chrome City Studios
Comment from: Greg Dunn [Visitor] · http://www.thedanse.com/ : 2005-09-28 @ 19:07
While I don't necessarily recommend it, the idea/application does scale quite well.

Sample 1
Sample 2

Those are 64x64... once the instances are made (all 4,096 of them, which is where the "not really a good idea" part comes into play) the xpresso itself is pretty fast in translating them to the proper colors. I used flat planes in these cases as the cubes were getting unwieldy...

I modified an existing script ("random duplicate around") to create the array of 64x64 planes in the proper order for the bitmap tag. If there's interest (and the original author doesn't mind my modifications), I can post the script here or on my site.

Leave a comment


Your email address will not be revealed on this site.

Your URL will be displayed.
PoorExcellent
(Line breaks become <br />)
(Name, email & website)
(Allow users to contact you through a message form (your email will not be revealed.)
This is a captcha-picture. It is used to prevent mass-access by robots.
Please enter the characters from the image above. (case insensitive)