Would be great if we could sample a data channel at a current point in time or particle age, as a way around the history independence. I have a situation in which I need to sample a value from a channel, at a certain point, and keep it, proves difficult to do
If you have the Reference Position in the main system which contains the positions on frame 0 of each particle on the current frame, you can
*Create the second Reference system for sampling with the same TM.
*Use the NearestParticle operator with Lookup Point set to the Reference Position converted to World Space.
*Pass the ParticleIndex output of the NearestParticle to a ParticleQuery and sample the channel.
Of course we assume that the Reference system is static, so each reference call from the main system will be performed on the same data - no way to specify a different time right now.
That’s something on our list, probably right behind being able to sample the other particles in a stream instead of just the current one. I’ve avoided it so far because its really easy to eat up all your memory when loading all the particles multiple times like this.
This can be achieved currently though, by making two PRT Loaders. The main one loads the “current” frame’s particles, and the other loader has the same files but uses the frame offset to load a previous (or future) frame. Then a Magma modifier on the main loader can refer to the particles of the second loader using existing operators but it is in effect sampling a previous time.
If you just need offset time, what Darcy says would work great, but if you need to accumulate, then you’d have to either write the particles out each frame or have all of your frames evaluated at the same time. Like for 50 frames you would need 50 PRT Loaders, each with an instanced MagmaFlow that was reading in the previous one’s data. It would probably work.
Darcy, that would work, and I tried it, but unsuccessfully. In my case, I generate UVs from position of moving particles, and I need to generate them at a certain frame, and keep them. I thought that if I cache out the particles with their position and ID at a reference frame and just load that frame in a second PRT loader, I’d be able to connect the two with Magma, but connecting the ID channel of the moving ones to the index input of a particle query node (the only particle sweeping input I see) didn’t give me the right connection. Would be great if this can be tweaked to work!
The Magma geometry operators all use the particle index as opposed to the particle ID, so that is what is causing it to fail. The only way this will work for you (until we add more features) is if you don’t delete and particles and if they are in the same order on each successive frame.
I have successfully referenced another system and replaced a whole data channel with a ref. systems channel. I used something like InputParticles->ParticleQuery nodes. It is somewhere in the beta forum. As Darcy said you would need matching index or at the least I supposed you may be able to match via a custom integer channel? maybe