Join Andy Needham for an in-depth discussion in this video Caching in X-Particles, part of X-Particles 3 for Cinema 4D Essential Training.
- In this movie we're going to learn about the cache objects. I think it's an really important part of the X-Particles work flow. Especially, when working with fluid simulations because without cacheing, there is no way of ensuring accurate visual playback. We will create a system. We are going to use a bit of turbulence. And I'm going to hide that fall off. So when we scrub, we're not getting accurate playback.
We can solve this with the cache object. Allow the cache... and it's really smart by, if you look at these inclusion objects, it's going to see what we have in our system and it will automatically create a X-Particles cache tag on each of those objects. So, back in the object here. I'm just going to choose to build the cache, and it's going to go and do its thing. Now when we scrub through, we're going to get accurate playback.
Speaking of the playback, we can scale down, so we can make it a lot slower. Very similar to if you were using the retiming settings here, but we're just doing it on the cache. We can make it twice as fast for example. One more thing that I think is pretty cool about this section is the local coordinates. If I move the emitter now and just press play, we're getting our particles emitted from where it was first cached.
Let's just turn on local coordinates and that's going to look at where the emitter is and it will just jump the particles over to where that is and we can move it around. Bring this back to where it was. Okay, back on the cache, just going to check this. We have a lot of information about what's been cached. You can see how many elements there currently are, the number of frames cached, the memory, disc spaced used, and time to complete.
Caches can get very large in file size, especially if you're creating fluid sims with hundreds of thousands of particles. And it's important to understand you can choose what data the cache records. So, we can limit the size of the cache. Currently it will record all data. The basic is just the particle velocity, and you can customize this too using these settings. Whenever we make a change, we'll have to recache the sim. Otherwise we won't see those changes.
I'm going to add a large amount to the cache here. Give it something to do. Let's just keep an eye on the time to complete. So I'm going to overwrite the cache. If we stopped in the middle we could choose to continue, or we could also choose to create a new cache, or just cancel this altogther. Let's overwrite what we've done. You can see with more particles, more disc space is being used. And this took about seven seconds to complete.
Just going to look at the display settings here. With it enabled, it's going to show everything: particles, geometry, the lot. With no particles we're going to just get geometry. If we've got that cached, and with reduced. We can reduce the number of particles displayed using this level of details slider. If we look at disabled, this is going to turn off all particles and geometry. How could this be useful? Well, if the emitter and generators do not need to be joined in the view port you could potentially reduce the time taken to complete the cache.
So, we'll just build again. You see nothing is updating in the view port. Here we go, we've just shaved off some time here. This can scale up considerably over a longer sim. Let's open up a file that I have made previously, and if your opening this up for the first time you might get an error saying there is a missing cache. What we want to see is the effect of this bucket of water pouring out the fluids here.
It's important you can know how to load in a cache. We can just press this button here and locate our cache in the project files. And just open the group folder and it will assign a tag or it will update the tag on the emitter in this example. Then everything should just play back normally. Cause we've got the cache set to external, that's why the file is going to be written to the folder. There's different types. You can have a look a those as well. The default is obviously going to be X-Particles. If you're changing this a lot, every single project, you could use the X-Particles preferences.
Command D to get to those. Down at the bottom we've got some cache defaults. We could choose external, or internal for up files. I always choose external just cause I like to keep them out of the file, and I don't want to run out of any memory. With the default folder, if you're team rendering you can put that onto a network volume, which all the computers could access. Finally, let's bring back in the simulation that we created previously, and we'll cache that.
So, going through the whole process. We're going to create a cache object, and just build it. We've got quite a lot of frames here. I'm just going to reduce that down. I know we don't need to see that much of the cache. So, we'll just build it, and like I said you can cancel at any point. We know that we've got 26 frames cached, so we can quite easily scrub up to that point, and we'll see what's happening if we continue to play the... X-Particles will just keep calculating from that point on.
We can build the cache and just choose to continue from the point that we stopped. And there we have it. So, the cache object enables accurate visual playback of simulations by storing particle data on disc. The other benefit of using the cache is pretty much essential for network rendering. If you're using Team Renderer, you can ensure continuity in the rendered frames since all machines are using the same cache. You really don't have to cache your simulations everytime, but, by doing so, it allows you to scrub backwards and forwards in the timeline. For complex sims, you can run an animation once, and then play it back using the cache, which will generally save you a bit of time, with the benefit of that accurate playback.
Now we understand what the cache object is and how to use it, we can move on to creating more complex simulations such as fire and smoke sims, where cache is essential.
- Working with the Emitter tabs
- Adjusting particles with modifiers
- Creating visible particles
- Using sprites
- Colliding, freezing, and lighting particles
- Caching in X-Particles
- Applying constraints
- Adjusting materials settings
- Sculpting particles
- Saving and loading presets