PDA

View Full Version : store multiple positions for find target


designit
06-21-2010, 07:34 AM
I want to make something like this
http://vimeo.com/12516848

Im start with emitting particles on a txt mesh, pos obj op, then save their position in the vectorchannel for later use with find target, that works fine for one target.

But I would like to have particles travel between several targets, so how do i save positions for several targets when a particle only has one vectorchannel?
Can i create custom variables for a particle?

Btw would not like to use mesh option in find target op, since it creates a lot of overlapping particles, and im using box2 physics which sort of explodes these overlapping particles, thats why im starting off with position ops which distributes particles properly.

JohnnyRandom
06-21-2010, 07:54 PM
I just tested a scripted approach (albeit a fairly simple one) didn't work. :sad:

I used the .particleMatrix Channel, since this give you the option to have 4 sets of point3 data. It seems only the last Find Target Test gets the proper positions, the previous tests only seem to get a single position although proper object. It may be my script op at fault.

designit
06-21-2010, 08:12 PM
thx anyways - thought my post had died somewhere since it first appeared like 12 hours after i posted it.
But in the meantime i tried another approach. In my script ops, ive tried creating custom arrays to store my particlepositions, and then taking that array data into the vectorchannels when appropriate, it actually seems to do the job, and at okay speed too.

The thing slowing it down is the seperation calculation inside positionobject op, I had to turn it up to 2500 try's to avoid overlapping particles, which leads to next question - is that the only way to avoid overlapping particles or is there a smarter way?

JohnnyRandom
06-21-2010, 08:29 PM
Have you tried using the Birth Grid + Restrict Mesh By Volume? This will cull all particles outside of the chosen geometry object.

I am not sure how you are birthing your particles.

If it is by surface you could assign a particle per vert or by face center. I guess it is really dependent upon you ref geometry

Bobo
06-21-2010, 08:52 PM
I don't see why you wouldn't be able to store more than one target position value per particle - as JR suggested, the particleMatrix channel could be used, as well as all 99 Mapping Channels which on top of that have the same Point3 format. All you need to do is add a Script Operator in each event just before the FindTarget Test and copy the content of the desired Mapping channel or Matrix row to the particleVector channel which is the only one visible to the FindTarget Test.

That being said, you could generate fresh values when the particle enters an event with a FindTarget operator and overwrite the previous particleVector channel - is there a specific reason why you want to have them all available at the same time?

designit
06-22-2010, 03:20 PM
Thx for the answers, thrilled about having pflow experts of your capacity in the thread :)

What im after is being able to do this http://vimeo.com/12516848 ( made w c4d ) in pflow
Having some particles fly onscreen gradually forming some letters, hover a bit and look cool, then gradually fly off forming some other letters. Particles should live and move a bit while forming text, and use dynamics so theyre able to intercollide.

The reason I need them in a variable is that find target doesnt distribute particles properly for dynamics ( lots of intersecting particles, im using box#2 physics ), because of that i start my flow with a regular birth op, then one event per target which inside distributes particles with positionObject op, those positions i need to store somewhere for later use with find target, right now im doing it with custom arrays in a script op. Later I then copy data from array to vectorchannel to get acces from find target op.

Finding targets works with the arrays but havent tested it with high particle counts.
Perhaps it would be quicker to use the mapping channels your mentioning bobo? But im not sure which channels youre referring to and how to access them in a script, could I have you elaborate a bit on that?

Remaining issues:
- Placement of particles without overlapping particles, Im a bit fuzzed about seperation in pos op being so ineffective.
Will try JR's vertex select approach tonight, would be nice to be independant of vertex counts though, makes it less parametric imo.
- Keeping target object readable while having particles move around a bit, ive tried lock/bond, physX glue with a wind warp w turbulence, but havent achieved a cool enough result yet, so any other approaches would be welcome

That was a shitload of info - i know :eek:
Will work on it some more tonight

br

Christian

JohnnyRandom
06-22-2010, 08:43 PM
As for emission from geo, Bobo whipped up a great random distribution across faces:

http://forums.cgsociety.org/showthread.php?f=206&t=885948

As for the 99 Channels, I too am a bit confused, ever since they added KCMs to Krakatoa, this is something that has been mulling around in the back of my mind, not real sure how to go about it. I read the blurb in the maxscript help (Channel Info: interface) but it is not real in depth and think I am getting sidetracked. I understand the premise for geometry, selections, and maps.

Hmm, just think I figured something, the particle interface .useMapping channel.

by jove :)

