In my last post, I talked about how the Engine COMP is one of the features I was most excited about in the new 2020 release of TouchDesigner. It has the power to revolutionize how we approach building projects of all sizes. A simple explanation: the Engine COMP allows you to choose what parts of your project run on separate CPU processes. This means in the soon future you won’t need to make a bunch of separate TouchDesigner apps for audio elements, heavy web requests, or similar processes. Sounds exciting? Let’s dive in!
The first thing we need to do is setup our TOX file. The Engine COMP works by loading a TOX file you’ve saved to your drive and then it runs it in the TouchEngine. TouchEngine is a system that allows TouchDesigner components to be embedded in other systems. It’s still quite new but you can almost think of these in the same way Notch Blocks work. So the first thing to do is take all the things you want to run in the Engine COMP and put them in a Container COMP. This can include everything from scripts, SOP workflows, CHOP networks, TOP processing units and rendered scenes, and more. To do this, you should move your work into a Container COMP, then right click on the container and click “Save Component .tox”:
I think it’s still early days for the Engine COMP, so you’ll have to experiment with what won’t work well inside of it. For example, you may not want to put direct hardware connections inside of the Engine COMPs (such as Kinect CHOP) as those might be better fitted to be in your main project. So now that we’ve got our component saved, let’s loda it up!
Load up the ol’ engine
Loading your component into the Engine COMP is a piece of cake. All you have to do is point the Engine COMP’s path to it and then hit reload. Once you do this, it’ll take a moment for TouchDesigner to spin up a new process of the TouchEngine that will run your component in the background. You’ll know it’s ready and working once the warning flag disappears from the component.
So now our component is loaded up and running on another CPU process…but we can’t go into it if you try to zoom into it. And how do we actually get data in and out of the Engine COMP? One of the drawbacks with the Engine COMP is since this is now a separate CPU process, we can’t just dive into and start editing the network. Luckily for us though, Derivative have implemented ways for us to easily communicate with the other process.
Inputs and outputs
You’ve got your work inside of your Container COMP and you’re getting ready to load it into the Engine COMP, but you’ve got one problem…how do you get data in and out of the Engine COMP? You’re in luck, there are 2 ways to do this. The first is using the In and Out operators from the CHOP and TOP family. Those two families are integrated natively into the Engine COMPs workflow. If you make a TOP input and CHOP output inside you container before you save it, those inputs and outputs will automatically appear on the Engine COMP when you load the TOX file. Let’s add an input and output to our container so it looks something like this:
Then let’s watch what happens when we reload our Engine COMP after saving the TOX again.
Pure magic. The TOP input and the extra CHOP output are automatically created. These act exactly like the regular inputs and outputs we’re used to, but behind the scenes they’re doing something quite special, which is that they’re communicating between CPU processes without us having to do any extra work. In this way, you can send all kinds of TOP or CHOP data into an Engine COMP. The other families of operators aren’t integrated into this workflow yet, so if you need to send SOP data, you’ll need to either convert that data into CHOP or TOP format, or alternatively setup your own communication pipes such as UDP or TCP/IP or similar.
Get Our 7 Core TouchDesigner Templates, FREE
We’re making our 7 core project file templates available – for free.
These templates shed light into the most useful and sometimes obtuse features of TouchDesigner.
They’re designed to be immediately applicable for the complete TouchDesigner beginner, while also providing inspiration for the advanced user.
Controlling your engine
While those two methods of sending data in and out of an Engine COMP are great, there is another method for sending control data into your component. That method is through custom parameters. One of the really great things about Engine COMP is how it deals with custom parameters. If you make custom parameters on your component using the Customize Component menu, the Engine COMP will inherit them automatically. Let’s quickly make 2 parameters on our component:
Now let’s watch what happens once we load this up in our Engine COMP…
If the automatic inputs and outputs wasn’t magic enough, inheriting custom parameters from the component being loaded into the Engine COMP is definitely magic. If you then used something like a Parameter CHOP or other method of accessing the data of your parent custom parameters, you’d quickly be in business and using the custom parameters to control the network on the other CPU thread. Even reading that sentence back to myself brings tears to my eyes.
With that said though, that’s all you really need to know to get started with the Engine COMP. There are tons of other features behind the scenes you can tweak and different ways you can structure your projects. I’d highly suggest reading the Wiki page for the Engine COMP for more of those details. I’m sure to be writing more about it soon.
I can’t stress how excited I am about this new feature. It’ll make life a lot easier in many ways on projects big and small. I hope the steps I’ve outlined here make it easy for you to get started in your experimentation with the Engine COMP. Don’t forget that this is still a new feature so make sure you test it thoroughly before deploying a project and if you find any bugs, please report them on the Derivative forums. Good luck!