Jump to content
Screenglow VFX

Loop and save particle sim over a number of curves

Recommended Posts

Hi guys,

What would be the best approach in order to sim multiple particles simulations (save to disk) ;particles needs to follow a bunch of curves (one curve at a time)? I have,let's say 10 curves (each curve is driving particle path) and I want to save the particle sim on disk without manually plug each curve into dop to generate the particles? I am talking about saving to disk process,not dop setup.

 

Tks

Share this post


Link to post
Share on other sites

Here is how I would approach this:

1. Draw out 10 curves. This will give you 10 primitives. Make a merge node and connect them all in there. After that, connect a null and call it something like "REF_ALL_CURVES" 

2. Make a primwrangle. Create an attrib called something like "prim_id" and make it equal to primnum (i@prim_id = i@primnum).

3. Make a Null and call it something like "CONTROL". Add an int parameter to it called "cluster" or "wedge" 

4. Put a blast node and in the "group" parameter, set it to @prim_id==`ch("../CONTROL/wedge")` and set the entity to "primitives" and "delete non selected". This will isolate one curve at a time

5. Drop another null as a reference point and call it like "REF_CURVE" so you can easily point to it later

6. Do your particle sim as normal. For the curve input, point it to that REF_CURVE null

7. Do your DOP import however you wanna getting the particles out of DOPS. After that lay down your cache node. 

8. Inside a ropnet, or the /out context, put a wedge ROP. Uncheck random samples, and click the + sign to add a wedge parameter. Inside "channel" point it to the parameter on the CONTROL node you made in step 3. Set the range to be 0 to nprims("../path/to/REF_ALL_CURVES")+1 . This will keep it nice and procedural. 

9. In the cache node, make sure to change the file name! Pick whatever directory you like, but make sure to add $WEDGENUM to it so it will write different sims! Here's an example of a path:

    $JOB/geo/magicdust/v001/magicdust_particles_v001_$WEDGENUM.$F4.bgeo.sc

10. On the wedge rop, hit "render wedges". Check the directory to make sure it's all working...

11. To bring them back in, just make a for each (number) loop in sops. Connect a file sop to it.  There should be a 3rd node, the meta import node, which I usually rename to "m" for shortness.

12. In the file sop, construct the same filepath, but instead of $WEDGENUM, do the following:

    $JOB/geo/magicdust/v001/magicdust_particles_v001_`detail("../m", "iteration", 0)`.$F4.bgeo.sc

 

This will load all your sims back in!

 

Good luck! I hope I explained it okay. 

 

 

 

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×