Jump to content
Sign in to follow this  
ParticleSkull

Set Initial State

Recommended Posts

Hey guys, 

It's the first time that i'm trying to save a initial state of my sim. In this case i'm working Grains.

What I did was: create my grains from a sphere and simulate it until it set on the ground. Now i need to keep it like this, like a initial state, to work on my real scene.

My first idea was to save this grains' specific frame as a bgeo and load it back with a file node but, right now, this loaded grain particles don't interact with the other objects anymore. 
I think that the problem is on importing this back with a file node. Not sure though. 

Thx again,

EDIT: So in case that anyone else got the same doubt, i've just recorded a tutorial about it:



Best,

Alvaro Edited by ParticleSkull

Share this post


Link to post
Share on other sites
Guest tar

Initial States use .Sim files - if you're still on Apprentice then it won't work.

Share this post


Link to post
Share on other sites

Ah yeah, that's me there. 

It's basically the same post, the only difference is that I said that a friend (which is you) told that it's impossible to create a initial state with apprentice.

Thx man,

Alvaro

Share this post


Link to post
Share on other sites

Hi, I don't know if anything changed in H14 but in H13.0.582 you can save init states (sim) files at least for RBD in Apprentice.

 

Just add File DOP at the end of your dop net and set it to the Write mode.

 

Look at attached file.

save_init_state.hipnc

Share this post


Link to post
Share on other sites

Hey Petr, 

I have just opened your file and i think i got what's going on there. Altough I couldn't make it work properly.

So, there's a node to save the initial state and another one to load the sim back. However it looks like it's saving all the simulation frames so, when i load it back, it's just playing back the whole simulation again (cached this time). Is there a way to load one frame only, in this case the frame 50 where the torus is settled on the floor, and keed it dynamic so it can interact with other objects?

Thx man,

Alvaro

Share this post


Link to post
Share on other sites

Yes, the File DOP will save all frames.

You will not load it inside DOP network via File SOP, but you will choose one frame, that one you want as initial frame and set path to this frame/file in the Initial State parameter on DOP Network.

Then set display flag inside DOP Network above that File SOP so you will not overwrite your initial state.

 

 

Just quick ask to google gives me link to this tutorial, same workflow for particles:

https://www.youtube.com/watch?v=CmE_EXRZ2ck

Share this post


Link to post
Share on other sites

Thx Petr, just gave it a try, with no success though.

It look's like i'm doing something wrong so i've just recorded a video showing my steps. Have a look on it if you have some time:



Best,

Alvaro

Share this post


Link to post
Share on other sites

Hi, DOPS are little bit different then sops. If the node is in the context it still can be calculated even if it's not in chain.

 

Basically when you disconnected the File DOP, you kept it active, and in Write mode, but it hadn't any input, so when you started new simulation it wrote empty file immediately and overwrote your initial state.

 

Try to disable that File DOP, set it's mode to No Operation or delete it before you leave dopnet to set up Initial State.

Edited by pezetko

Share this post


Link to post
Share on other sites

Great! Now it's working just fine! 

Thx Petr, now if you don't mind, i would like to go a bit further.

I have my initial state, the fragments are on the floor but now I want to add another dynamic object on the scene, to interact with the fragments.
Since it's reading the initial state sim file, it look's like that the AutoDopNetwork doesn't recognize new objects. Do you have any idea on how can I work with this?

Thx,

Alvaro

Share this post


Link to post
Share on other sites

Nice, :)

Instead of specifying Initial State for whole dop network you can just initialize only some dop object.

 

E.g. in attached file:

1. I created active rbd sphere, make that breakable and simulated.

2. When I was satisfied with the look I save the sim file that way I showed you (with File DOP set to write) (after it's saved I set File DOP to No Operation)

3. Then I decided I want to add Torus into the simulation. I created Torus SOP, made it active RBD with help of Shelf tools.

4. Then I setup File DOP to "Load" mode and set up switch (with $SF==1) that is switching between Initial State and simulated object. That way it can continue from saved state but also interact with new objects.

merge_sim_init_files.hipnc

Share this post


Link to post
Share on other sites

Hey Petr, I hope you still around.

Do you know what the $SF==1 really means? I know that SF stands for Simulation Frame. Altough, why's the == for?

Share this post


Link to post
Share on other sites

Thx again Petr, you're helping understand it a lot.

I have also noticed that, when i'm working with a static (and animated) object, i have to add the Switch node between the File node and the Groundplane node.

It works just fine like this, but i would like to understand what's going on there.
My doubt is why the File node must be switching with the Groundplane node. It's just because it's on top of the chain, maybe?

 

here's an image showing exactly what i'm talking about:
https://www.dropbox.com/s/2iq51m0y0bhonbl/switch-node.jpg?dl=0

I'll record a tutorial about this technique in case anyone have the same doubt and it'll have a great special thx to you.

Best,

Alvaro

Edited by ParticleSkull

Share this post


Link to post
Share on other sites

Could you upload and example?

With that swith you are loading simulation data for that object on the first frame (only for the first rame as it's defined with that expression) and then you let simulation to compute the rest by allowing update object's data (instead of constant fetching saved init state).

Share this post


Link to post
Share on other sites

Yes sure, it's here: https://www.dropbox.com/s/h307mup4cbv29i9/HeavyBakeSim.rar?dl=0 (The initial state file is already inside the sim folder)

 

So, with the $SF==1 the Switch node will first use the File node and, as soon as it goes to frame 2 (which is not == to 1), it keep going with the rest of the sim, ignoring the File node? (just forget about it)

EDIT: I've just realised how the Switch node works. So, =Tube and 1=File node. Then, if SF=1 switch to File node. If SF≠1 switch to Tube. Right?

Best,

Alvaro

Edited by ParticleSkull

Share this post


Link to post
Share on other sites

Yes.

 

For your file: I put File Write DOP behind RBD Solver before merge1.

Then in File Read DOP I checked Match By Name. That way it doesn't need the switch for Groundplane.

See the attached file.

HeavyBakeSim.zip

Share this post


Link to post
Share on other sites

Great!! Much easier like this (altough i didn't really got what happened in the Match by Name but, whatever.) :)

Now i'm ready to record the tutorial. Thx Petr!

Edited by ParticleSkull

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
Sign in to follow this  

×