Tag Archives: technology

scriptDAT | Tips and Tricks | TouchDesigner

If you spend lots of time setting up parameters in your UI elements and want a faster way to use a set of presets to populate some parameters, then the Script DAT might be just what you’re looking for.

Let’s look at a fast simple example that might have you re-thinking how to quickly set up pars in a project. Keep in mind that this won’t work in every situation, but it might work for an awful lot of them and in ways that you might not have expected.

To get started let us imagine that we have a simple set-up where we have a UI element and a display element. We want a fast way to quickly update their parameters. For the sake of this example let’s imagine that we do not need any fancy scaling or changes on the fly. This is going to be used on a set of displays where we know exactly how they’re going to display. We might think about using storage to set and pull parameters, but you might be hesitant to use too much python for those bits and bobs. Okay, so exports it is… they’re a little more cumbersome to set up, but they are much faster – fine.

Sigh.

I guess we need to start setting up an export table, or a constant CHOP and dragging and dropping all over creation. Before you do that though, take a closer look that is the majesty of the Script DAT:

The Script DAT runs a script each time the DAT cooks and can build/modify the output table based in the optional input tables. The Script DAT is created with a docked (attached) DAT that contains three Python methods: cook, onPulse, and setupParameters. The cook method is run each time the Script DAT cooks. The setupParameters method is run whenever the Setup Parameter button on the Script page is pressed. The onPulse method is run whenever a custom pulse parameter is pushed.

Maybe we can use the Script DAT to make an export table for us with just a little bit of python.

We can start by putting a few things into storage. Let’s create a new dictionary but follow some simple rules:

  • The keys in this dictionary are going to be operator names or paths
  • Each operator is itself a key for another dictionary
  • The keys of that dictionary must be proper parameter names
  • The values associated with these keys need to be legal entries for parameters

Okay, with these rules in mind let’s see what we can do. Open up a new project, in project1 let’s create two new containers:

  • container_ui
  • continer_led_display

Add a new text DAT and create a simple dictionary to put into storage, and let’s follow the rules we described above:

Alright, so far so good. Now let’s add a Script DAT.

We’re going to use our Script DAT to look at our stored vals and create an export table on the fly for whatever is in the storage dictionary “attr” – easy.

Let’s edit our Script DAT to have the following contents:

Finally, let’s turn on the green export flag at the bottom of our Script DAT:

script_dat.PNG

And just like that we’ve set-up an auto-export system. Now every time we update our dictionary run our script to put the contents into storage we’ll automatically push those changes to an export table.

Looking for an example to pull apart – head over to github and download a simple example to look over.

TouchDesigner Concepts for Projection Mapping

This coming year at ASU I’ll be working on a project with several talented artists and media Makers on a project that’s tentatively being called “WonderDome.” As Dan Fine’s thesis project he’s exploring what it means to create a playing space that exists inside of a dome of projection. The audience and performer will share a single immersive media environment where a story will be told with puppets, video, and just about all the theatre magic you can imagine. Central to this endeavor are questions about immersive media systems and how to approach the complex issue of mesh warping media for a curved surface that’s being ditched together with somewhere between six to eight projectors.

The traditional approach for this kind project would be to make the flat media first. After creating the structure, and installing the projectors we’d create a sample mesh-warped After Effects Comp and ultimately run all of our flat media through that comp to split it up into several pieces with the appropriate distortion applied. While that’s certainly a tried and true method it doesn’t leave much room for error, and it also makes it difficult to use live video.

On our wish-list of media systems is a d3 media server by d3technologies. While their systems may well be out our price range, their approach is one that’s gaining traction in smaller projection circles. We can pull apart some of the same process by working with Derivative’s TouchDesigner to get a sense of how we may well be thinking of projection mapping in the not too distant future.

Instead of waiting to get onsite, or crafting media specially fit for a particular structure, we instead start with a 3D model. In our computer generated model we add projectors, lights, paint our surfaces with textures or video, effectively assembling our system virtually.

The videos below take a quick and rough look at what this kind of workflow looks like in TouchDesigner, and how it differs from the kind of projection mapping you may already be accustomed to.

Edge Blending

Geometry and Cameras

Putting it All Together