Sphere points/particle

Hi, I have a general question that how can I control each points of a sphere? I want to have to control of each points separately and I’m not sure if I should play with instancing or particle sop? The particle sop seems to move all the time.

I know this question is a bit broad and I would like to specify more during the discussion.

Thanks everyone in advance!

Hi there,

If your graphical card allows it, instancing would be more efficient than the particleSOP. The particleSOP is calculated on the CPU where with instancing there is just 1 SOP but being duplicated on the GPU with certain parameters (position / size / rotation / color etc).
Using CHOP or TOP data you can reference each particle separately, like growing the size of 1 particular particle out of all your particles etc.

cheers,
tim

1 Like

Hi TIm,

Thank you for your answer and I tried the instancing before. I’m not sure if I’m using instancing can I control each points? I know if you turn the viewport on and press P you can find out the number of the points. How can I animate them do you have any idea?

Best,
C

Hi C,

You can set a TOP as ‘translate OP’ in a geo then use the R G and B channels as X Y and Z. This way you represent a particle as a color. If you then do some manipulations on that TOP before going into the instancing you can move things around…
For example look at the attached tox.

Hope this helps.
Cheers,
tim

ps. the colors are set on the ‘instance 2’ tab (‘Color op’ also referencing to the same TOP)

InstancingExample.tox (16.0 KB)

Hi Tim,

Thank you for the example! I just want to know how can I utilise the point numbers and do some animation about it because I’m more interested in keeping the sphere shape and play with the dynamics between the points instead of making a particle clouds.

Maybe it will need to go in to GLSL or CHOP?

Cheers,
Cheng

Ah sorry, I misunderstood you. So you would like to deform the sphere’s vertices.
There are different techniques to do so, best is to do it on the GPU since it can get quite heavy when dealing with lots of vertices.
A possible way is to use the PBR material. When using a normal map it’s possible to also use a height map that can displace the vertices. Though since you’re dealing with a sphere the map should be some kind of equirectangular map in order to map it correctly on the sphere… (I used the projectionTOP very poorly in this example :))
To have a bit more control it’s indeed perhaps easier to dive into the GLSL. (you can press ‘Output shader’ on a material you already set up to see how they do it in GLSL).

Cheers,
tim

SphereDisplace.tox (990 Bytes)

Hi Tim,

Thank you so much for always making examples for me. I haven’t tried to change any parameters from your files but I think it will be fun! Maybe I’m imagining this too easy because I really want to try something like this kind of videos.

https://www.instagram.com/p/CVInyC8Pf5A/

Like play with the particles and the geos. Do you have any ideas about it?

Cheers,
Cheng

Hi Cheng,

ah misunderstood you again :smiley: But makes sense now what you’re trying to achieve. In that case it’s definitely particles you want and perhaps not even spheres, but just points.
In case of a spherical shape I would go for some math to calculate the position of every particle rather than fetching them out of a SOP (vertices). This allows you to cover the whole surface with particles. The downside is that it’s purely spherical shapes that you can deform. Or at least you would need the equations for the shape you want to draw.
Since examples tell more than explaining the concepts in text in my opinion, and since you enjoy having them, here’s another example :smiley:

Cheers,
tim

SphericalParticles.tox (12.6 KB)

Hi Tim,

This is amazing. I’m not really understand the network. Is it possible for you to explain the logic briefly? There are some TOPs or SOPs that I never tried before.

Cheers,
Cheng

Hi Cheng,

It’s a bit abstract and involves some math that might look confusing.
I’ll try to explain the flow by going through all operators starting from the left, but first you’ll need to know a bit of the math that’s being achieved using those operators.

You can describe an unit sphere (sphere with radius 1) using 2 angles. 1 angle describing the angle on an unit circle (xz), the other the latitude (y). If you then make a top that ranges from 0 to 1 and use that as fraction of those angles, you’ll get a top with xyz positions that cover the surface of the sphere.
For examples if both angles are 0, it would point to (0,1,0), then if the first angle goes from 0 to 1, it will calculate all positions on a circle, then if you ‘rotate’ that circle in the other dimension 180 degrees it will cover a sphere.
To calculate a point on a circle you can use: x = sin(angle1 * 2 * PI) and z = cos(angle1 * 2 * PI). Then to rotate it 180 degrees, you can multiply those values with sin(angle2 * PI) and set y = cos(angle2 * PI).
If you then let ‘u’ be the variable going from 0 to 1 over the horizontal direction of the TOP represents the angle1 and ‘v’ be the variable over the vertical represents angle2, you’ll get:
x = sin(v * PI)*sin(u * 2 * PI)
y = cos(v * PI)
z = sin(v * PI)*sin(u * 2 * PI)

So this covers the surface of a sphere with radius 1. If you want to have a different radius you can simply multiply x, y and z with a number to scale the whole sphere. If you vary this per pixel you can manipulate/deform the sphere super fast.

So to express this in operators:
First I create a rampTOP (ramp1) to let the values go from 0 to 1 over the ‘u’ or ‘x’ (horizontal), then I use a flipTOP (flip1) to have the same ramp over ‘v’ or ‘y’ (vertical). For the ‘u’ values I’m calculating the sin and cos of the angle1 using a functionTOP. The cos() is stored in the ‘r’ channel, and the sin() in the ‘g’ channel of the TOP.
Similarly for the ‘v’ values the sin and cos of the angle2. Since angle2 is only 180 degrees (PI instead of 2PI) I’m using a mathTOP (math1) to change the range from 0 - 1 to 0.25 - 0.75. Then using reorderTOPs I’m fetching the individual results of the trigonometric results, so I can multiply them together. First to calculate the ‘x’, I’m multiplying (multiply1) reorder2 (cos(u)) with reorder4 (sin(v)), and multiplying (multiply2) reorder3 (sin(u)) with reorder4 (sin(v)) to get the ‘z’. Finally to get the ‘y’ I’m just fetching the cos(v) values. I’m multiplying (math2) it with -1 just to make y point up in the TOP, this is not really needed, so you could remove that one :slight_smile:

Finally merging them all together into 1 top using again a reorderTOP (reorder6) and setting alpha to 1. This results in a TOP where every pixel represents a point of the surface of the sphere. I’ve added a null2 to show the results in points (‘v’-mode when viewing a top).

If you then multiply that top with something else, you can alter the radius like described above. Then I use the final null1 TOP as source of instanced particles, positioning them on the xyz I just computed.

The particles themselves are created by using an addSOP (Points/add1) to create a point, then converting it to a particle using a convertSOP (Points/convert1), this makes sure it gets rendered as a point.

I noticed I didn’t include any materials. You could add a lineMAT to the Points geo to have some control over how the points are rendered.

Hope this all makes a bit of sense. Not sure how much of the math you understand, perhaps check out Sphere - Wikipedia and Spherical coordinate system - Wikipedia where they explain it way better than I ever can :smiley:

Cheers,
tim

1 Like