PDA

View Full Version : There has to be a way...1000 particles evenly distibuted on a 100x100 plane


thethule
02-23-2008, 09:50 AM
Ok, maybe im being stupid here, but i have used Pflow for quite a while and have never figured out how to do this:

Say i want 1000 flat planes flying towards the camera from the distance and positioning themselves side by side to form a rectangle. Basically like countless corporate videos where the images fly in and form one big image.

Now i COULD animate them by hand, and thats fine, but i would like to do it with pflow so that i can add wind, find targets etc...to make it more interesting.

But if i build a plane that is 100x100 polygons (1000 square) and tell the Pflow position by object operator to use this and use vertex for positions and make my particle count 1000, the particles are not evenly distributed, some clump 4 on top of each other on one vertex whiel leaving the one near it free.

I have to up the count to the many thousands to get it to cover the plane, which is obviously no good.

So, is there ANY way of getting, say, 1000 particles to distribute evenly on 1000 vertexs of a plane?

There must be, which is why i think im being stupid..

Cheers guys

marc

scrimski
02-23-2008, 10:15 AM
Try this

http://www.allanmckay.com/tut/test.swf

noouch
02-23-2008, 11:40 AM
btw 100x100 = 10,000 ;)

scrimski
02-23-2008, 12:18 PM
Erbsenzähler :scream:

lo
02-23-2008, 04:46 PM
I think Orbaz PFlow Toolbox #1 has a solution for this.

thethule
02-23-2008, 07:49 PM
btw 100x100 = 10,000 ;)


So it is...And the funny thing is that i studied physics at university...Oh well, money well spent eh?

Thanks for the replies, i will take a look now. I looked into Orbaz tools 1 but didnt see something that could be used for this, ill take another look.


Cheers,

Marc

thethule
02-23-2008, 07:51 PM
I also found this that would work (i think its the principle as the Mccay vid). So it can be done by breaking the plane into objects, then using those as particles. Ok, seems bizarre that it cant be done more simply, but this is better than nothing.

Thanks again

grury
02-24-2008, 07:15 AM
Just did a quick test.
Created a square plane, 200x200 with 100 segments, then Mesh select n select all verts. On the Position Obj op, used the same amount of particles as verts in the square, then Location selected vertices and ticked the Separation box. Used a Facin Shap op with a size 2. It worked just fine. Now if you want the lil squares to move, u may want to use the Lock/bound op from PFlow Tools 1.

Bobo
02-24-2008, 05:14 PM
I also found this that would work (i think its the principle as the Mccay vid). So it can be done by breaking the plane into objects, then using those as particles. Ok, seems bizarre that it cant be done more simply, but this is better than nothing.

Thanks again

First, the PositionObject+ operator by Orbaz has the option to emit one particle per vertex without repeating until all vertices have been used. So setting the particle count to the vertex count would cover the whole plane.

Second, it can be scripted in 3 minutes, with or without a base plane. Just create a Birth Script, add two nested FOR loops to define the X and Y coordinates of each particle and add a particle in each iteration:

on ChannelsUsed pCont do (
pCont.useTime = true
pCont.useAge = true
pCont.usePosition = true
)

on Init pCont do ()

on Proceed pCont do (
local theSpacing = 10 --the distance between particles along X and Y
local t1 = pCont.getTimeEnd() as float --the end evaluation time
if (t1 == 0) do ( --if on frame 0, create particles!
for y = 1 to 100 do ( --hundred rows
for x = 1 to 100 do ( --hundred columns
pCont.AddParticle() --add a new particles
pCont.particleIndex = pCont.NumParticles() --make the last one current
pCont.particleTime = 0 --set the time to 0
pCont.particleAge = 0 --set the age to 0
pCont.particlePosition = [x, y, 0] * theSpacing --set the position to X,Y * spacing
)--end x loop
)--end y loop
)--end if
)--end proceed

on Release pCont do ()



So I would not say it is not easily possible...

