From the course: Cinema 4D: X-Particles and Redshift Techniques

Data decisions and caching

From the course: Cinema 4D: X-Particles and Redshift Techniques

Start my 1-month free trial

Data decisions and caching

- [Instructor] Now that we've set up most of our simulation, let's take a minute to decide on what data we want to pass through to Redshift before we get into shading. Once we've made these decisions, we can go and cache out the whole simulation to make sure that we have smooth playback and can scrub through the timeline as we're doing our loop development. The first thing we want to do is make sure that our particles have the right color of data being passed through. So I'm going to go and play back my scene a little bit and right now, we had already set up our initial particles to have this random black and white gradient. Let me go ahead and just walk through that one more time. So if we come up to our initial group, we change the color mode to gradient random, and then set the gradient color to a black to white ramp. So now each one of these particles is pulling from a random location along that gradient. The next thing we want to do is check on our spiral particles. What I want our spiral particles to do is have their color controlled by the speed that they're moving at. Unfortunately, Redshift does not have access to this data, so we need to go and set this up within X-Particles. We're going to do that by going to the spiral group, changing the color mode from single color to gradient parameter and then making sure that that gradient parameter is set to speed. I might go and change the gradient color right now just so that we can see what's actually happening. And then, down here under the gradient parameter, we can either set this to auto where it auto detects how fast he particles are moving, or we can set it manually using the minimum and maximum values. I'm going to leave it at auto for now and see what it looks like. Let's go and play that back and now you can see our particles are changing color based on how fast they're moving through our scene. That's exactly what we want, so I'm going to go and change this parameter back to a black to white gradient and the reason I'm doing that again is so that we can map these particles across a new ramp in the Redshift nodes. This allows us to have more freedom at render time to change the colors and change the value of these particles as we need to and that way, we don't have to rerun the simulation and cache out again. Now, for the incubating and infecting particles, let's go and play further through. And get those to where they're starting to get affected. We're not going to have to change much here in X-Particles because we're going to change most of those color values within Redshift. So right now, if we zoom in over here, we can see that our incubation particles are this blue color. We're just going to change that color to something a little bit more pleasing and easy to see. And then the affected particles, I'm going to leave as is. The incubating particles, we're not going to be changing color based on any data. The infected particles, we actually will be changing the color based on the age data. So as the particles age, they're going to fade and kind of die off and we can actually access that data directly in Redshift. So we don't need to change anything about those right now. Another thing we need to check on is our trails. Now, there's a bunch of different ways to render trails out. For right now, we're going to pretty much leave these as is, I just want to make sure that these trails are taking on the particle color and not the pervert text color. So if I select the trail and then come down to the object tab and make sure that the trail color mode is set to particle color, we're good to go. We'll have quite a bit more control over the trails within Redshift, so we don't necessarily need to set everything within X-Particles in order to gain the access to that data. The last thing we need to do before caching is go through and adjust our group IDs. Once we get into Redshift, we're going to use our group IDs in order to control which shaders are applied to which particles. So I just want to make sure that those numbers are correct right now. Our initial particles are set to group number one, which is good, that's what I want. The spiral particles are currently set to group number two. I'm going to go and change that. I'm also going to drag this group down to the bottom just so I can tell easier which number is what just by looking at it. I'm going to change this group number to group number four for the spiral particles. And now I'm going to go back to the incubating group and change it to number two and the infected group and change it to number three. So now, my initial particles are group one, my incubation particles are group two, infected are group three, and the spiral particles are group four. So now that we've covered our bases on all of the particle data that we need, it's time to go and cache this in. Caching is going to allow us to play back in near real time and scrub the timeline back and forth as we're in our loop development phase. If you've never used the cache object before, I'd recommend taking a look at the caching simulations chapter in the X-Particles 4 for Cinema 4D Essential Training course. In this course, we're just going to touch briefly on the requisite options. So let's go and get this started up. In order to get a cache object, we just need to come to other objects, come down and choose the drop down and choose XP cache. From here, we're going to get a bunch of options. Our particle format is going to be X-Particles. We do have the option to export for RealFlow, Houdini, or many other softwares, but we just need the X-Particles data. The cache type is going to be external files. We're going to save this out to a fast drive. I suggest an SSD or an M2 drive in order to keep up with the needs of the cache. We can also select internal memory, but this saves the cache files into your Cinema 4D project and can bloat your project to be a massive size. So we're just going to leave it at external files for right now. I'm going to go and choose my folder, which is my D drive, and I've made a folder for my X-Particles cache on that drive and what's going to happen is it's going to rename this cache to my scene name and then also it's going to name each individual element as the element that it represents, such as each emitter and each trail. From there, another good thing to check is the inclusion. Now, cache files can get pretty large pretty quick, so it's a good thing to only cache out the elements that you absolutely know you need. I already know that we don't need sprites, skinners, web maps, the spline mesher, the fragmenter, cloth, or shadow. I'm going to go and leave the rest of these as is for right now because I know what we'll need some of that data later on. So now that we've got everything set up, we can go and run our cache. I'm just going to click on build cache and it'll get started. Knowing what data to use and how to cache it is key for large simulations. A good preplanned workflow can make all the difference when it comes down to crunch time on a large project. Making sure that your cache data and all of your X-Particles data is set up properly before render time can give you a lot more flexibility in the long run.

Contents