Hey guys,
As the titles says, i'd like to have my particles spinning in different directions and different speeds, i was under the assumption that the POP Spin would do the trick off the shelf, but i couldn't have been more wrong.
Could anyone put me on the right path. Oh yeah… and I can't vex/code for S###…
Thanks a bunch in advance.
A.
Randomize POP particles orientation, spinning axis, and spinning speed? (Equivalent to 3ds max Pflow Spin operator)
12674 2 1- Adriano
- Member
- 411 posts
- Joined: June 2015
- Online
- jlait
- Staff
- 6413 posts
- Joined: July 2005
- Offline
Spin is controlled by the `w` attribute. The pop spin should add this & the orient attribute. So you should be able to get spinning particles off the shelf.
To randomly spin, there are two options:
1) Randomly orient the particles and have them all spin about the same local axis
2) Randomize the spin axis for each particle.
In the attached I've done both.
To randomize the original orienations, I've added a justborn group to the location so we can identify particles that were just made. I then used a POP VOP to write the orient attribute to be a random normalized vector4. By setting this to justborn group, we only apply to the new particles and don't reset the orientation every frame. Note we use the particle id as the seed for the randomness.
If you used a default spin, these particles would all spin along the global y-axis with the default settings. If you turn on “Use particles local axis” you'll get them spinning around their local y-axis instead. Which may be what you want. But if you want them spinning around a random axis, you need a short expression. In the attached I've done that by adding the two lines
axis and spinspeed are the names of the parameters above. I'm overwriting the axis with a random vector. Because rand() returns 0..1, I have to subtract 0.5 to get something that points all ways. The spinspeed I just scale by a random float, so you can still adjust the spin speed by adjusting the parameter. These act as overrides to the parameters above.
The @id+0.1 is to use a different random sequence for the spinspeed than we used for the axis so they aren't correlated.
To randomly spin, there are two options:
1) Randomly orient the particles and have them all spin about the same local axis
2) Randomize the spin axis for each particle.
In the attached I've done both.
To randomize the original orienations, I've added a justborn group to the location so we can identify particles that were just made. I then used a POP VOP to write the orient attribute to be a random normalized vector4. By setting this to justborn group, we only apply to the new particles and don't reset the orientation every frame. Note we use the particle id as the seed for the randomness.
If you used a default spin, these particles would all spin along the global y-axis with the default settings. If you turn on “Use particles local axis” you'll get them spinning around their local y-axis instead. Which may be what you want. But if you want them spinning around a random axis, you need a short expression. In the attached I've done that by adding the two lines
// The following makes it random: axis = rand(@id) - set(0.5, 0.5, 0.5); spinspeed *= rand(@id+0.1);
axis and spinspeed are the names of the parameters above. I'm overwriting the axis with a random vector. Because rand() returns 0..1, I have to subtract 0.5 to get something that points all ways. The spinspeed I just scale by a random float, so you can still adjust the spin speed by adjusting the parameter. These act as overrides to the parameters above.
The @id+0.1 is to use a different random sequence for the spinspeed than we used for the axis so they aren't correlated.
- Adriano
- Member
- 411 posts
- Joined: June 2015
- Online
-
- Quick Links