Tag Archives: time

Nov 12 2014

Sequencer CHOP tutorial.

The Sequencer CHOP. TouchDesigner 088. 2014.
The Sequencer CHOP allows you to create complex animation sequences. This is a specialized Channel Operator, and it can be difficult to master.

1
00:00:00,833 –> 00:00:05,133
Let’s examine the sequencer
CHOP.

2
00:00:05,133 –> 00:00:16,067
The sequencer CHOP is an
operator that allows you to
create and control complex
animation sequences.

3
00:00:16,067 –> 00:00:24,400
The sequences are held in CHOPs,
and referenced by a table DAT.

4
00:00:24,400 –> 00:00:33,633
Each CHOP can represent a simple
animation state, or a complex
animation.

5
00:00:33,633 –> 00:00:43,467
In this network I’ve built a
series of 5 animations that
control a character.

6
00:00:43,467 –> 00:00:51,433
The character is a simple face
with 5 possible animatable
features.

7
00:00:51,433 –> 00:01:02,733
We can animate the eyes and the
mouth, with simple values for
rotation, position, and scale.

8
00:01:02,733 –> 00:01:12,567
Each of the 5 constant CHOPs
holds 5 animation states for
each facial feature.

9
00:01:12,567 –> 00:01:24,333
The sequencer CHOP gives us the
ability to dynamically choose
any state we want, and blend
them together over time.

10
00:01:24,333 –> 00:01:31,367
We can combine static, or still
states, with complex animations.

11
00:01:31,367 –> 00:01:41,033
The face character is a network
of TOPs and SOPs that lives
inside a container component.

12
00:01:41,033 –> 00:01:45,400
I’ve built a mouth from a line
SOP.

13
00:01:45,400 –> 00:01:55,967
We can animate the 3 points on
the line: 2 for the left and
right side, and 1 for the
middle.

14
00:01:55,967 –> 00:02:01,000
The eyes are constructed from a
rectangle TOP.

15
00:02:01,000 –> 00:02:11,067
We vary the rotation and scale
of the rectangle to create
expressive animations.

16
00:02:11,067 –> 00:02:18,633
I won’t go into detailed
explanation of this network, you
can explore it on your own.

17
00:02:18,633 –> 00:02:33,200
The most important note is that
I use Python expressions to
reference the values stored in
the constant CHOPs above this
container.

18
00:02:33,200 –> 00:02:46,100
These values are the rotation,
position, and scale values that
drive the facial animation.

19
00:02:46,100 –> 00:02:56,000
Now that we’ve seen how the face
is constructed, let’s look again
at the complete network.

20
00:02:56,000 –> 00:03:03,967
The sequencer CHOP is now
referencing the constant CHOP
named “BASE”.

21
00:03:03,967 –> 00:03:14,000
I can adjust the values of the
base animation state, and see
the results applied to the face
character.

22
00:03:14,000 –> 00:03:22,500
By doing this, you will realize
that to create a new animation
state is a simple matter.

23
00:03:22,500 –> 00:03:35,167
You can copy the “BASE”
operator, add it to the
sequence, and adjust the
parameters to create a new
facial expression.

24
00:03:35,167 –> 00:03:42,100
This is the method I used to
create the following 4 animation
states.

25
00:03:42,100 –> 00:03:54,067
The last animation is here to
showcase the ability of the
sequencer CHOP to combine static
states with complex animations.

26
00:03:54,067 –> 00:03:58,933
I created this animation from 5
noise CHOPs.

27
00:03:58,933 –> 00:04:07,167
Each will generate random
states, over time, for each of
the 5 facial features.

28
00:04:07,167 –> 00:04:19,233
For this, or any animation, to
work properly with the sequencer
CHOP, you need to pay close
attention to how your channels
are named.

29
00:04:19,233 –> 00:04:26,367
I’m using 2 Python scripts to
control the sequencer CHOP.

30
00:04:26,367 –> 00:04:40,767
The logic is simple: 1st, copy
the contents of the table DAT
named “felipeSequence” to the
DAT named “sequencer1_sequence”.

31
00:04:40,767 –> 00:04:51,333
The reason we use a custom table
to create our sequence will
become apparent in a moment.

32
00:04:51,333 –> 00:04:54,800
Next, we reset the sequencer
CHOP.

