Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:05,529 --> 00:00:09,630
Nodes can process data of different types,
and it's important to understand what they
2
00:00:09,630 --> 00:00:11,559
mean, and how they relate to each other.
3
00:00:11,559 --> 00:00:15,870
In Blender, types are indicated by the node
socket colors.
4
00:00:15,870 --> 00:00:19,640
So far, four data types are supported in Blender
shading trees.
5
00:00:19,640 --> 00:00:24,529
These are the Value type, the Vector type,
the Color type, and the Shader type.
6
00:00:24,529 --> 00:00:28,930
Here I'm showing an example of each data type,
except for the Shader type, which is a bit
7
00:00:28,930 --> 00:00:30,060
special.
8
00:00:30,060 --> 00:00:34,480
The value type has a gray socket, and it simply
holds a single numeric value.
9
00:00:34,480 --> 00:00:37,570
This can be practically any value you can
think of.
10
00:00:37,570 --> 00:00:41,249
Values don't have a particular meaning or
unit, you can interpret them as whatever you
11
00:00:41,249 --> 00:00:45,550
want for any particular application, though
some nodes will give a specific meaning to
12
00:00:45,550 --> 00:00:48,469
values they take as input.
13
00:00:48,469 --> 00:00:52,289
Vectors might sound complicated, but really
they are just like the Value type, except
14
00:00:52,289 --> 00:00:53,839
that it's a set of three values.
15
00:00:53,839 --> 00:00:58,239
They are a convenient and efficient way to
operate on three values at once.
16
00:00:58,239 --> 00:01:02,469
These values can represent whatever you want
as well, and we can do most of the same mathematical
17
00:01:02,469 --> 00:01:08,620
operations with Vectors as we can with Values,
as well as some special Vector-specific operations.
18
00:01:08,620 --> 00:01:12,920
The reason Vectors contain three values is
that they are most often used to encode 3D
19
00:01:12,920 --> 00:01:14,670
coordinates or directions.
20
00:01:14,670 --> 00:01:19,030
So the convention is that each value represents
the same type of data but each for a different
21
00:01:19,030 --> 00:01:21,049
axis, X, Y, and Z.
22
00:01:21,049 --> 00:01:26,390
Though you can use vectors to encode just
about anything you want, for instance, colors!
23
00:01:26,390 --> 00:01:28,439
This brings us the Color type.
24
00:01:28,439 --> 00:01:32,340
Colors are essentially the same as Vectors,
they are just a set of three values.
25
00:01:32,340 --> 00:01:36,579
And they behave exactly the same in almost
every way, so in practice they are pretty
26
00:01:36,579 --> 00:01:38,329
much interchangeable.
27
00:01:38,329 --> 00:01:42,640
By convention, the color channels represent
the red, green, and blue, but just like with
28
00:01:42,640 --> 00:01:45,840
Vectors you could use them to represent anything
you want.
29
00:01:45,840 --> 00:01:50,799
This is neat, as it allows us to use Vector
operations and Color operations interchangeably.
30
00:01:50,799 --> 00:01:53,509
Now, Shaders are a bit more complicated.
31
00:01:53,509 --> 00:01:58,810
Shaders don't carry any specific value, rather,
just like a node, the shader data itself is
32
00:01:58,810 --> 00:02:00,100
a function.
33
00:02:00,100 --> 00:02:04,030
You can think of a shader as a description
of what happens to a ray that hits the surface
34
00:02:04,030 --> 00:02:05,219
of an object.
35
00:02:05,219 --> 00:02:09,460
It basically carries information about how
glossy, or transparent, or emissive the surface
36
00:02:09,460 --> 00:02:12,950
is, as well as the surface color, and other
information.
37
00:02:12,950 --> 00:02:17,069
So Shaders are quite different from the other
data types, which means they can't be readily
38
00:02:17,069 --> 00:02:19,930
converted like the other types.
39
00:02:19,930 --> 00:02:22,510
Most of the types can be converted into each
other.
40
00:02:22,510 --> 00:02:26,849
For instance, if we take a Value type, and
plug it into a Color, the value gets fed into
41
00:02:26,849 --> 00:02:28,709
all three Color channels.
42
00:02:28,709 --> 00:02:33,090
This is neat as it allows us to visualize
the value, by outputting it as a color.
43
00:02:33,090 --> 00:02:37,209
This is only useful for a limited range of
values, as negative colors always show up
44
00:02:37,209 --> 00:02:41,980
black, and values above one either get clipped
of become hard to distinguish, depending on
45
00:02:41,980 --> 00:02:46,230
the color settings, but this is still a fantastic
diagnostic tool.
46
00:02:46,230 --> 00:02:50,049
There are also other cases where we might
want to plug a value into a color socket,
47
00:02:50,049 --> 00:02:53,140
like if we want to multiply all color channels
by the same value.
48
00:02:53,140 --> 00:02:58,610
Now, if we swap this Color socket for a Vector
socket, exactly the same thing happens, feeding
49
00:02:58,610 --> 00:03:02,489
a Value into a Vector makes all three channels
take that value.
50
00:03:02,489 --> 00:03:06,560
This is again useful whenever we want to drive
all three channels with the same value at
51
00:03:06,560 --> 00:03:08,110
once.
52
00:03:08,110 --> 00:03:12,280
If we feed a Color into a Vector, absolutely
no conversion happens, and the Vector just
53
00:03:12,280 --> 00:03:16,400
takes the three channel values, since they
use exactly the same data representation.
54
00:03:16,400 --> 00:03:20,390
And as you'd expect, the same goes if we swap
them around.
55
00:03:20,390 --> 00:03:25,650
So we can always feed Colors into Vectors
and back, without any conversion taking place.
56
00:03:25,650 --> 00:03:29,900
Just like with Values, this is also a really
useful diagnostic tool, which allows us to
57
00:03:29,900 --> 00:03:34,689
visually inspect our vectors, as the X, Y,
and Z channels get mapped directly onto the
58
00:03:34,689 --> 00:03:36,489
R, G, and B channels, respectively
59
00:03:36,489 --> 00:03:42,670
Now, if we feed a Vector into a Value, we
must lose some data, as the Value can't hold
60
00:03:42,670 --> 00:03:44,269
all three channels.
61
00:03:44,269 --> 00:03:47,260
So what happens is that the three channels
get averaged.
62
00:03:47,260 --> 00:03:51,340
This is of limited use, and we'll rarely have
a case where we actually want to use the average
63
00:03:51,340 --> 00:03:55,689
of the Vector channels as a Value, and in
most cases, when we need to extract data from
64
00:03:55,689 --> 00:03:59,819
a Vector we'll be looking at other methods
that we'll explore in a bit.
65
00:03:59,819 --> 00:04:04,890
Now if we plug a Color into a Value, we find
the only difference between Colors and Vectors.
66
00:04:04,890 --> 00:04:09,080
Instead of averaging the channels, the relative
luminance gets calculated.
67
00:04:09,080 --> 00:04:13,410
So the distinction between Vectors and Colors,
is purely in how the channels get interpreted
68
00:04:13,410 --> 00:04:18,110
in this one situation, so literally the only
time there is any difference in the behavior
69
00:04:18,110 --> 00:04:22,870
of Vectors and Colors is when directly converting
them into a Value.
70
00:04:22,870 --> 00:04:27,180
This distinction is because we would usually
interpret colors as a visual thing, and luminance
71
00:04:27,180 --> 00:04:31,750
makes sense here, as it represents the perceived
brightness of the colors.
72
00:04:31,750 --> 00:04:35,910
The relative luminance is calculated as a
weighted sum of the three channels, this is
73
00:04:35,910 --> 00:04:39,490
very similar to averaging, except that the
different channels have different amounts
74
00:04:39,490 --> 00:04:41,500
of influence over the result.
75
00:04:41,500 --> 00:04:45,400
This is because we don't perceive all the
colors as having the same brightness.
76
00:04:45,400 --> 00:04:49,650
For instance, let's take the three additive
primaries, red, green, and blue.
77
00:04:49,650 --> 00:04:53,389
Here we see each in it's pure form, and at
maximum intensity.
78
00:04:53,389 --> 00:04:57,040
If we look at the channel values, we see that
each has a single channel with a value of
79
00:04:57,040 --> 00:05:00,020
one, and two channels with a zero.
80
00:05:00,020 --> 00:05:04,120
If these were vectors, they would all average
to the same value of one third.
81
00:05:04,120 --> 00:05:07,120
But these colors don't look like they have
the same brightness.
82
00:05:07,120 --> 00:05:11,389
Our eyes are tuned such that green looks the
brightest, and blue looks the darkest, and
83
00:05:11,389 --> 00:05:15,060
the relative luminance was designed to reflect
our perception.
84
00:05:15,060 --> 00:05:19,160
So when we plug each color into a value, we
get a different result.
85
00:05:19,160 --> 00:05:24,280
This the same kind of behavior as you'd usually
see when turning a color into black and white.
86
00:05:24,280 --> 00:05:28,650
Note that while this behavior makes sense
for colors, in practice, we'll almost never
87
00:05:28,650 --> 00:05:31,690
want to actually plug a color directly into
a value like that.
88
00:05:31,690 --> 00:05:36,250
This is really only if we want to interpret
the color visually as a grayscale brightness.
89
00:05:36,250 --> 00:05:40,170
But with procedural shaders, in most cases,
we're using colors from noise textures to
90
00:05:40,170 --> 00:05:45,090
drive non-color related things, like displacement,
in which case, plugging the color directly
91
00:05:45,090 --> 00:05:48,980
into a value is almost certainly not actually
what we wanted.
92
00:05:48,980 --> 00:05:51,120
We'll look at some alternatives in a bit.
93
00:05:51,120 --> 00:05:54,830
Just keep in mind that if you see a color
plugged into a value, nine times out of ten
94
00:05:54,830 --> 00:05:56,960
it was a mistake.
95
00:05:56,960 --> 00:05:59,610
Finally, we get to the Shader type again.
96
00:05:59,610 --> 00:06:02,940
This type cannot be converted into any of
the other types.
97
00:06:02,940 --> 00:06:06,530
It doesn't carry a value, so there is no reasonable
conversion.
98
00:06:06,530 --> 00:06:10,490
Though there is one thing that is kinda like
converting a shader into a color, which is
99
00:06:10,490 --> 00:06:15,270
Eevee's Shader to RGB node, but it doesn't
really convert the shader itself into a color,
100
00:06:15,270 --> 00:06:17,590
but rather the rendered result.
101
00:06:17,590 --> 00:06:20,910
But this node is Eevee-specific and we won't
be using it in this course.
102
00:06:20,910 --> 00:06:25,610
Now, while we can't plug a shader into any
of the other socket types, we can plug other
103
00:06:25,610 --> 00:06:27,740
types into a shader socket.
104
00:06:27,740 --> 00:06:31,650
If we plug a color into the shader, Blender
just pretends that there is an Emission shader
105
00:06:31,650 --> 00:06:32,690
in between.
106
00:06:32,690 --> 00:06:36,500
So the color basically just gets output by
the object directly.
107
00:06:36,500 --> 00:06:40,810
If we plug a Vector into the shader, the same
thing happens, the Vector just gets fed into
108
00:06:40,810 --> 00:06:44,259
this imaginary Emission shader's color socket.
109
00:06:44,259 --> 00:06:47,250
And the same thing if we plug a Value into
a Shader socket.
110
00:06:47,250 --> 00:06:50,840
There is an imaginary Emission shader, and
the Value to Color conversion rules apply
111
00:06:50,840 --> 00:06:55,449
to the Value being fed into the Emission color,
which just means all three channels get the
112
00:06:55,449 --> 00:06:57,380
same value.
113
00:06:57,380 --> 00:06:59,970
Now let's take a look at some actual nodes.
114
00:06:59,970 --> 00:07:05,349
If we want to input data directly into our
node tree, we can do that with several nodes.
115
00:07:05,349 --> 00:07:09,449
To input single values, there is the very
simple Value Input node, which we already
116
00:07:09,449 --> 00:07:12,210
looked at in the shader evaluation chapter.
117
00:07:12,210 --> 00:07:16,599
For vectors, there is no input node, but we
can use the Combine XYZ conversion node for
118
00:07:16,599 --> 00:07:17,940
this purpose.
119
00:07:17,940 --> 00:07:22,080
Here we can input three values, which become
the three channels of a vector.
120
00:07:22,080 --> 00:07:25,860
These three inputs also have sockets, which
is convenient when we want to construct a
121
00:07:25,860 --> 00:07:28,790
vector from values coming from other nodes.
122
00:07:28,790 --> 00:07:32,940
For colors, there is the RGB input node, which
has a convenient color picker.
123
00:07:32,940 --> 00:07:35,500
There are also two relevant conversion nodes.
124
00:07:35,500 --> 00:07:40,509
The Combine RGB node works exactly like the
Combine XYZ node and just maps the three values
125
00:07:40,509 --> 00:07:42,110
to the tree channels.
126
00:07:42,110 --> 00:07:44,470
In fact, these two nodes are interchangeable.
127
00:07:44,470 --> 00:07:49,670
The only difference is in the output socket
type, and the channel labels, but as we already
128
00:07:49,670 --> 00:07:52,830
covered, Vectors and Colors are perfectly
compatible.
129
00:07:52,830 --> 00:07:57,169
On the other hand, the Combine HSV node is
a bit of a different story.
130
00:07:57,169 --> 00:08:01,449
Don't let the apparent similarity fool you,
this node doesn't just combine the input values
131
00:08:01,449 --> 00:08:03,419
into the three output channels.
132
00:08:03,419 --> 00:08:09,449
Rather, it actually does a conversion operation,
namely, it converts from HSV to RGB, and those
133
00:08:09,449 --> 00:08:13,229
resulting RGB values are what we get in the
output channels.
134
00:08:13,229 --> 00:08:18,000
When looking at different nodes, we might
see inputs of different data types represented
135
00:08:18,000 --> 00:08:19,550
in multiple ways.
136
00:08:19,550 --> 00:08:24,150
For instance, a Value input can be shown as
a simple text field, or a slider, or as the
137
00:08:24,150 --> 00:08:26,420
slightly sneaky angle field.
138
00:08:26,420 --> 00:08:30,629
The thing about angle fields, indicated by
the degree symbol after the number, is that
139
00:08:30,629 --> 00:08:33,490
they don't actually carry the value shown
in the field.
140
00:08:33,490 --> 00:08:38,160
Internally angles are processed in radians,
and only converted into degrees for display
141
00:08:38,160 --> 00:08:39,440
in the field.
142
00:08:39,440 --> 00:08:44,500
Similarly, when we manually type in a value,
it gets converted and stored in radians.
143
00:08:44,500 --> 00:08:48,550
This gets confusing when we plug in a value
coming from another node, as the value is
144
00:08:48,550 --> 00:08:52,130
not converted, and simply interpreted as radians.
145
00:08:52,130 --> 00:08:56,920
That's because the conversion happens at the
input field level, and not at the socket level.
146
00:08:56,920 --> 00:09:01,640
It's still just a value socket, so plugging
a value in there doesn't trigger any conversion.
147
00:09:01,640 --> 00:09:06,400
The degree conversion is just a UI feature
for convenience.
148
00:09:06,400 --> 00:09:10,770
Meanwhile a vector can be shown as a bare
socket, or have three numeric input fields,
149
00:09:10,770 --> 00:09:13,230
or even this weird shaded sphere.
150
00:09:13,230 --> 00:09:17,560
But we don't have to worry about these input
modes, each one is just to make inputting
151
00:09:17,560 --> 00:09:21,820
data more convenient depending on the specific
application, but they still carry the same
152
00:09:21,820 --> 00:09:22,840
data.
153
00:09:22,840 --> 00:09:26,750
The only thing that matters when connecting
to a socket, is the socket color.
154
00:09:26,750 --> 00:09:31,560
It doesn't matter what the input fields look
like, they will all do the same thing.
155
00:09:31,560 --> 00:09:36,090
Now as for the conversions, as we covered,
plugging a value into a vector just replicates
156
00:09:36,090 --> 00:09:40,690
the value into all the channels, which is
exactly the same as plugging the same value
157
00:09:40,690 --> 00:09:43,790
into all three sockets of a Combine XYZ node.
158
00:09:43,790 --> 00:09:47,590
The advantage of the Combine XYZ node, is
that we can build the vector from different
159
00:09:47,590 --> 00:09:49,590
values if we need to.
160
00:09:49,590 --> 00:09:54,100
Similarly, plugging a Value into a Color is
identical to plugging the same value into
161
00:09:54,100 --> 00:09:58,830
all channels of a Combine RGB node, and the
same advantages as the Vector version apply
162
00:09:58,830 --> 00:10:00,080
here.
163
00:10:00,080 --> 00:10:04,730
Another useful conversion is using the value
to drive a specific characteristic of a Color,
164
00:10:04,730 --> 00:10:08,560
such as the hue, by using a Combine HSV node.
165
00:10:08,560 --> 00:10:14,020
Now, plugging a Vector into a Value will average
the channels, but if instead we want to extract
166
00:10:14,020 --> 00:10:19,350
the value from a specific channel, without
any modification, we can use a Separate XYZ
167
00:10:19,350 --> 00:10:20,410
node.
168
00:10:20,410 --> 00:10:24,630
Another conversion that is often useful, is
extracting a specific characteristic of a
169
00:10:24,630 --> 00:10:29,390
vector, like the length, also known as magnitude,
which we can calculate with the Vector Math
170
00:10:29,390 --> 00:10:32,950
node, but more on that in another chapter.
171
00:10:32,950 --> 00:10:38,020
And finally, plugging a Color into a Value,
behaves identically to the RGB to BW node,
172
00:10:38,020 --> 00:10:40,500
which calculates the relative luminance.
173
00:10:40,500 --> 00:10:45,310
We can also extract a specific channel, like
with Vectors, by using the Separate RGB node,
174
00:10:45,310 --> 00:10:49,890
which again, is interchangeable with the Separate
XYZ node, as their only difference is in the
175
00:10:49,890 --> 00:10:53,260
names of the labels, while they are functionally
identical.
176
00:10:53,260 --> 00:10:58,520
Lastly, we can also extract a specific characteristic
of the color, such as the saturation, by using
177
00:10:58,520 --> 00:11:02,510
a Separate HSV node.
178
00:11:02,510 --> 00:11:06,120
That wraps up our overview of data handling,
and should give you a pretty good idea of
179
00:11:06,120 --> 00:11:09,450
the different types of data, and what kinds
of conversions are available.
19105
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.