PDA

View Full Version : Flocking question (revisited)



occam
10-18-2016, 08:14 AM
A few years ago I was confronted with a question regarding the lightwave flocking system. I both posted this question on this forum and searched the net for an answer but I never found an answer. I eventually worked around the problem, but I am still interested to a solution to this problem, as it would save me a lot of time with future animations.

In the enclosed picture I illustrate what I want to accomplish. (1) I have an array of 50 objects (25 red cubes, 25 blue cubes, positioned evenly on a 18x8m grid) that start moving towards a specific goal (2). The red cubes move to a grid of 8x8m on the right, ending up evenly spaced on this 8x8m grid. The same goes for the blue cubes, except these go to a 8x8m grid on the left (3). I want the cubes to slow down before they reach their end-position on either grid (no abrubt stopping).

First I tried to animate this by hand, but the results lack the liveliness and randomness that you get when you use LW's flocking system. Besides, the final animation will have to contain many more actors (the cubes in the example) so that animation by hand is not an option.
The problem that I have is that I cannot get the blue and red cubes to move to a prespecified end-position (a place on one of the 8x8m grids).

Can anyone please point a direction I could take to tackle this problem?

jwiede
10-18-2016, 11:11 AM
My suggestion would be to sim "in reverse": Flock them together from the segregated arrays as starting points. Bake resultant anim, play back in reverse. Use spacing tolerance to try and get proper separation in mixed population. Unfortunately, getting precisely-aligned positioning of flock members at goal doesn't appear possible with LW's current flocking, so if you need precise grid placement, perhaps "reverse" flock them together into a big group, anim to final precise grid positions, bake and run in reverse?

Hopefully someone else can come up with a better solution to deal with the precise grid-aligned expectations.

occam
10-18-2016, 03:07 PM
Thanks jwiede for your helpful suggestions. The last step of getting the objects to their final position may be tricky. Maybe I should forget about having the objects start from one neat array, but have the objects started as a group of objects that is more scattered and random

MonroePoteet
10-18-2016, 07:58 PM
If you don't mind rendering / compositing the animation in reverse as jwiede suggests, then you could use two separate point arrays as a Generator and an Arrive Goal. By setting the Arrival Radius on the goal to zero and a fairly small arrival radius (I used 0.5), the Agents will migrate to the specific points of the target point array.

Then, the trick is getting the Instanced agents colored into two groups, which can be done with a Gradient based upon the Instance's Original Position. By setting original-position instances at X less than zero to Red and X greater than zero to Blue, the Agents are separated into two groups. Because they retain their original color when they migrate and when they arrive at the (randomly selected?) goal points, they are mixed together.

Attached is a sample scene. NOTE that this uses the DP Kit Particle Info node so I can specify a specific particle emitter (the flock generator), and that you have to enable VPR to see the node-based coloration of the instances.

mTp

P.S. DP Kit is available here:

http://dpont.pagesperso-orange.fr/plugins/nodes/Additionnal_Nodes_2.html

Remember to support Denis if you can.

Prince Charming
10-18-2016, 09:53 PM
If you don't mind rendering / compositing the animation in reverse as jwiede suggests, then you could use two separate point arrays as a Generator and an Arrive Goal. By setting the Arrival Radius on the goal to zero and a fairly small arrival radius (I used 0.5), the Agents will migrate to the specific points of the target point array.

Then, the trick is getting the Instanced agents colored into two groups, which can be done with a Gradient based upon the Instance's Original Position. By setting original-position instances at X less than zero to Red and X greater than zero to Blue, the Agents are separated into two groups. Because they retain their original color when they migrate and when they arrive at the (randomly selected?) goal points, they are mixed together.

Attached is a sample scene. NOTE that this uses the DP Kit Particle Info node so I can specify a specific particle emitter (the flock generator), and that you have to enable VPR to see the node-based coloration of the instances.

mTp

P.S. DP Kit is available here:

http://dpont.pagesperso-orange.fr/plugins/nodes/Additionnal_Nodes_2.html

Remember to support Denis if you can.

That works well... I think the motion looks better playing forward. I have been modifying it a bit, and all my tests look better playing forward. It may be worth figuring out what particle index is on what side at the end... and texturing them based on id instead of start position. Will take a bit of time, but it looks better playing forward. I slowed them up a bit, and changes a few settings, and was able to get some really good motion. Few things that helped was starting them over 30 frames instead of 1, and also slowing them down a bit.

One thing I found that is kind of interesting is you can use nearest particle in the node texture on the flock perimeters, and most of the outputs work as expected. That makes things a bit more interesting. So basically all those parameters can be modified on the fly based on the particle info. Wish the same worked with the regular particle system. The only outputs that dont work are the age. Velocity, position, start position, id, between, ect... all can be used.

Thanks for the test scene...

occam
10-20-2016, 05:11 PM
If you don't mind rendering / compositing the animation in reverse as jwiede suggests, then you could use two separate point arrays as a Generator and an Arrive Goal. By setting the Arrival Radius on the goal to zero and a fairly small arrival radius (I used 0.5), the Agents will migrate to the specific points of the target point array.

Then, the trick is getting the Instanced agents colored into two groups, which can be done with a Gradient based upon the Instance's Original Position. By setting original-position instances at X less than zero to Red and X greater than zero to Blue, the Agents are separated into two groups. Because they retain their original color when they migrate and when they arrive at the (randomly selected?) goal points, they are mixed together.

Attached is a sample scene. NOTE that this uses the DP Kit Particle Info node so I can specify a specific particle emitter (the flock generator), and that you have to enable VPR to see the node-based coloration of the instances.

mTp

P.S. DP Kit is available here:

http://dpont.pagesperso-orange.fr/plugins/nodes/Additionnal_Nodes_2.html

Remember to support Denis if you can.

Dear MonroePoteet, I would like to thank you so much for your time and making a test scene available. This was really helpful! Acts like these make my day.