33
00:04:54,800 –> 00:05:06,800
This forces the sequencer to
load the 1st entry in the table
DAT, which in turn, points to
the 1st animation CHOP.

34
00:05:06,800 –> 00:05:10,833
Now, our sequence is loaded and
ready.

35
00:05:10,833 –> 00:05:17,567
This script simply tells the
sequencer CHOP to step to the
next sequence.

36
00:05:17,567 –> 00:05:20,533
Now let’s step through some
animations.

37
00:05:20,533 –> 00:05:24,167
Pay attention to the sequencer’s
table DAT.

38
00:05:24,167 –> 00:05:32,200
You’ll see that at the end of
each sequence, the row
containing that sequence is
deleted.

39
00:05:32,200 –> 00:05:36,533
The second row of the table DAT
is never deleted.

40
00:05:36,533 –> 00:05:41,833
That’s why I use it to store a
base animation state.

41
00:05:41,833 –> 00:05:46,267
Let’s step through the entire
process again.

42
00:05:46,267 –> 00:05:50,000
I run the “LOAD_SEQUENCE”
script.

43
00:05:50,000 –> 00:05:59,833
This fills the sequence table
with our custom contents, and
resets the sequencer so it’s
ready to play the next
animation.

44
00:05:59,833 –> 00:06:07,800
I’ll make an adjustment here:
the “blendtime” parameter
between the first and second
animations.

45
00:06:07,800 –> 00:06:17,633
I must reset the sequencer, and
you’ll see the change in blend
time when I step to the next
animation.

46
00:06:17,633 –> 00:06:25,100
The sequencer CHOP can play
animations independently of
Touch Designer’s master
timeline.

47
00:06:25,100 –> 00:06:35,133
Therefore, you can use it to
create animations that react to
user input or any other realtime
events.

48
00:06:35,133 –> 00:06:45,400
The sequencer CHOP is a very
powerful tool that requires a
very specific network design to
work properly.

49
00:06:45,400 –> 00:06:47,400
When you master the process of
building these networks, you can
begin to create very amazing
animation effects.

Nov 12 2014

Trim CHOP tutorial.

The Trim CHOP. TouchDesigner 088. 2014.
The Trim CHOP can help you customize and fine-tune CHOP data.

1
00:00:00,533 –> 00:00:03,467
Let’s take a look at the trim
CHOP.

2
00:00:03,467 –> 00:00:11,067
We can use the trim CHOP to
shorten or lengthen the channels
of the incoming CHOP.

3
00:00:11,067 –> 00:00:17,033
This example network shows two
common methods of using the trim
CHOP.

4
00:00:17,033 –> 00:00:22,500
The first method is to simply
trim a range of samples.

5
00:00:22,500 –> 00:00:30,233
The second method, which is more
complex, is to evaluate a range
of samples over time.

6
00:00:30,233 –> 00:00:39,333
We start with a wave CHOP, with
one channel named “chan1”, which
is comprised of 600 samples.

7
00:00:39,333 –> 00:00:49,667
The trim CHOP named “trim1” is
set to trim the incoming sample
range using absolute unit
values.

8
00:00:49,667 –> 00:01:06,133
By setting the units values to
“Absolute”, and setting the
discard method to “Exterior”, we
create a new sample range of 60
samples, or 1/10th the original
sample range.

9
00:01:06,133 –> 00:01:17,767
The second method uses the
current frame in Touch Designer
as a reference point to evaluate
the incoming sample range.

10
00:01:17,767 –> 00:01:33,167
With start and end settings of 0
to 1 second, we create an
animating sample range of 60
samples, which is our global
frames per second setting.

11
00:01:33,167 –> 00:01:44,633
Touch Designer uses the current
frame, which is always updating
and moving forward in time, as
the start reference point.

12
00:01:44,633 –> 00:01:46,300

13
00:01:46,300 –> 00:01:54,400
This network is designed to help
us visualize the “Relative To
Current Frame” method.

14
00:01:54,400 –> 00:02:01,433
We start with a noise CHOP that
is set to create 600 samples.

15
00:02:01,433 –> 00:02:10,267
We use a trim CHOP to create a
sample length that is 1/10th that
value, or 60 samples.

16
00:02:10,267 –> 00:02:12,533