setParticleMapping <index>particleIndex <int>mapChannel <point3>mapValue

...tip of the iceberg there

designit
06-23-2010, 10:13 AM
A quick update

My position storing didnt work that well afterall, array.count seems to go beyond number of particles as if values gets appended twice, but it changes
Tried to put the append-code between the init-handler instead but that didnt work at all, no values gets stored, any ideas?
Attached pflow view for reference

on ChannelsUsed pCont do
(
--pCont.useTime = true
--pCont.useSpeed = true
pCont.usePosition = true
pCont.useVector = true
pCont.useTM = true
)

on Init pCont do
(
global t1 = #()
)

on Proceed pCont do
(
count = pCont.NumParticles()


for i in 1 to count do
(
pCont.particleIndex = i
pCont.particlevector=pcont.particleposition
append t1 pcont.particleposition

)
)

on Release pCont do
(

)

designit
07-11-2010, 01:16 PM
Managed to make it work properly!
Test video (http://vimeo.com/13243710)
video slightly influenced by soccer world cup ;)

For storing of target positions I used particlematrix channel as advised by bobo, worked way faster and more reliable than my previous array approach.

Used lockbond together with box#2 switch operator to have dynamic colliding particles that still stick to target - gives a lot of nice motion inside the symbols.

Think a nice advantage of having positions stored is the possibility to build up the symbols from a direction by passing particles to find target with a script test which tests fx event age to particlevectorchannel[1] value to have particles gradually build up from x-axis.

http://forums.cgsociety.org/attachment.php?attachmentid=154735&stc=1



First store script

on ChannelsUsed pCont do
(
pCont.usePosition = true
pCont.useVector = true
pCont.useMatrix = true
)

on Init pCont do
(
)

on Proceed pCont do
(
count = pCont.NumParticles()

for i in 1 to count do
(
pCont.particleIndex = i
temp = pCont.particlematrix
temp.row1=pcont.particleposition
pcont.particlematrix = temp
pCont.particlevector=pcont.particleposition

)
)

on Release pCont do
(

)


Test script

on ChannelsUsed pCont do
(
pCont.useTime = true
pCont.useEventTime = true
pcont.usevector=true
)

on Init pCont do
(

)

on Proceed pCont do
(
speed=1
count = pCont.NumParticles()
for i in 1 to count do
(
pCont.particleIndex = i
nr=pcont.particlevector[1]

if (pCont.particleEventTime/speed) > nr then
(
pCont.particleTestStatus = true
pCont.particleTestTime = pCont.particleTime
)
)
)

on Release pCont do
(

)

StevieMac
07-12-2010, 11:59 AM
Great work Christian! I'm doing a simpler version using bricks for the last few months only you seem to know what you're talking about ;0)

Can you post the script you used to Gradually Send Off the particles?
Could you explain what you put in the other scripts like in Target2 to Vector etc

Thanks mate, I'm hoping I'll be able to grasp some of the answers in mine through yours.

designit
07-12-2010, 02:02 PM
thx steviemac - I will send you maxfile when I get home from work!

okay maxfile attached

DrWeeny
07-12-2010, 03:17 PM
Hi,

I am in the same case of StevieMac, if you can post the maxfile on the thread ^^'
(I am trying to do the credit of a film with dissolving and reforming effect but i didn't achieve it in a single pflow....)

Thanks

StevieMac
07-12-2010, 08:25 PM
Thanks Christian!

JohnnyRandom
07-13-2010, 02:01 AM
That came out pretty good :)

StevieMac
07-13-2010, 04:09 PM
I found this today its the same thing really.
http://cg.tutsplus.com/tutorials/autodesk-3ds-max/assemblydisassembly-with-particle-flow-in-3ds-max/

CGTalk Moderation
07-13-2010, 04:09 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.