14 - Working with DATs - TouchDesigner Tutorial: Beginner Crash Course — Transcript
Full transcript
- 0:01The next thing we're gonna build is gonna use a lot of DATs
- 0:03And like we said before
- 0:04DATs are the data operators
- 0:07so we can create tables text
- 0:09This is how you would probably work with
- 0:10a lot of web APIs in Python
- 0:13Now for this example
- 0:14what we're gonna do is make a little slider-controlled preset system
- 0:18so that we can drive a text TOP's text
- 0:22as well as the kinda text styles of it dynamically
- 0:26So with that said
- 0:27let's get started here
- 0:29I'm gonna delete everything
- 0:30and the first thing I'm gonna do is make my text TOP
- 0:34So I'll open the Op Create dialog
- 0:37type in text
- 0:38grab my text TOP
- 0:40and then I'm going to want to dynamically drive
- 0:43the text that's inside this text TOP
- 0:47So the way I can do that is first I'll make a text DAT
- 0:52and a text DAT is really
- 0:54you can think of it almost like a little WordPad
- 0:56or a little Microsoft Word without any of the features in it
- 0:59But essentially
- 1:00what you can do is activate the viewer
- 1:02and you can start typing inside of this text DAT
- 1:07and it's basically just gonna save that text in there
- 1:09You can manipulate it later with more DATs
- 1:11You can reference it for different things
- 1:13and that's what we're gonna do here
- 1:14We're gonna use a text DAT
- 1:15as our kind of text storage for our text TOP
- 1:19So like always
- 1:20like I said before
- 1:22before we start referencing any kind of data between operators
- 1:25it's always important to put a null
- 1:27So I'm gonna put a null DAT here
- 1:32And then I'm gonna go to my text TOP
- 1:34I'm gonna delete the text derivative here
- 1:39And then there's a parameter called DAT
- 1:42and essentially what this does is you can reference a DAT in here
- 1:45whether it's a table or a text DAT
- 1:47and then you can select text out of it
- 1:50to basically render in there instead of having to
- 1:52manually type the text inside this parameter
- 1:55So in this case
- 1:56what I can do
- 1:56for this DAT parameter is just drag
- 1:58and drop my null right onto that parameter
- 2:03and you'll see that we can see Can Start Type
- 2:06but it looks clipped on both sides
- 2:08So another really useful feature of the text TOP is on the first page
- 2:12we have Word Wrap
- 2:13which will automatically kind of figure out
- 2:15when those breakpoints are
- 2:17and wrap the text so that you're not kind of getting text clip
- 2:21It's very useful because it's dynamic
- 2:23So for instance
- 2:24if I go back to my text
- 2:25activate the viewer type something else
- 2:29and and and
- 2:31and I click outside of my text
- 2:33you'll see that it tries to word wrap as best it can
- 2:36Now what's happening is it's wrapping the words
- 2:40you know on the uh
- 2:41left and right plane so it's not getting clipped
- 2:43but the text is still so large that it
- 2:45it kind of overflows on the top and bottom
- 2:48So for this
- 2:49another really handy feature of the text TOP is
- 2:51is under the Font parameters to go to Auto Size Font
- 2:56and there's a couple options
- 2:57You can say Auto Fit If Too Large
- 2:59Auto Fit Always whatever you like
- 3:00For this one we'll go with Auto Fit Always
- 3:03That way the text will also dynamically resize
- 3:05so not only is it getting word wrapped on the left and right edges
- 3:08but it's getting resized in case it becomes too big
- 3:12Now with Auto Fit Always
- 3:13the nice thing is if we only have a little bit of text
- 3:15so let me delete most of this
- 3:22It'll also scale it upwards to kind of fill that space appropriately
- 3:26So those are a couple nice things about the text TOP
- 3:28and what we're gonna do is right now
- 3:30if we middle-click on our text TOP
- 3:32we'll see it's two fifty-six by two fifty-six
- 3:35Personally that's a little bit small for me
- 3:36so I'm gonna go to the Common page
- 3:38and I'm gonna update the resolution to be maybe
- 3:40um seven twenty by seven twenty
- 3:46And I'm doing that
- 3:47because essentially what we're gonna do is we're
- 3:48gonna composite this text onto another video
- 3:51My video is is seven twenty
- 3:54so I want a nice square with my
- 3:57text in the middle of that video
- 4:01So with that said
- 4:02what we can do now is make another text
- 4:05'cause let's say we have a few different preset
- 4:07texts pieces that we wanna change between
- 4:10So I'll copy and paste my text a few times
- 4:18And I'll add different text inside of each one
- 4:36Now what we're gonna do is we need a
- 4:38way to switch between these different text DATs
- 4:41and have them go into this null
- 4:43which then gets referenced by our text TOP here
- 4:47So luckily we have a really useful DAT
- 4:49uh we can use called switch DAT
- 4:51So I'll open up the Op Create dialog
- 4:54Switch and what we'll do is we'll have to
- 4:57plug all of these text DATs into the switch
- 4:59and then we can use this nice little index to basically switch between them
- 5:03Now one useful trick is you know
- 5:05normally what you'd have to do is you'd
- 5:06you'd go plug them all in one by one
- 5:09and you'll notice that this switch DAT
- 5:10similar to the composite TOP that we had earlier
- 5:13has a multi input
- 5:15so you can just keep hooking things up to it one by one
- 5:18But there's a nice trick that you can do
- 5:19where if you right click
- 5:20and drag and select all the operators that you wanna connect
- 5:24all you have to do is connect the first one
- 5:26and all of them will get automatically connected
- 5:30So now that we have them all connected
- 5:32we can just look inside of this switch DAT's kind of viewer
- 5:36And as I change that index
- 5:37so you can see one gives me the second one
- 5:40'cause remember everything in TouchDesigner starts at an index of zero
- 5:44I can go to two
- 5:45which will give me the third input
- 5:48and then I can go to three
- 5:50which will finally give me that fourth input
- 5:53So now if I plug this into my null here
- 5:55we'll see that as I change the index
- 5:58the text getting rendered in my text DAT is updating
- 6:01Now if we go beyond our index number three-You know
- 6:05three seven 10
- 6:06doesn't really matter
- 6:07It doesn't change because there
- 6:09there are no more inputs connected to that switch DAT
- 6:13So I'm gonna grab all of these
- 6:14and just move them over a bit
- 6:15because now that we've got our text set up
- 6:16we can work on some of the formatting
- 6:19So the things we're gonna be changing about this
- 6:21text are under the color page parameters
- 6:24And what we'll do is we'll switch up the text color
- 6:27as well as the alpha
- 6:28so that we have a couple of different looks when it's getting composited
- 6:32So very similarly to how we set up our
- 6:34text DATs here going into a switch DAT
- 6:36going into a null
- 6:38we're gonna set up a similar system but with tables
- 6:41And this can be thought of as like a really simple preset system
- 6:44You know it's it's not the most efficient one
- 6:46but if you're a beginner
- 6:47and you're just trying to save a few different states for
- 6:50you know something like a text DAT or maybe movie files
- 6:53this is not a bad system to use
- 6:55So the way to get started is first we're gonna make a table DAT
- 7:00And a table DAT functions similarly to a text DAT except
- 7:04you can add more rows and columns
- 7:05and each cell is essentially the equivalent of a text DAT
- 7:10but inside of a cell
- 7:12So let's say we wanted to have we see here font color
- 7:15we have RGB channels and an alpha
- 7:17So I wanna basically save four values in here
- 7:20So first thing I'm gonna do is activate the viewer
- 7:22so I can interact with the data inside
- 7:25What I can do is either right click on
- 7:27the empty space of this table DAT
- 7:29or I can go and click on the kind of
- 7:32uh row number here
- 7:33which is zero
- 7:34I can right click on it
- 7:36and you'll see I have a bunch of options
- 7:37I can hit add below
- 7:39which will add a new row
- 7:39Now you see I have two rows and one column
- 7:42Like I said I need four values
- 7:44so I'm just gonna keep adding rows here
- 7:46So now that I have four rows
- 7:49I also want to add another column
- 7:50so that way I can actually keep this clean
- 7:52I I wanna have
- 7:53You know I don't want just a
- 7:54table with random numbers in it that
- 7:56you know I'm not gonna be able to identify later
- 7:58I wanna have a
- 7:59a nice little header column and then having a
- 8:02a column with just my values
- 8:04So similarly to how we right clicked on the
- 8:07row numbers itself to add a row below
- 8:09what I can do is go to the columns
- 8:11right click on this column zero
- 8:13and then hit add after
- 8:15which will then add me another column
- 8:19So now what I can do is I
- 8:20can just click inside of a cell
- 8:22and you'll see that I have a cursor blinking here
- 8:23and I can start typing
- 8:24So I'll say color red
- 8:27I'll drop down to the next row and say color green
- 8:34Next color blue
- 8:35And you can even navigate this table with your keyboard arrows
- 8:38so then I can come down here and type opacity
- 8:43And then let's say my first preset is actually just gonna be white text
- 8:47which is gonna be one one
- 8:48one for the RGB and full opacity
- 8:53Now what I can do is I'll turn off the viewer just
- 8:55so that I can actually control the operator in my network again
- 8:59I'll copy and paste it four times for our four presets
- 9:03This way each one of our text objects
- 9:06here will have a preset of its own
- 9:10And then I'll go through and just edit that style a little bit
- 9:12So maybe our second preset is going to be red text
- 9:17so I'm gonna zero the G and the B
- 9:20Maybe I'll leave the opacity full here
- 9:23For my third preset
- 9:25maybe I'll do something like zero point five for green
- 9:33zero point seven for blue
- 9:36and we'll keep the opacity full
- 9:38And then finally
- 9:39for my last one
- 9:40what I'll do is maybe something more subtle
- 9:41so maybe zero point three on the R
- 9:44zero point three on the G
- 9:46zero point three on the blue
- 9:47so that way it essentially becomes a bit of a dark gray
- 9:51And then I'll actually set the opacity also down to zero point three
- 9:53so that it kind of fades into the background
- 9:57Now with all my values edited
- 9:59I can kind of just turn off the viewer active state on these tables
- 10:03And then similarly to like we did with our text going into a switch
- 10:08we'll do the same thing with our tables
- 10:09We'll set up a switch DAT
- 10:13I'll right click and drag around all my tables
- 10:16connect the first one
- 10:18and automatic automatically they all get connected
- 10:22So now the same principle that we used with
- 10:24the switch DAT applies to tables as well
- 10:26which is really helpful because we can see with an index of zero
- 10:29we essentially get the contents of the first table
- 10:32If I set an index of one
- 10:34it switches to the contents of the second table
- 10:37Two gives me the third table
- 10:39and so on and so forth
- 10:43So now we have a really easy way of kind of just managing
- 10:46you know switching between all these things
- 10:48What I'm gonna do is I wanna kind of
- 10:50line up the presets with the text
- 10:53So I'm actually gonna make a little controller that'll control these indexes
- 10:57these indices
- 10:58And what I'm gonna do is use some of the
- 10:59things that we used in our comp section
- 11:01So the first thing I'll do is
- 11:02is just make a little slider
- 11:08And then I'm gonna want this slider value
- 11:10Well let's like
- 11:11let's take a look at the slider value first
- 11:12You know let's let's assume we don't know what's going on
- 11:14so I'll make a null chop
- 11:20And we can see the value of the slider's from zero to one
- 11:23but like we saw with our switch
- 11:25we actually want it to be from zero to three
- 11:29So we know how to rearrange values at this point
- 11:30We can insert a nice little math chop here
- 11:38And I'll go to the range page
- 11:40I know the from range is correct
- 11:41because my slider does in fact go from zero to one
- 11:45and I want the range to be from zero to three
- 11:51Now the only other thing I would wanna do with this
- 11:53just for my own sanity
- 11:54is what you'll see is that
- 11:56my value coming from the slider is actually a float
- 12:00So a float is basically just a
- 12:02a number with decimals in it
- 12:04You know this is different than an integer
- 12:05which is just a whole number
- 12:07Uh floats you know
- 12:08like one point eight four eight
- 12:10That's not gonna be useful
- 12:11for our switch because the Switch DATS don't actually interpolate
- 12:14You can see it just kind of hard cuts
- 12:16between the different indices that are plugged in
- 12:19So what we can do is
- 12:20is maybe we should round our number here
- 12:22as well so that it's not sending decimals
- 12:24so it's sending a whole number
- 12:26an integer
- 12:27that will accurately map to each one of these indices
- 12:30So also surprise surprise
- 12:33our best friend Math CHOP can also round for us
- 12:35So we can insert another Math CHOP
- 12:37after our Math CHOP that does the scaling
- 12:41and then on the first page
- 12:43we have a nice little parameter called Integer
- 12:46We can click on it
- 12:46and you can see we have a f a few different options here
- 12:48We can do a ceiling type of rounding
- 12:50a floor
- 12:51or just a general rounding
- 12:52For this case
- 12:53a general rounding is fine
- 12:56Now you can see as my kind of more gradient float value changes
- 13:02coming out of the output
- 13:04I actually have a rounded integer
- 13:07So now like we did with everything else before we've done
- 13:10if we want to control the parameter of this Switch DATS Index
- 13:15I just select the Switch DAT so I see its parameters
- 13:18I activate the viewer on my CHOP
- 13:21drag and drop that channel right onto the value
- 13:24and I choose Relative Chop Reference
- 13:27Now I'm gonna do the same thing
- 13:28for the switch that I have down here
- 13:30So first I'll select it
- 13:32and then I can just drag
- 13:33and drop that value again onto the index and choose my second option
- 13:40So now you can see as I'm moving through this slider
- 13:43my text is changing
- 13:44We haven't hooked up our style yet for the color and opacity
- 13:47so that'll we'll see that happen soon
- 13:49But we're gonna add one little trick step in between our switch here
- 13:53and our text
- 13:55Now when we switch kinda rapidly the actual content of the text
- 14:01that's'cause there's no real easy way
- 14:03for TouchDesigner to kind of blend text together
- 14:06The best we can do at this point is just s hard switch them
- 14:09But we can blend values really easily
- 14:12Now we can't do that in DATS
- 14:14because DATS are really focused on string type of data
- 14:17Python that kind of stuff
- 14:18But what we can do is actually convert this
- 14:21data from the DAT family back into channels
- 14:26and then we can use some of the techniques
- 14:27we used with our CHOP networks where
- 14:30you know we were using lag CHOPs
- 14:31filter CHOPs
- 14:33things that smooth the transition between two values
- 14:36So that's actually relatively easy to do in Touch
- 14:39So what we're gonna do first
- 14:41as always before I
- 14:42I make any big jumps
- 14:43I'm gonna set a little checkpoint for myself here with a Null DAT
- 14:48That way in case I ever need to insert anything between my switch
- 14:52and the area which I'm converting the values to CHOPs
- 14:55I'll have a nice place I can do
- 14:57that without having to change any other code
- 15:01So with that said
- 15:02now I'm ready to
- 15:02to do my little data conversion
- 15:04and what I can do is I can go to the CHOPs
- 15:07and I can use one called a DAT to CHOP
- 15:10And you know
- 15:11you're probably starting to see a trend because in
- 15:13in the last video we used another kind of conversion CHOP
- 15:15but many of the families have specific CHOPs
- 15:20or TOPs or operators that take the data from one family
- 15:24and convert them to the data type of another family
- 15:26So for example
- 15:27this DAT to CHOP that we're gonna use takes DAT data
- 15:30and converts it to CHOP data
- 15:32There's other ones
- 15:34For example
- 15:34there is a SOP to CHOP
- 15:36So you know in the next
- 15:37section we're gonna be working with SOPs
- 15:39but this would convert the data from a three-D model to
- 15:42to just numeric data
- 15:44You know there's all kinds of different ones here
- 15:46We can do uh
- 15:48CHOP to DAT
- 15:49so we can actually go in reverse
- 15:50if we had some maybe CHOP data that
- 15:51we wanted to turn into a table
- 15:53we could use this
- 15:54There's other ones here like CHOP to TOP
- 15:57So maybe if you had a bunch of numbers
- 15:59and you wanted to turn them into a
- 16:02a texture
- 16:02that's similar to what we did in our
- 16:04our TOP example when we were doing that cool
- 16:06like glitchy effect
- 16:08So those are a lot of different things that you can explore later on
- 16:11but just they're helpful to know that they exist
- 16:14So in this case
- 16:14because we have a DAT
- 16:15and we wanna convert into some channel data that we can
- 16:19then process with things like filters
- 16:22what I'm gonna do is make that DAT to CHOP
- 16:27In the DAT parameter here
- 16:28it wants to know the name of the DAT that I basically wanna convert
- 16:32so what I can do is simply drag
- 16:34and drop my null here right onto the parameter
- 16:38And by now I'm hoping that you're seeing the pattern here
- 16:40where a lot of things are drag and drop
- 16:44so don't be afraid
- 16:45if you don't know what's happening to just try dragging
- 16:47and dropping some things around
- 16:48and s and see if connections and references and things like that are made
- 16:52So in this case
- 16:53when we dragged Null 3 onto this DAT parameter
- 16:57we can see that little dotted line with an arrow got created
- 17:00and like I was saying before
- 17:02that's telling us that there's a
- 17:03a reference happening
- 17:04But unlike previously it's not animated
- 17:07and that's because this information isn't changing
- 17:09So it's not dynamic
- 17:10It referenced that data once
- 17:12and it's static now
- 17:14Now that we have this table
- 17:17you'll see that there's a bunch of parameters
- 17:19most of them you probably won't need to use at this point
- 17:22and the way we've set up our table corresponds to
- 17:27basically exactly how the default settings of the DAT 2 are set up
- 17:31So you can see now we have our first channel here
- 17:34which is color_red
- 17:36It doesn't like spaces
- 17:37so it replaces them helpfully for us with underscores
- 17:40We can see zero point three
- 17:42Color green is zero point three
- 17:43Color blue zero point three
- 17:45and opacity is zero point three
- 17:47Now if we go up to our slider and we change the values
- 17:52you can see we have this dynamically changing CHOP value operator now
- 17:57And you see color red is zero
- 17:59color green is zero point five
- 18:00blue is zero point seven
- 18:01opacity is one
- 18:03So that's great
- 18:03So super quick and easy
- 18:05We made a way to store a bunch of data
- 18:08A way to switch between that data
- 18:10and now that we've converted it back into CHOPs because it's all numeric data
- 18:14what we can do is use some of those things like filters
- 18:17So let's add a filter CHOP here
- 18:23And then what I'm gonna do is set the
- 18:24filter width to be maybe three seconds
- 18:27and what this is gonna do is it's gonna
- 18:28interpolate over three seconds between the changing values
- 18:32So now if I go from
- 18:35you know this slider
- 18:36where right now it's got index two to index zero
- 18:39you can see we get these nice smooth transitions between those two presets
- 18:47So that's awesome
- 18:47I mean that's that's basically
- 18:50you know in in less than
- 18:51a few minutes we rolled our own kind
- 18:52of simple preset system that you can use
- 18:54with kind of numeric data for parameters
- 18:57So the last thing we really have to do here is just as always
- 19:00put a null CHOP because we're about to start referencing some data
- 19:05I'm going into my text TOP here
- 19:08so I can grab the parameters under the color page
- 19:11and once I have them visible
- 19:13just like always
- 19:14I can activate the viewer on my null CHOP
- 19:16and start dragging and dropping parameters to reference them
- 19:22So I got my red
- 19:24reference my green reference my blue
- 19:28and then finally reference my alpha/opacity
- 19:36So now I'm actually gonna set the little display flag on
- 19:38so I can see my text in the background
- 19:45And now I can watch it do its kind of little state changes
- 19:48text changes color changes
- 19:50opacity changes
- 19:55And then the final thing we can do here is
- 19:56is what I did was I made a movie file in TOP
- 19:59so I could have a nice dynamic background
- 20:04I used that file plus button to open up my file chooser
- 20:08I went into the nature folder
- 20:09where we have a few kind of seven twenty P stock nature shots
- 20:15Then I made an over TOP just like we
- 20:17did in our kind of first examples
- 20:20And then I'm gonna put the background as my movie
- 20:24put my text into the first input on top of it
- 20:28Just like we did before prefit
- 20:30I don't want it to be scaled
- 20:31so I'm gonna change fill to native resolution
- 20:35And actually what I'll do is turn off the display flag on my text
- 20:39put a null TOP at the end of this chain
- 20:42and actually put the display flag on that on
- 20:45So now we can see
- 20:49you know as my values are changing and the presets are changing
- 20:53we can see them live on that background
- 20:57Now you can edit this to make this however you want
- 20:59Maybe you don't want to change the text here
- 21:00so you know
- 21:01we can maybe bypass our Switch DAT
- 21:05only have one text
- 21:06that way we're just changing styles
- 21:11You can change things like the amount of time it takes for that transition
- 21:15Right now it's three whole seconds
- 21:17which maybe is too long for you
- 21:19Maybe you can set it to
- 21:20you know zero point five seconds
- 21:23so now when I change it
- 21:25it'll be much faster
- 21:29And the sky's the limit here
- 21:30I mean we're just using with a single simple text
- 21:32You can have multiple texts
- 21:33You can have more advanced compositing
- 21:35whatever you like
- 21:36And we only did it with some styles
- 21:37but you could do it with
- 21:38you know all the parameters you wanted
- 21:40There's really no limit on how much data you can store in a table
- 21:45So with that said
- 21:45that should give you a good introduction to DATs
- 21:48and what I hope you're starting to see is that
- 21:51how using little pieces of functionality from each family
- 21:55we're starting to to add the
- 21:57the complexity of our networks up
- 21:58You know we have a little bit of
- 21:59TOPs here that are doing some compositing and
- 22:01and rendering of
- 22:02of two D objects
- 22:04We have you know
- 22:05a handful of DATs here holding some data
- 22:08then they get converted into CHOPs
- 22:10We know how CHOPs
- 22:10we can use them to kind of smooth out values
- 22:13We have another set of DATs here
- 22:15We made a little controller for our
- 22:16our presets here using some comps and some CHOPs
- 22:20So as we get through more and more
- 22:22and as you kind of explore TouchDesigner more and more
- 22:25that's really gonna be a big thing
- 22:26You're gonna always want to try
- 22:28and take your idea
- 22:29and think about how the simplest blocks
- 22:34that could make that idea would look like
- 22:37You know if you think
- 22:38Oh I have particles flying around
- 22:40and they're doing all kinds of crazy stuff
- 22:42you really wanna drill down and say
- 22:44Okay well how are the particles doing their thing
- 22:46What color are they
- 22:47Where did they come from
- 22:48What's the emitter
- 22:50Is there an attractor
- 22:51You always wanna break things down into the smallest possible
- 22:54like little idea bricks
- 22:56because that'll make it easier for you when you're trying to build these networks
- 22:59Because then what you're gonna do is just use
- 23:00a lot of the small little tools
- 23:02a lot of little operators all chained together doing little things
- 23:05and you'll end up with a cool app
- 23:08So with that said
- 23:09let's move on to our next operator family
About this transcript
This page contains the full transcript of 14 - Working with DATs - TouchDesigner Tutorial: Beginner Crash Course by The Interactive & Immersive HQ, generated from the public captions YouTube serves with the video. The transcript has 4,279 words across 552 segments, with the original timestamps preserved so you can click any line to jump to that moment in the embedded player.
What you can do with it
Use the transcript to take notes, quote the speaker, build a study guide, generate a summary with ChatGPT or Claude via the YouTube Summary tool, or export it as a timed subtitle file with YouTube to SRT. You can also re-open it in the transcriber to translate the transcript into 100+ languages.
Free YouTube transcript tool
YouTube2Text is a free YouTube transcript generator — no signup, no daily limit. Paste any YouTube link and get the full transcript instantly, with timestamps, click-to-jump, translation to 100+ languages, AI prompts for ChatGPT, Claude, and Gemini, and exports to TXT, SRT, VTT, or Markdown.