17
00:02:12,533 –> 00:02:21,267
The op viewer TOP will create a
2D image of the noise CHOP
operator.

18
00:02:21,267 –> 00:02:27,533
The rest of the TOP network is
designed to only for
visualization purposes.

19
00:02:27,533 –> 00:02:28,567

20
00:02:28,567 –> 00:02:33,167
I’ll stop to play head and back
it up to the first frame.

21
00:02:33,167 –> 00:02:37,233
We are no longer moving forward
in time.

22
00:02:37,233 –> 00:02:44,167
The trim CHOP has extracted the
first 60 samples of the noise
CHOP.

23
00:02:44,167 –> 00:02:45,067

24
00:02:45,067 –> 00:02:50,833
The TOP named “over1” shows us
the effect of the trim CHOP.

25
00:02:50,833 –> 00:02:54,733
The area in white is the
extraction area.

26
00:02:54,733 –> 00:02:56,033

27
00:02:56,033 –> 00:03:00,233
Let’s play, then quickly pause.

28
00:03:00,233 –> 00:03:06,333
The trim CHOP reference point is
synchronized to the playhead.

29
00:03:06,333 –> 00:03:18,600
As we move forward in time
again, the trim CHOP reference
point moves forward as well,
constantly updating the
extraction range.

30
00:03:18,600 –> 00:03:20,600

Posted In
Tagged
Nov 12 2014

Clock CHOP tutorial.

The Clock CHOP. TouchDesigner 088. 2014.
The Clock CHOP helps you control timings in TouchDesigner.

1
00:00:00,433 –> 00:00:03,600
Let’s take a look at the clock
CHOP.

2
00:00:03,600 –> 00:00:13,500
The clock CHOP can help you keep
track of time, and manage time,
and it has a large set of
parameters to help you do this.

3
00:00:13,500 –> 00:00:18,833
In this example I’ve set the
hour format to a 12 hour format.

4
00:00:18,833 –> 00:00:30,300
We’re going to use the clock
data to create a simple clock
display, by using a very complex
looking single line Python
expression.

5
00:00:30,300 –> 00:00:37,800
The 3 channels we are interested
in are “ampm”, “hour”, and
“min”.

6
00:00:37,800 –> 00:00:45,067
I’ve broken the contents of the
Python expression into segments
here in a text DAT.

7
00:00:45,067 –> 00:00:53,233
This is a good way to see the
difference between a multi line
and a single line Python
snippet.

8
00:00:53,233 –> 00:01:05,700
The Python code used in the text
TOP parameter named “text” has
exactly the same purpose and
output as the multi line code.

9
00:01:05,700 –> 00:01:12,267
To see the effect of the multi
line code, let’s start by
opening the textport.

10
00:01:12,267 –> 00:01:17,133
We can press the clear button to
reset the contents the textport.

11
00:01:17,133 –> 00:01:26,767
We middle mouse click over the
text DAT to pull up the context
menu, then select “Run Script”.

12
00:01:26,767 –> 00:01:28,100

13
00:01:28,100 –> 00:01:38,167
The second example network
illustrates a way to use the
clock CHOP to keep track of
Touch Designer specific timings.

14
00:01:38,167 –> 00:01:45,033
I select the “Since Program
Start” option of the Start
Reference parameter.

15
00:01:45,033 –> 00:01:51,333
The select CHOP allows us to use
only the channel we need, in
this case seconds.

16
00:01:51,333 –> 00:01:57,333
We will create an event that
happens every 10 seconds in
Touch Designer.

17
00:01:57,333 –> 00:02:08,500
I use the math CHOP to divide
the incoming seconds value by
10, then turn the resulting
floating point number into an
integer.

18
00:02:08,500 –> 00:02:16,133
We now have a count of every
tenth second that has elapsed
since Touch Designer started.

19
00:02:16,133 –> 00:02:27,733
Now I use a chop execute DAT to
create a customized event that
will run every time the math
CHOP changes.

20
00:02:27,733 –> 00:02:40,533
In this case, every 10th second
that has elapsed will cause the
phrase “Time To DO SOMETHING” to
be printed to the textport.

21
00:02:40,533 –> 00:02:41,767

22
00:02:41,767 –> 00:02:49,167
The clock CHOP is a powerful
tool that can help you manage
timing logic in Touch Designer.

