Notifications
Clear all

[Closed] Script Operator – Avoid calculations from frame 0

Hello,

I wrote a crowd script for PFlow in a Script Operator. 
The  Script just snapshotasmesh objects at time ParticleAge (to get their  shape at this time) and apply the mesh to particle shape.
I need to generate 2000 particles for an animation of 100 frames.
 My script is in the Proceed statement.

If  i launch a render from frame 0 the render goes correctly with 3 min  render time for a frame. But if i launch the render in the middle of the  animation, for example, from frame 50, the first frame take 1 hour to  generate the particles and render. After the following frames (51, 52,  53, etc..) render at 3 min/frame.

I think that PFlow calculate  the script from frame 0 to 50 to generate the frame 50 before render it  and after use the calculation of frame 50 to generate the frame 51,  etc...

Is there a way to avoid this calculation (frame 0 to 50) and calculate directly the frame 50 ?

Thank you for your help.
5 Replies

So i found that if i put my code in a birth script, the time to generate the particles significally decrease by 4. It’s a great thing but the PFlow system continue to generate from frame 0 if i go in the middle of the animation.

Anyone knows if there is a way to avoid the calculation from frame 0 ?

Cant you simply have a check around the code where you snapshot the mesh, and then tell it not to snapshot if frame < 50?
Pflow needs to do the simulation from frame 0 to know what result it should have at frame 50, it cannot ‘instantly’ know what the result should be if it does not simulate, but you can speed it up by not doing the snapshoting before you need it.

1 Reply
(@veenibiz)
Joined: 10 months ago

Posts: 0

Thank you very much. i didn’t think about that.
I’ll test it. I can test the .particleAge value to know when i’am in the animation.

Could you Cache the Particle flow before rendering ?

1 Reply
(@veenibiz)
Joined: 10 months ago

Posts: 0

Oh god ! I forgot the cache system . Thank a lot for your help.
So i will test it to see. I think that the size of the file will be large for 2000 particles.