How to use jit.expr to arrange many little spheres into a big spherical array?

shihua's icon

Hello everyone!
I use it jit.gl.multiple and jit.gl.gridshape created many litte spheres,and use sound to affect their position. Now the shape of arranhement is a plane(the effect in the picture I've uploaded). I'd like to arrange them into a big sphere shape, but I don't know how to write the fomula in it.expr. Do you have any suggestion? Thank you~!

Snip20150521_6.png
png
MULTI-TOOL.maxpat
Max Patch
phiol's icon
Max Patch
Copy patch and select New From Clipboard in Max.

Do you mean something like this ,

phiol's icon
Max Patch
Copy patch and select New From Clipboard in Max.

or another version using jit.gl.mesh :-)

shihua's icon

Many thanks PHIOL! Use gridshape is an amazing way,but I'd like to go further, use audio signal to change the shape, that's why I want to creat a sphere with jit.expr :)

phiol's icon

Hey shihua

Max Patch
Copy patch and select New From Clipboard in Max.

here is your finished patch ;-). hope you can grab a trick or 2 out of this.

Shing-Kwei's icon

Hello Shihua, Hello Phiol, very interesting topic! may join discussion.
I am a beginner of Jitter, I try to build a kaleidoscope jit.window, can I use leapmotion.max ( from IRCAM) to control many datas of Phiol's patches simultaneously ? ( for instance the position, scale, rotatexyz etc.?
Or is there a Jitter object just like
max/MSP "rog~" Romain's granular synthesis object
link to jit.winow @...... to change jit.qt.movie or image?

thanks!

best

Shing-kwei

phiol's icon

hello shing-kwei

i'm not exactly sure what you want,
but for kaleidoscope type move , you could duplicate
jit.gl.camera a few times, copy/paste the jit.anim.node
and control the transform of each jit.gl.camera .

i'm on mac and use aka.leap

best

phiol

shihua's icon

Thanks again PHIOL! So nice of you:) I've got many interesting tricks for me in your patch.

shihua's icon
Max Patch
Copy patch and select New From Clipboard in Max.

Hello SHING-KWEI
Kaleidoscope effect is easy to achieve with it.gl.slab and the shader td.kaledo.jxs, but I’m not exactly sure that is you want,hope it will be helpful to you:

phiol's icon

Hello all ,
I'm glad you like it and could find something in there.
As for the kaleidoscope. I forgot to mention what shihua did , td.kaleido.jxs
I mentioned jit.gl.camera thinking of the example camera.direct.feedback.maxpat from the example patches .
I always think of using multiple gl cameras as an efficient to fill the screen.

jit.gl.lua: yeah I see how jit.gl.lua is great. If you open the jit.gl.material
see that it's just and super nice jit.gl.lua patch. where they're using phong and blinn etc......

@raja : Would you have any example patches or any good place I could start my studies of the fisher-price practical language?

Thanks a lot

phiol

phiol's icon

Hihi just thought I'd share

here's a shit take on autechre's Gantz Graf song using the above patch that I posted on my "plastic fruit" youtube channel .
I'm obviously completely mousin' it on the transforms. But I really like the the tight response though.

And while at it:
here's my website http://www.plasticfruit.ca/
for more works entirely done in MaxMSP Jitter.

:-)

phiol's icon

thanks for the link raja.

>>and not so related to jit.gl.lua, but more related to this thread, i can’t understand any of this at all(i barely got through basic understanding of FFT in audio recently, what are these vertex/normals/transform/rotation/etc. matrix thingiez?), but i’ll just have to keep repeat-reading it, haHA!:

Basically there is normal jitter CPU and there is GL Jitter GPU.
when using a matrix to built geometry, each plane talks to a specific angle .
plane 0 talks to x angle , plane 1 = y angle , plane 2 = z angle.
So there are vertices, edges . textures , normal

Lingo in a nutshell
an array is another way to say matrix and specific point (coord) in this 3d world matrix would be a vector.
DATA :
-normal regular older Jitter. Data is in char values (0-255). Color and plane order = argb
-3d GPU (gl) Jitter Data is in float32 values (0.-1.) and the color order == rgba

Jitter 3D (GPU), there 2 ways to play with DATA.
3D geometry and plane
2D pixels

Max Patch
Copy patch and select New From Clipboard in Max.

3D and 2D gl are 2 completely different ways to play the game.
-2d plane 0 1 2 3 talk to colors rgba AND 3D plane 0 1 2
Gen:
jit.gen
jit.gl.pix : is for 2d pixel playing on the GPU.
Important : when using gen
-------
Using jit.gl.mesh: (see it like you have a smashed up piece of paper/plane that you have to unfold)
i.e. you unfold for the shape / unfold for the texture / the light and shadows/ the colors
Cheating with jit.gl.gridshape @matrixoutput 1 to jit.gl.mesh.
here is an example of what I mean.

check out appendix B the answers are there.
Matrices with anywhere from two to 13 planes can be used. Planes 13 and up are reserved for later use and will currently be ignored. Each plane represents a different value in one of five groups: vertices, texture coordinates, normals, vertex color and edges. If enough planes are present to specify a given group, that group is used in rendering the matrix. To be used, each group must be totally present, with the exception of vertices. If only x and y values for vertices are present, the z coordinate of all vertices is set to 0, and an 2D image on the xy plane results.

plane 0: x coordinate of vertex
plane 1: y coordinate of vertex
plane 2: z coordinate of vertex
plane 3: s coordinate of texture at vertex, if textured
plane 4: t coordinate of texture at vertex, if textured
plane 5: x component of lighting normal at vertex
plane 6: y component of lighting normal at vertex
plane 7: z component of lighting normal at vertex
plane 8: red component of vertex color
plane 9: green component of vertex color
plane 10: blue component of vertex color
plane 11: alpha component of vertex color
plane 12: edge flag for connection to next vertex: if < 0, no line is drawn.