Also note that if you want randomized particles to FORM a grid later in the animation, the Find Target test has an option to specify the absolute world position of each particle using its Scriped Vector channel. So all you need is a Script Operator to specify where the particles should go and tell the Find Target to make them go there...

odinuk
02-26-2008, 09:43 AM
Hi,

The script is great bobo, thanks.
I would like to be able to move each object on the grid one at a time with a slight delay.
So if i have 100 objects i would like object 1 to move first and object 100 to move last.
the rest of my events are in the pflow event modules.

Im pretty sure i could use particle speed but i dont know much scripting so would be greatful if anyone could help.

regards

O

odinuk
02-26-2008, 01:36 PM
So I would not say it is not easily possible...

Also note that if you want randomized particles to FORM a grid later in the animation, the Find Target test has an option to specify the absolute world position of each particle using its Scriped Vector channel. So all you need is a Script Operator to specify where the particles should go and tell the Find Target to make them go there...

Hi Bobo, how would i go about achieving this.Yount i suppose have a little code snippet for us?

thanks

odin

Bobo
02-26-2008, 04:10 PM
Hi,

The script is great bobo, thanks.
I would like to be able to move each object on the grid one at a time with a slight delay.
So if i have 100 objects i would like object 1 to move first and object 100 to move last.
the rest of my events are in the pflow event modules.

Im pretty sure i could use particle speed but i dont know much scripting so would be greatful if anyone could help.

regards

O

Notice how the Birth script tells each particle its Age is 0?
You could set the age to a different decrementing value and use an Age Test to send out the particles to an event with a Speed Operator one by one...

Bobo
02-26-2008, 04:19 PM
Hi Bobo, how would i go about achieving this.Yount i suppose have a little code snippet for us?

thanks

odin

Indeed I have the code ready to go for my next CG Academy DVD on "Scripting PFlow" ;)
Here is how it works, in short:

*Add a Script Operator after the Birth operator.
*Enable the Scripted Vector Channel (pCont.useVector = true)
*Use the same loop as in the previous example to define the X and Y coordinates, but write them into the pCont.particleVector channel instead of .particlePosition of each particle. You should make sure you have as many particles as iterations in the loop, or use an IF test to make sure you are not assigning a vector to a non-existing particle.
*Optionally, you could snapshot the mesh of a geometry object and read its vertex positions to make the particles fly to the vertices instead.

*Add a Find Target test and set its "Point" drop-down list to "By Scripted Vector"

Now the Find Target will read the positions stored in the Scripted Vector channel of each particle and move them there over time.

*Send the particles out of the Find Target to another event where you kill the Speed using a Speed Operator set to 0 or a Stop* operator if you have it installed.
*Optionally, use another Script Operator in that final event to assign the content of the .particleVector channel to the .particlePosition channel for each particle in the event to ensure that they land EXACTLY where requested, because Find Target sends out based on proximity, it never really hits the position exactly.

thethule
02-27-2008, 01:03 AM
Fantastic replies guys. Thank you to all, thanks Bobo for your knowledge as well.

No time to try it out at this moment, but i will soon.

Cheers!!

Marc

odinuk
02-27-2008, 08:59 AM
I will be buying your DVD's too.

thanks for sharing.

O

odinuk
02-27-2008, 12:06 PM
Hi Boris, i ma trying this but the operator just sends the particles to a single vector.
is there something obvious i am doing wrong?
i can't reduce the number of particles fyling into the end position either, what would be a good way of only have say 50 of 100 particles form a grid at the end of the animation?

arrrrrrrrgh.



-- This is a script that can be used to generate particles
on ChannelsUsed pCont do (
pCont.useTime = true
pCont.useAge = true
pCont.usePosition = true
pCont.useVector = true
)

on Init pCont do ()