23
00:02:49,167 –> 00:02:51,167

Posted In
Tagged
Nov 12 2014

Wave CHOP tutorial.

The Wave CHOP. TouchDesigner 088. 2014.
The Wave CHOP can generate static or dynamic waveforms.

1
00:00:00,600 –> 00:00:04,033
Let’s examine the wave CHOP.

2
00:00:04,033 –> 00:00:05,833

3
00:00:05,833 –> 00:00:13,867
Here we have an example with
three wave CHOP operators.

4
00:00:13,867 –> 00:00:21,867
Remember we can hit the H key to
home our screen, which will
center all of operators.

5
00:00:21,867 –> 00:00:30,333
And we can hit the P key to
display the parameters for the
selected operator.

6
00:00:30,333 –> 00:00:31,567

7
00:00:31,567 –> 00:00:38,867
In the first example we will
examine the concept of time in
Touch Designer.

8
00:00:38,867 –> 00:00:40,633

9
00:00:40,633 –> 00:00:44,033
These are examples of Python
expressions,

10
00:00:44,033 –> 00:00:49,300
that reference the amount of
time a node has been cooking.

11
00:00:49,300 –> 00:00:56,967
We can use this constantly
updating value to create an
animation engine.

12
00:00:56,967 –> 00:00:59,867

13
00:00:59,867 –> 00:01:06,567
We are animating the phase
parameter of the wave CHOP,

14
00:01:06,567 –> 00:01:16,633
then using the generated value
to animate the alpha channel of
a constant TOP.

15
00:01:16,633 –> 00:01:22,333

16
00:01:22,333 –> 00:01:27,400
We can generate different types
of waves.

17
00:01:27,400 –> 00:01:31,567

18
00:01:31,567 –> 00:01:34,567
The different types of waves
will affect the different

19
00:01:34,567 –> 00:01:42,167
values generated along the
waveform, and in turn affect

20
00:01:42,167 –> 00:01:49,967
the animation of any node that
references the resulting wave-
form data.

21
00:01:49,967 –> 00:01:52,633

22
00:01:52,633 –> 00:01:58,000
Let’s adjust the speed of our
animation by reducing the value

23
00:01:58,000 –> 00:02:02,167
referenced by our Python
expression.

24
00:02:02,167 –> 00:02:08,967
We’ve created of pulse waveform
type with a range of 0 to 1.

25
00:02:08,967 –> 00:02:15,533
If I keep the same wave CHOP
parameters and switch the type
to square,

26
00:02:15,533 –> 00:02:21,467
you’ll see our waveform
amplitude now ranges from -1 to
1.

27
00:02:21,467 –> 00:02:27,700
In order to create the desired
output range of 0 to 1,

28
00:02:27,700 –> 00:02:32,600
we must adjust the waveform’s
amplitude and offset

29
00:02:32,600 –> 00:02:37,167
depending on the desired type of
waveform.

30
00:02:37,167 –> 00:02:45,000

31
00:02:45,000 –> 00:02:50,267
Now let’s examine the concept of
samples in Touch Designer.

32
00:02:50,267 –> 00:02:58,767
Wave CHOP 1 has channel settings
of a start of 0 seconds and end
of 10 seconds,

33
00:02:58,767 –> 00:03:04,867
and a sample rate of 60, giving
us a grand total of 600 samples.

34
00:03:04,867 –> 00:03:10,867
For every frame processed by
Touch Designer, at 60 frames per
second,

35
00:03:10,867 –> 00:03:15,867
this operator will generate 600
samples of data.

36
00:03:15,867 –> 00:03:20,100
Wave CHOP number 2 has channel
settings of

37
00:03:20,100 –> 00:03:27,000
a start of 0 seconds, an end of
1 second, and a sample rate of
1.

38
00:03:27,000 –> 00:03:35,667
This means this operator will
generate 1 sample of data for
every frame Touch Designer
processes.

39
00:03:35,667 –> 00:03:36,733

40
00:03:36,733 –> 00:03:41,533
We can use a Python expression
to access CHOP data.

41
00:03:41,533 –> 00:03:47,500
We can access the CHOP name, the
names and numbers of channels
within the CHOP,

42
00:03:47,500 –> 00:03:51,800
and the data generated by each
channel at each sample.