I believe this is enough for now , but feel free to ask.

phiol

phiol's icon

I completely hear you.

did you look @ the patch. that's what snorm is doing . a signed normalized from -1. to 1.
what you want will all be done in gen. you start with a matrix to snorm to sphere or say PI and go from there.

Max Patch
Copy patch and select New From Clipboard in Max.

A good example is this nice patch by wetterberg he called little critter.
Look in the jit.gen

phiol's icon
phiol's icon
Max Patch
Copy patch and select New From Clipboard in Max.

here is another way to create a custom shapes :-)

Max Patch
Copy patch and select New From Clipboard in Max.

and here is a version with jit.gl.nurbs

Shing-Kwei's icon

Hello all,
you are talking very far, high beyond my ability, may I draw back to my kaleidoscope?
The patch Shi-hua sent me is cool! but it's different as I wish. I want to use Leap Motion ( leap motion.max or leapmotion.aka) to get a interactive fractal jit.window ( no matter to use jit.qt.moive or it.grab, it's kind improvisation with audio --- rog~ Romain’s granular synthesis ). I try to study jit.gl.camera, jit.anmi.node, jit.gl.lua, jit.gl.**** etc......... but OpenGL is hard to understand in a short time ( I took less than 25 Jitter Tutorials and a few experience of Andrew Benson Receipt Book I, II, III before)
If there are more concrete examples ( tutorials) would be great appreciate!!
thanks Shi-hua, thanks Phiol again!

best

Shing-kwei

phiol's icon

Hi Shing-Kwei ,

I would suggest you post an image or youtube link that would demonstrate what you are trying to achieve.
this would help us help you better :-)

phiol's icon
Max Patch
Copy patch and select New From Clipboard in Max.

In the meantime ,
Back to custom shapes , here is an efficient way to use jit.gen and xfade

Max Patch
Copy patch and select New From Clipboard in Max.

Here is the same patch using 2 meshes and a the new Max7 jit.gl.pass object

Pedro Santos's icon

Phiol is on fire!
Thank you, and keep it going... ;-)

Shing-Kwei's icon

Hi Phiol,
here is my patch, but really naive! only the draft concept of mine. video part more concrete examples?
Hopeful don't disturb your discussion Custom shapes too much.
thanks!!

best
Shing-kwei

Kaleidoscope_1.txt
txt
Kaleidoscope_1.maxhelp
maxhelp
Shing-Kwei's icon

Hi Phiol,
Sorry! I don't know how to attach a Max patch, it seems text file only. let me try again.

best
Shing-kwei

Kaleidoscope_11.maxhelp
maxhelp
Rob Ramirez's icon

feel free to update this with any additional info.

phiol's icon

Oh man !! Thanks so much for putting this together Rob :-)
I was explaining it on the fly. I'll add to it when I can.

@Shing-Kwei: I'm not entirely sure what I'm supposed to be looking for ?
As for copy/pasting patches :
-select all your objects (ctrl+a windows / cmd+a Mac)
-Go to edit and select copy/compressed
-paste in the thread and the site engine (word press) will do the rest, the magic :-)
>> do you have any visual examples of what you're trying to achieve ? youtube , vimeo. Influences ?

shihua's icon

Hello everyone, I'm back, happy to see so many informations, thank you!

Shing-Kwei's icon

Hello Phiol,
thanks for your reply on Forum.
I'm sorry I don't understand
....... paste in the tread ........ exactly. I have "copy compressed" then paste on the discussion square, I can't sent out the discussion at all.
Unfortunately I don't have such kind Youtube ( eve I don't have video camera). let me attach again.

best

Shing-kwei

Kaleidoscope_12.maxhelp
maxhelp
Shing-Kwei's icon

Hello Phiol,
let me try attach a compressed patch.

all best

Shing-kwei

Kaleidoscope_compressed.maxpat
Max Patch
endless's icon

some deep knowledge being dropped in this thread!

Greg Finger's icon

@PHIOL I want to revisit your first patch, the instancing geometry example, a shape made of shapes, shapeception. I enjoyed being able to make a cube out of duck.dae, or the opposite, the duck.dae made out of cubes. (although the latter is pretty intensive, running the matrixoutput through a [jit.matrix] of smaller dimensions solves this). Now i'm looking a way to be able to rotate each instanced geometry around it's individual vertex point. Individually would be splendid, but would even settle if they all spun together and the same way. Is this possible?

Cheers

phiol's icon

Hi greg ,

Do you mean something like this ?
yes you can set they individually with the setcell message or in jit.gen with the [cell ] to a [== 0 0 0]
as you will see in the patch the duck has a [dim ] of 12636 I don't know if it's NxNxN .
But they all seem to be on the same plane. Thus why my jit.matrices are set to 12636.

cheers

Max Patch
Copy patch and select New From Clipboard in Max.

phiol

Greg Finger's icon

Ah! @glparams, it's even in the help file. not sure how i glossed over that one. Thanks. As for NxNxN issue, not quite sure what you are saying, using [jit.cellblock] there seems to be 3 distinct planes with differing cell values.

Max Patch
Copy patch and select New From Clipboard in Max.

While I have your attention, do you know a good way to reduce polygon count of a model using Max? All my tweaking around with jit.gl.mesh parameters, and i can only reproduce a model with gaps and holes when i decimate some of the polygons. Same thing if I try with a gridshape. I'm hoping there's a way to get Max to logically fill the holes with the simplest geometry, or maybe my method of reducing jit.matrix dimensions isn't the best way of reducing polygon count.