on Proceed pCont do (
local xspace = 16
local yspace =-16

local theSpacing = 16 --the distance between particles along X and Y
--local t1 = pCont.getTimeEnd() as float --the end evaluation time
--if (t1 == 0) do ( --if on frame 0, create particles!
for y = 1 to 4 do (
for x = 1 to 10 do (
local xspacer = (xspace*x)
local yspacer = (yspace*y)


--pCont.AddParticle() --add a new particles
pCont.particleIndex = pCont.NumParticles() --make the last one current
pCont.particleTime = 0 --set the time to 0
pCont.particleAge = 0 --set the age to 0
--pCont.particlePosition = [xspacer-200,yspacer+60,0] --set the position to X,Y * spacing
pCont.particleVector = [xspacer-200,yspacer+60,0]


)--end x loop
)--end y loop
-- )--end if
)--end proceed

on Release pCont do ()


thanks again all

O

Bobo
02-27-2008, 03:27 PM
Works for me - I actually removed your remarks and used the code in a Birth Script to use it to both place the particles on a grid AND define where they should go.
Then I added a Find Target, switched Point drop-down list to "By Script Vector" and the particles flew to the points I defined (which I made slightly different than the starting grid):

-- This is a script that can be used to generate particles
on ChannelsUsed pCont do (
pCont.useTime = true
pCont.useAge = true
pCont.usePosition = true
pCont.useVector = true
)

on Init pCont do ()

on Proceed pCont do (
local xspace = 16
local yspace =-16

local theSpacing = 16 --the distance between particles along X and Y
local t1 = pCont.getTimeEnd() as float --the end evaluation time
if (t1 == 0) do ( --if on frame 0, create particles!
for y = 1 to 4 do (
for x = 1 to 10 do (
local xspacer = (xspace*x)
local yspacer = (yspace*y)


pCont.AddParticle() --add a new particles
pCont.particleIndex = pCont.NumParticles() --make the last one current
pCont.particleTime = 0 --set the time to 0
pCont.particleAge = 0 --set the age to 0
pCont.particlePosition = [xspacer-200,yspacer+60,0] --set the position to X,Y * spacing
pCont.particleVector = [xspacer+100,yspacer+200,1000] -- set the target positions


)--end x loop
)--end y loop
)--end if
)--end proceed

on Release pCont do ()

With default settings, it took them 110 frames to reach the destination.
I wired the Find Target to an event containing a Speed operator with 0.0 value and they stopped once there.


If you want only some particles to go to the new grid, just set the particleVector value of a portion of the particles to the same value as particlePosition so they will assume they have already arrived. Or split the particles using Split Amount first, then use the Find Target in the following event, so only a portion would perform the search. Not sure what your problem is...

odinuk
02-27-2008, 04:46 PM
It is sinking in slowly, no problem apart from me being a moron!!!

its working for me too


Thanks so much

O

JohnnyRandom
02-27-2008, 05:04 PM
Indeed I have the code ready to go for my next CG Academy DVD on "Scripting PFlow" ;)


Excellent news! Looking forward to it Bobo:)

entrancea
02-27-2008, 05:17 PM
Indeed I have the code ready to go for my next CG Academy DVD on "Scripting PFlow" ;)

Cant wait for it t release....Any info on its release date Bobo?:bounce:

thethule
03-07-2008, 10:32 PM
Sorry for not posting any more replies to my original post. Thank you all for the answers, i just got too busy to look into it for now, but i will do soon.


Cheers,

Marc

thethule
03-11-2008, 06:44 PM
Just a quick question and apoplogies if im being stupid. But...


-Where can i get position+ by orbaz? I cant seem to find it anywhere on their site. Either in their box tools or freebies...

Cheers,

Marc

Bobo
03-11-2008, 09:15 PM
Just a quick question and apoplogies if im being stupid. But...


-Where can i get position+ by orbaz? I cant seem to find it anywhere on their site. Either in their box tools or freebies...

Cheers,

Marc

I can see it, but only up to Max 8. (This includes maxplugins.de and orbaz.com).
There seems to be no build for Max 9 and 2008, but I might be blind, too...

thethule
03-11-2008, 09:58 PM
Yeah, thought of that, but i cant even see it in my max8....i DO remember it in though..weird

Thanks

scrimski
03-11-2008, 10:50 PM
posted in wrong forum, please delete.

CGTalk Moderation
03-11-2008, 10:50 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.