43
00:03:51,800 –> 00:03:56,533
The Python expression works by
referencing the operator name,

44
00:03:56,533 –> 00:04:00,367
the channel name, and the
desired sample.

45
00:04:00,367 –> 00:04:01,700

46
00:04:01,700 –> 00:04:10,800
Here we reference the operator
“wave1”, the channel named
“chan1”, and sample 0.

47
00:04:10,800 –> 00:04:20,833
Here we reference the operator
named “wave2”, the channel named
“green”, and sample 0.

48
00:04:20,833 –> 00:04:21,767

49
00:04:21,767 –> 00:04:27,167
Let’s examine these Python
expressions in greater detail.

50
00:04:27,167 –> 00:04:33,300
Again we are referencing the
operator, the channel, and the
sample.

51
00:04:33,300 –> 00:04:37,133
In this case the channel we’re
referencing by name.

52
00:04:37,133 –> 00:04:41,767
The wave CHOP must name the
channel it creates.

53
00:04:41,767 –> 00:04:50,433
If I change the channel name,
our Python expression will
break.

54
00:04:50,433 –> 00:04:55,100
This is because we are
referencing the channel by name.

55
00:04:55,100 –> 00:05:01,900
In order for our Python
expression to work, it must know
where to look for data.

56
00:05:01,900 –> 00:05:04,000

57
00:05:04,000 –> 00:05:09,033
We can also reference channels
by number.

58
00:05:09,033 –> 00:05:12,233
The wave CHOP creates a single
channel.

59
00:05:12,233 –> 00:05:20,867
Remember to think in base 0 for
most of your numbering systems
in Touch Designer.

60
00:05:20,867 –> 00:05:26,067
Channel 0 is the first channel,
not channel 1.

61
00:05:26,067 –> 00:05:33,733
Now that we are referencing our
channel by number, we can name
our channel anything we like.

62
00:05:33,733 –> 00:05:39,833

63
00:05:39,833 –> 00:05:44,800
We have many options when we
deal with time In Touch
Designer.

64
00:05:44,800 –> 00:05:54,933
A simple but powerful method is
by using a Python expression to
reference the amount of time a
node has been cooking.

65
00:05:54,933 –> 00:06:00,300
But, as Einstein showed us, time
is relative.

66
00:06:00,300 –> 00:06:13,700
When we use the Python
expression “me.time.seconds”, we
are referencing the amount of
time this node has been cooking
in reference to the Touch
Designer timeline.

67
00:06:13,700 –> 00:06:26,533
As we watch the playhead on the
timeline, we’ll see that after
10 seconds the value of our
“me.time.seconds” expression
will reset.

68
00:06:26,533 –> 00:06:27,333

69
00:06:27,333 –> 00:06:33,967
Wave CHOP number 2 uses absolute
time as it’s time reference.

70
00:06:33,967 –> 00:06:44,800
This value is independent of the
Touch Designer timeline, and
references the amount of time
that has elapsed since Touch
Designer was launched.

71
00:06:44,800 –> 00:06:48,200

72
00:06:48,200 –> 00:06:58,833
Let’s investigate in more detail
the concept of a sample range
contained in an operator’s
channel.

73
00:06:58,833 –> 00:07:07,000
Wave CHOP number 3 is not
animating, and it contains a
range of sixty samples.

74
00:07:07,000 –> 00:07:08,667

75
00:07:08,667 –> 00:07:18,333
We will use the range of samples
created by the wave CHOP to
offset the center of a circle
TOP.

76
00:07:18,333 –> 00:07:20,467

77
00:07:20,467 –> 00:07:33,100
We’ll use the 60 discrete values
created by the wave CHOP to
offset the Y, the up and down
position of the circle TOP.

78
00:07:33,100 –> 00:07:34,900

79
00:07:34,900 –> 00:07:40,533
We have a horizontal slider that
generates an initial range of 0
to 1.

80
00:07:40,533 –> 00:07:48,933
We then use a simple CHOP
network to re-range the slider
data to fit our needs.

81
00:07:48,933 –> 00:07:57,700
The offset position of the
circle TOP corresponds exactly
to the shape of the generated
waveform.

82
00:07:57,700 –> 00:08:01,600

83
00:08:01,600 –> 00:08:13,400
As you can see, the wave CHOP is
a simple but extremely powerful
method for generating animation
paths.

