Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:00,240 --> 00:00:02,960
With the tiling done, we can
form the shape of our bricks.
2
00:00:03,840 --> 00:00:08,800
For this we'll be using a distance field, which is
basically a gradient that represents the closest
3
00:00:08,800 --> 00:00:14,960
distance to any point on a given surface. Let's
see how we can approach this in logical steps.
4
00:00:15,680 --> 00:00:18,720
Let's first make some space here,
and we'll bypass the tiling for now,
5
00:00:18,720 --> 00:00:21,760
as just one instance makes it
easier to visualize everything.
6
00:00:22,480 --> 00:00:26,240
Looking at each channel separately, we
can split our plane into two fields,
7
00:00:26,240 --> 00:00:31,760
with a Less Than operation. This gives us an
output of one for any input below the threshold,
8
00:00:31,760 --> 00:00:36,800
and a value of zero everywhere else. So with the
threshold we can set the position of the split.
9
00:00:39,920 --> 00:00:45,040
By adding an Absolute operation to a gradient,
we can create symmetry, as all the values below
10
00:00:45,040 --> 00:00:52,000
zero will get flipped. So feeding this into
the Less Than operation now creates a band.
11
00:00:53,680 --> 00:00:57,760
We can repeat this with the Y axis, and
combine them with a Minimum operation,
12
00:00:57,760 --> 00:01:00,400
which outputs the lowest of the two input values.
13
00:01:02,080 --> 00:01:07,120
This gives us a rectangle, as everywhere outside
this shape at least one of the values is zero,
14
00:01:07,120 --> 00:01:12,160
the lowest of the two values, thus cutting
off the band of the other axis. When using
15
00:01:12,160 --> 00:01:17,120
the Minimum operation on binary values, like this,
you can think of it like a boolean intersection.
16
00:01:18,480 --> 00:01:22,240
Instead of the two absolutes, we can use
a Vector Math node before the separate,
17
00:01:22,240 --> 00:01:25,840
to compute the absolute value
of all channels at once.
18
00:01:26,640 --> 00:01:30,800
But this setup is still not ideal, with the
two Less Than operations for us to control,
19
00:01:30,800 --> 00:01:34,960
and it doesn't really give us much flexibility
to, for example, round the corners.
20
00:01:34,960 --> 00:01:38,080
A better approach is to just
remove these Less Than operations,
21
00:01:38,080 --> 00:01:42,320
and switch this Minimum to a Maximum. This
will give us a gradient in a square shape.
22
00:01:44,720 --> 00:01:48,560
This works because along the diagonals,
both gradients have the same value,
23
00:01:48,560 --> 00:01:53,600
and within each triangular section, the gradient
that runs along that axis has a greater value than
24
00:01:53,600 --> 00:02:00,320
the other gradient. So taking the Maximum,
which outputs the largest of the two inputs,
25
00:02:00,320 --> 00:02:07,840
we are basically selecting which of
the gradients to use for each section.
26
00:02:10,000 --> 00:02:14,560
If we add a Less Than after this, we get a
square that we can control with a single value.
27
00:02:14,560 --> 00:02:18,720
Then we can let the ratio multiplier in the
Bricks group determine the ratio of the shape.
28
00:02:19,360 --> 00:02:22,720
Now if we just neaten this up a bit,
and plug it after the bricks setup,
29
00:02:22,720 --> 00:02:25,360
we see that it doesn't quite behave as we'd like.
30
00:02:25,360 --> 00:02:29,360
That's because this square setup was using the
origin of the coordinate space as the center,
31
00:02:29,360 --> 00:02:32,960
while our bricks have the origin in
the lower left corner like a UV tile.
32
00:02:34,080 --> 00:02:38,080
To fix this, we can just subtract
0.5 from our X and Y coordinates,
33
00:02:38,080 --> 00:02:40,720
moving the (0,0) point to
the center of the bricks.
34
00:02:44,560 --> 00:02:47,840
Now if we adjust the threshold, we
can change the size of the bricks,
35
00:02:47,840 --> 00:02:49,840
and they are centered correctly.
36
00:02:52,080 --> 00:02:55,360
Now we have the issue of the mortar
gaps being different in each axis.
37
00:02:57,440 --> 00:03:01,200
This is because we scaled the axes by
different amounts, making the gradients
38
00:03:01,200 --> 00:03:05,840
have different slopes, so the mortar gaps are
being scaled proportionately. And by slope,
39
00:03:05,840 --> 00:03:09,520
I mean how much the value in the
gradient changes over a certain distance.
40
00:03:10,240 --> 00:03:14,160
We can fix the slope difference by taking
the transformation we did before the tiling
41
00:03:14,160 --> 00:03:19,280
and applying it in reverse after the tiling. So
let's tab into the Bricks group, to add a Size
42
00:03:19,280 --> 00:03:24,240
output that will allow us to access the X and Y
dimensions of the bricks from outside the group.
43
00:03:24,240 --> 00:03:28,560
We can then use these dimensions to scale the
vector, and correct the different scaling.
44
00:03:29,440 --> 00:03:33,680
Here we are multiplying our brick dimensions,
but our goal is to reverse this operation,
45
00:03:35,200 --> 00:03:40,560
so let's output the inverse of this scaling
factor, which is equal to one over the value.
46
00:03:40,560 --> 00:03:45,600
Then we can duplicate this Combine XYZ
node, and connect our factor to the Y input,
47
00:03:45,600 --> 00:03:49,120
as we want to scale the vertical
coordinate. And then we can connect
48
00:03:49,120 --> 00:03:53,440
this as a new group output and name it.
Something like Size seems appropriate.
49
00:03:54,640 --> 00:03:59,280
Now we can multiply our vector. Note that here
we are multiplying by the inverse of the scaling,
50
00:03:59,280 --> 00:04:02,720
which is the same as dividing this
value by the non-inverted scaling,
51
00:04:02,720 --> 00:04:06,480
but having the inversion precomputed will
be convenient for other things later.
52
00:04:07,120 --> 00:04:11,600
Now we can visualize that the slopes are the same
by looking at the result of the Maximum operation.
53
00:04:12,160 --> 00:04:17,040
Here, with equal slopes, we see that all the
diagonals are at 45 degrees from the axes,
54
00:04:17,040 --> 00:04:19,440
while with different slopes,
their angles will be different.
55
00:04:20,320 --> 00:04:25,040
But this creates a new problem. Our shape is
now a square. What we want to do is offset
56
00:04:25,040 --> 00:04:29,280
the gradients such that the proportions
align with the boundaries of our tiling.
57
00:04:29,280 --> 00:04:34,160
This will make more sense if we think of the setup
slightly differently. So far, we have been looking
58
00:04:34,160 --> 00:04:38,800
at gradients from the center going outwards
along the axes, but we can better transform
59
00:04:38,800 --> 00:04:43,280
them such that they start at the boundaries
of the tiles, and go up towards the center.
60
00:04:43,280 --> 00:04:47,520
That way, no matter how we scale the gradients,
the value on the tile boundary will not change
61
00:04:47,520 --> 00:04:52,320
or shift, as a value of zero doesn't change
when multiplied, and acts as the scaling pivot.
62
00:04:53,600 --> 00:04:58,000
Before we rescaled the gradients, they
all had a value of 0.5 at the boundaries,
63
00:04:58,000 --> 00:05:02,560
so we can subtract that same amount from
them, to set that as the zero point. But now
64
00:05:02,560 --> 00:05:07,760
our gradients shifted into negative values, so
we want to invert them. Instead of multiplying
65
00:05:07,760 --> 00:05:11,760
by minus one, we can just flip the terms of
the subtraction, which has the same effect.
66
00:05:12,480 --> 00:05:16,160
Now that we inverted the direction of
the gradients, we also need to invert
67
00:05:16,160 --> 00:05:22,080
the operation joining them, so instead of
Maximum let's use Minimum over here. We now
68
00:05:22,080 --> 00:05:26,880
have basically the same thing we started with, but
the magic happens when we re-enable the scaling.
69
00:05:29,040 --> 00:05:33,360
We now have gradients with the same rate,
as we can verify by the 45 degree diagonals,
70
00:05:34,400 --> 00:05:36,480
but instead of forming a shape from the center,
71
00:05:36,480 --> 00:05:39,920
we are effectively calculating the
distance to the boundaries of the tiles.
72
00:05:40,880 --> 00:05:44,080
This is known as a distance field.
Which is basically a field of values
73
00:05:44,080 --> 00:05:51,840
where each value represents the closest
distance to any point on a given surface.
74
00:05:53,280 --> 00:05:56,640
And here we just computed the internal
distance field of a rectangle.
75
00:05:59,600 --> 00:06:03,200
Now, when we change the threshold, we
are actually changing how far away from
76
00:06:03,200 --> 00:06:07,280
the boundaries the mask ends, making the
mortar gaps equally spaced everywhere.
77
00:06:12,240 --> 00:06:17,360
To recap, we now have the tiled coordinates coming
from the Bricks group, we are subtracting 0.5 to
78
00:06:17,360 --> 00:06:21,520
offset the coordinates to the center of the
bricks, as our range goes from zero to one
79
00:06:21,520 --> 00:06:26,480
in each axis, then we are taking the absolute
to mirror the coordinates, and finally, we are
80
00:06:26,480 --> 00:06:31,440
subtracting the coordinates from 0.5, to offset
the origin back to the boundary of the bricks,
81
00:06:31,440 --> 00:06:35,360
but this time mirrored, such that the
coordinates are zero on all sides,
82
00:06:35,360 --> 00:06:39,520
reaching the highest value in the middle,
instead of being zero in the lower left corner,
83
00:06:39,520 --> 00:06:44,320
and going up to the upper right corner. After
all that, we are scaling the coordinates by
84
00:06:44,320 --> 00:06:48,240
the inverse of the brick scaling factor,
to correct the slope of our gradients.
85
00:06:50,160 --> 00:06:54,000
There is just one small modification that
we can make to this setup that will make our
86
00:06:54,000 --> 00:06:59,520
lives easier later on. Here we are correcting
the aspect ratio after the Absolute operation,
87
00:06:59,520 --> 00:07:01,840
but later we will also want to have access to an
88
00:07:01,840 --> 00:07:06,240
aspect corrected coordinate space that is
not mirrored by the Absolute operation.
89
00:07:06,240 --> 00:07:10,880
So instead of computing this twice, we can just
move the multiplication before the Absolute.
90
00:07:10,880 --> 00:07:14,960
This does not change the result of the
absolute, but it does change the subtraction,
91
00:07:14,960 --> 00:07:19,360
as our range is no longer from zero in
the middle to 0.5 at the boundaries.
92
00:07:19,360 --> 00:07:29,840
So we just need to multiply our offset by
the same scaling factor to correct for that.
11542
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.