Generate particles shapes

hi all !

I am trying to generate shapes (essentially squares or stripes) made of particles. My idea is to use Tops to instance particles.

In the example attached, i have managed to approach the build of a striped shape but :

  • i was expecting compact stripes made of particles lines, but here you can see spaces between the lines. I don’t see the issue here…

  • the generated shape doesn’t match the Top ratio i was expecting (probably due to the above issue ?)

  • you can see some “additional” lines between the stripes which i don’t know the origin.

Also i have tried to use the alpha channel to prevent particle instancing using the “activate” field in the instancing parameters but doesn’t seem to work.

Any help appreciated.

thanks a lot

stripes.tox (1.9 KB)

Hi Gallo,
Looking at your project, I have some remarks:
Its normal you obtain lines, becaus each pixel produces one round particule, your ramps go from 0 to 1 verticaly and horizontaly but you doesnt use the same def verticaly and horizontaly…
If you change your def to 1000x1000, there is no more lines (and no more suplementary lines).
You can change the ratio using the math Top to change the width and height of your stripes, I changed the ratio by changing the R range to 0-2.
Hope that helps.
A bientôt à la Gaité
stripesCor.toe (4.9 KB)

To continue on the topic, I strongly recomend working with GLSL Top with compute shader to manage particule, because all is more explicit. The problem working with Tops is that there is no relation between the size of the image and the size of the produced object. Working with shader, you dont have the illusion of wotking with real image and dimensions.

hi Jacques,

thanks a lot for your help.
I like both techniques so i am trying to generate things on both sides.

On your example it seems to work. But what if i need a rectangular shape instead of a square shape ? Doesn’t seem to work anymore in that case.

Changing the render resolution shouldn’t impact the particle shape. The issues lies in somewhere else in my opinion, but maybe i am missing some technical process.

thanks

Bonjour,
I made a more elaborate proposition but on the first proposition, the shape was rectangular, it was your render who was squared…
On this one, I separate the different fonctions:
– the constant Chop create the number of pixels, here 1920x1080 but the real number is determined by the proportion of white in your mask.
– separate each component, each a mono 32 bits, using math Top to scale it.
– reorder to make a RGBA image
– instancing with alpha to activate
– render with the same definition
– an orthographic camera with a width of 2 (slightly larger than 1.920)
– a line Mat with line deactivated and point activated, so you can easily change the size of particles.
I hope all is understandable,
Chuss, Jacques
stripesCor01.toe (4.8 KB)

And the much more elegant and powerful version using GLSL Top with compute shader. You can then, using noise and feedback, move the particles with interesting shapes.
Enjoy it
stripesCompute.toe (5.1 KB)

Hi !

Thanks a lot Jacques.
I have some remarks though :

  • I have changed the material for a point sprite MAT. Line MAT makes the project unusable and slows it down to 2 fps…
  • something i still don’t understand : seems ok for a 1920x1080 pixels resolution. Everything seems consistant. But trying another shape like 500 x 800 on the texture side and render side. Here the shape seems to keep the horizontal orientation and not vertical as i a expecting (see attached file)

thanks

and for the fun, the moving stripes
stripesCompute.4.toe (5.4 KB)

Its easier if you post the file, not only the capture, to understand what you want.

The size of the structure is not determined by the resolution but by the range in the Math Top (sizex and sizex) for the classical way and the sizex and sizey vectors in the glslmulti Top for the compute version.
Changing the definition only change the density of points. If texture size and object are in the same ratio, particules are evenly placed, if not you obtain lines. It was one of the reason for you problems.
Concerning Line Mat, it works perfectly at 60 fps with my GTX 1070, strange… Old Nvidia driver? AMD graphic card?

Sorry, away from my TD session right now.

Ok i noticed that, but this is where i am getting confused. The Math TOP is getting its resoltion from the input so it should follow this aspect ratio ?

I would expect that using the texture as normalized UV coordinates (0 to 1) would keep the aspect ratio. For instance, if you sample an image using a UV texture with a different aspect ratio, wouldn’t it change the output image ratio ?

So if i follow your suggestion, the solution would be to correct the aspect ratio with a math TOP ?
In your example, the X position ramp is 500 x 800 which is a 0.62:1 ratio. So i should add a Math Top after that Ramp and set Multiply to 0.62 in the Multi-add Tab ? If it works i think i got the solution but i don’t quite understand it…

PS : and yes, i am using a Macbook so AMD GPU

Si tu veux, on peux échanger par zoom ou par téléphone, cela risque d’être plus rapide…

but to answer quickly:
– in instancing, UV is not normalised, its real coordinates, the easier is to use the range of math top, not the multiply. Your ramp output 0 to 1, then you can easily change the output.

hi,

If i have a ramp / UV at say 200 x 100 i should end up with a 200 points in width and 100 points in height. Ramp is 0 to 1 so for example on X i should have a point at 0200 to 1200… so ratio should be ok.

So ok this will do the trick (using multiply in math to get the good ratio) even if it is not quite logical / intuitive to me.

Thanks a lot Jacques !

thank you both @jacqueshoepffner @Gallo for a very interesting discussion.
Now, say that with compute shaders I wanted to create something similar but
to make a 3D rectangular shape, so not flat stripes like in this example, but a 3D rectangular
shape that has volume, and made of individual particles like these stripes,
how would I do it? to make a single 3d box made of particles,
thank you :slight_smile:

boxparticles.toe (5.8 KB)

as I commented on the other post, I have seen that as in this attached .toe, I can link a particle sop to a sop shape, and with a few more bits the particles take the shape of the sop. However, this seems to work quite well with a sphere, but when I try to apply it to a long narrow rectangular box, the particles don’t fill the shape and only occupy part of it.
How can I fill the shape or at least its entire perimeter and faces with the particles?

and how could I do this with a compute shader and instances rather than with the particle sop, that would give me more freedom to experiment; I like that you also used the compute shader in this post, and I would like to do the same to produce this effect

thank you :slight_smile:

Hi,

I can’t tell for the compute shader as i am not really an expert on that matter.

As for the other solution, you might want to give the SprinkleSOP a try

Cheers

1 Like

boxparticlesnew.17.toe (7.9 KB)

this one works quite well, but I still need to understand how to map correctly an image into the color channel of the instanced shape in the geo node, so that the image maps correctly with the colors applied to the shape

and also how to mix this with a computer shader glsl stuff so that i can program stuff with the particles