84
00:08:13,400 –> 00:08:19,900

85
00:08:19,900 –> 00:08:29,833
We treat the initial 0 to 1
value range created by the
slider using a series of CHOPs.

86
00:08:29,833 –> 00:08:39,033
First we rename the incoming
channel to “x” and “y”.

87
00:08:39,033 –> 00:08:49,033
We re-range the 0 to 1 incoming
values to -.5 to positive .5.

88
00:08:49,033 –> 00:08:54,400
these values equate to “X”
position of the circle TOP.

89
00:08:54,400 –> 00:09:04,800
.5 represents the extent of
screen right, and negative .5
represents the extent of screen
left.

90
00:09:04,800 –> 00:09:06,833

91
00:09:06,833 –> 00:09:16,133
Next we re-range the incoming
“y” value of 0 to 1, to a range
of 0 to 60.

92
00:09:16,133 –> 00:09:25,133
This is our sample range. The
wave CHOP creates a range of 60
discrete samples.

93
00:09:25,133 –> 00:09:36,767
As we move the slider from left
to right, we change the value of
the waveform shape we are
sampling from.

94
00:09:36,767 –> 00:09:48,533
Here the slider has generated a
value of 17, and we are sampling
the 17th value of the sample
range of the waveform shape.

95
00:09:48,533 –> 00:09:49,667

96
00:09:49,667 –> 00:09:57,267
.5 represent screen top, -.5
represents screen bottom.

97
00:09:57,267 –> 00:10:03,000

98
00:10:03,000 –> 00:10:07,667
Let’s take a closer look at our
Python expressions.

99
00:10:07,667 –> 00:10:09,100

100
00:10:09,100 –> 00:10:24,700
In order to generate our “x”
value, we reference first the
“math1” operator, then channel
“x” from the “math1” operator,
and finally evaluate the sample.

101
00:10:24,700 –> 00:10:37,433
In this case, the “math1”
operator creates only one
sample, therefore we don’t need
to reference it specifically by
number when we evaluate it.

102
00:10:37,433 –> 00:10:39,933

103
00:10:39,933 –> 00:10:47,167
To generate our “y” value, we
use a slightly more complicated
Python expression.

104
00:10:47,167 –> 00:10:53,267
I’ll demonstrate how we nest one
Python expression within
another.

105
00:10:53,267 –> 00:11:03,933
We use the familiar sequence-
operator, channel, then sample-
when we create our expression
string.

106
00:11:03,933 –> 00:11:05,267

107
00:11:05,267 –> 00:11:12,667
We need to reference the
operator named “wave3” and its’
first channel.

108
00:11:12,667 –> 00:11:16,900
BUT which sample do we wish to
evaluate?

109
00:11:16,900 –> 00:11:21,967
We can choose any sample from a
range of 60.

110
00:11:21,967 –> 00:11:24,667

111
00:11:24,667 –> 00:11:35,300
In order to dynamically change
the sample we wish to evaluate,
we need another Python
expression.

112
00:11:35,300 –> 00:11:48,933
The value created by the slider,
and re-ranged by the “math2”
operator, is the number of the
sample we wish to evaluate.

113
00:11:48,933 –> 00:11:51,100

114
00:11:51,100 –> 00:11:59,300
To access this value, we use our
familiar Python string-
operator, channel, sample.

115
00:11:59,300 –> 00:12:09,733
The operator is “math2”, the
channel is 0, and we evaluate
the first sample.

116
00:12:09,733 –> 00:12:15,100
We can also access the channel
by name, in this case “y”.

117
00:12:15,100 –> 00:12:17,800

118
00:12:17,800 –> 00:12:30,933
Now I will cut that entire
Python expression string, and
use it as the “.eval” argument
in my first Python string.

119
00:12:30,933 –> 00:12:31,900

120
00:12:31,900 –> 00:12:42,500
Now the value of the “math2”
operator is the value we use to
sample the waveform shape of the
“wave3” CHOP.

121
00:12:42,500 –> 00:12:43,533

122
00:12:43,533 –> 00:12:53,233
By nesting one Python expression
in another, we are able to
access two operators
simultaneously-

123
00:12:53,233 –> 00:12:55,233
and apply selected values from
them to another operator- in
this case the circle TOP.