driving a ledcube with jitter
Hi guys i’m in desperate searching of help…
I need to control a ledcube made of 512 monocolor leds (8*8*8), driven via max and arduino.
To draw things in/on the cube i need to send a list of 512 values each one representing the alpha value of one specific led.
Now…the idea is to use this cube like a really low resolution 3D screen, drawing a gl scene with Jitter, and here i’m stuck…since i don’t know a way to extract the alpha value of each "3D pixel" of the scene.
For "3D pixel" i’m intending each pixel of the first 2D plane, then each pixel of the 2D plane behind the first..and so on…
Is this a good way to approach the problem? any other ideas? wanna help?
Thanks a billion!!!!
I’m not sure if I understand your metaphors correctly but if I do…
The number of pixels on such a cube would be 384 (8x8x6), not 512 (8x8x8).
You say "drawing a gl scene with Jitter"; I assume you just meant that metaphorically, so that the physical cube would resemble a GL scene with, for example, 384 spherical objects located in the way you described. If that’s the case–if GL space is just a metaphor for you–then you don’t really need the GL aspect of Jitter.
You say "extract the alpha value of each ‘3D pixel'"; but it’s just a brightness value you need, right? There’s nothing about such a value that inherently has to be related to the "alpha" channel as that term is used in Jitter (video, GL, etc.). They’re just numbers.
You could store and manipulate the brightness values in a 3D 8x8x6 Jitter matrix, or in a 2D 8×8 matrix with 6 planes, and then send those values to your Arduino.
I hope I understood your idea correctly, and that those comments are somehow helpful.
Thanks for your answer Christopher!
actually i need to draw a scene not only on the surfaces of the cube, but inside too! :)
something like in this video found on YT:
I know that openGL is not strictly necessary to drive the leds, but i thought that using that the process of making animations would become more manageable….
i’m quite a newbie to jitter so i don’t know how to draw 3d shapes for example in a 2planes&3dimensions matrix without using open gl (well actually even with it :) ).
Tell me if what i ask is still obscure:) i’m not so good @explaining!
From what you are saying it sounds like you want to visualize 3D light animations. An easy way to do this would be to use jit.gl.multiple. Check it out:
-- Pasted Max Patch, click to expand. --Copy all of the following text. Then, in Max, select New From Clipboard.----------begin_max5_patcher---------- 922.3oc0Xt0aaBCEG+4jOEVn8XVD1bM6o739NTUU4DbItxXSAm0rU0u6yWf1 ztl.0kPYJQ.9Bve+iy43i8iym4sQbfT6A9A3JvrYONe1LSU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.Np7qWNiev.Ds.DZi5iBetzHH1zQEeg8PQiaX i3dnnvQOuBTWyAM5Jx+BpHUgml+WS4bVB. -----------end_max5_patcher-----------
Thanks a lot Andrew, this is a great visualization tool…but atm i need something different:
imagine that you have a 3d scene drawn with jit.gl.render…
i need to replicate that scene in physical cube made by 512 leds (like the one shown in YouTube video above).
To drive those leds i need to send out from max a list of 512 values…representing the luminosity of each led (form 0 to 255).
e.g.: 255 0 0 0 [ … ] 0 means that only one led is on at full power, while the others are off.
I think a way of doing this could be cutting eight 2d slices (one behind the other in depth) form a gl scene, downsample their resoultion to 8×8, and spill the alpha of each pixel.
Is this possible? i’m really sorry for my bad english, i can’t explain myself in a clear way :)
PS: there is another post in this forum about making 2d slices from 3d scenes… they mention jit.gl.volume and jit.gl.isosurf….unfortunately i don’t understand how to use them….any hint?
So, what you are looking for isn’t a way to visualize the LEDs but to unravel the 3D matrix into a 2D one so that it can be sent out to the controller? I would encourage you to look at jit.spill, jit.scanwrap, jit.iter, and jit.submatrix and see if any of those do what you want. If you have trouble, post a patch.
exactly..i need to unravel the 3d matrix (8 8 8)
actually i know that i can use spill (etc..) to have the data i need, but from an open GL render i don’t know a way to obtain a 3d matrix reproducing the scene….just a 2d one! (i need to preserve the informations about depth)
thanks a lot andrew for your patience…as i said i’m really a jitter n00b^^ trying to improve:)
I’d love to help, but I really am having a hard time understanding exactly what you are trying to accomplish.
I think what the OP is looking for is a way of converting a 3D OpenGL space into a 3D matrix of RGB values, which will then be processed and sent to the LED cube.
exactly….3d opengl to 3d argb matrix.
then i’ll spill @plane 0 to have a list that i can send to arduino.
From what I can make of the question, I think that the data structure that you are using to drive your OpenGL animation, whether it is via jit.gl.multiple or otherwise, is going to contain the information that you need to drive the LED’s. There’s no need to read back from the GL, and there’s really no easy way to do so in the way that you’re thinking anyway. There is no abstract concept of "layers" in OpenGL, and to do what you want would take quite a bit of complex math to find intersections of shapes in arbitrary dimensions.
Andrew’s patch is worth looking at very closely. The key is to look at the values coming out of jit.noise in that patch. It has the values that are driving the color (including alpha) of each sphere (LED). This is the data you can use directly to drive your real-life LED’s.
You don’t need to use jit.noise to produce your animation, but if you can understand what it’s doing in this patch you’ll be well on your way.
Of course, if you want to create arbitrary OpenGL scenes and simply "down-res" these to a 8x8x8 LED matrix – the short answer is, there’s no easy way to do this.
Well, I don’t have time to make an example, but if one really wished to make "slices" of a 3D scene, one could render the scene multiple times (once for each slice), incrementally changing the near and far clipping plane, and reading back the slice with jit.gl.asyncread or another readback mechanism.
I have no idea how well the results would match what you’re expecting to accomplish. I assume you’d want to do some threshold detection or averaging in sub regions, rather than simple downsampling on each of your 2d slices.
You might want to explore other ways to accomplish your animation by using objects like jit.bfg, jit.expr, direct cell access in JS or Java, or some other method of accessing your 512 point cube.
great guys…i’ll check your suggestions carefully!
i’ll let you know if i succeed:)
This is quite an old thread but anyways…
I am working on an installation and I got stuck. I would like to apply a gridshape and its colour to the grid created by jit.gl.multiple but I can only apply the 2d matrix to it. How can I apply the actual 3d shape? To control the LEDs I would need to get the RGB values from the multiple object. Should I use jit.spill? Having said that the colors are a bit off as well. Also, the shape I am building with the LEDs is not a perfect cube. Can I remove specific items form the multiple object?
I know I am asking a lot of questions but any help would be much appreciated!
Forums > Jitter