Afrikaans
Akan
Albanian
Amharic
Arabic
Armenian
Azerbaijani
Basque
Belarusian
Bemba
Bengali
Bihari
Bosnian
Breton
Bulgarian
Cambodian
Catalan
Cebuano
Cherokee
Chichewa
Chinese (Traditional)
Corsican
Croatian
Czech
Danish
Dutch
English
Esperanto
Estonian
Ewe
Faroese
Filipino
Finnish
French
Frisian
Ga
Galician
Georgian
German
Greek
Guarani
Gujarati
Haitian Creole
Hausa
Hawaiian
Hebrew
Hindi
Hmong
Hungarian
Icelandic
Igbo
Indonesian
Interlingua
Irish
Italian
Japanese
Javanese
Kannada
Kazakh
Kinyarwanda
Kirundi
Kongo
Korean
Krio (Sierra Leone)
Kurdish
Kurdish (Soranรฎ)
Kyrgyz
Laothian
Latin
Latvian
Lingala
Lithuanian
Lozi
Luganda
Luo
Luxembourgish
Macedonian
Malagasy
Malay
Malayalam
Maltese
Maori
Marathi
Mauritian Creole
Moldavian
Mongolian
Myanmar (Burmese)
Montenegrin
Nepali
Nigerian Pidgin
Northern Sotho
Norwegian
Norwegian (Nynorsk)
Occitan
Oriya
Oromo
Pashto
Persian
Polish
Portuguese (Brazil)
Portuguese (Portugal)
Punjabi
Quechua
Romanian
Romansh
Runyakitara
Russian
Samoan
Scots Gaelic
Serbian
Serbo-Croatian
Sesotho
Setswana
Seychellois Creole
Shona
Sindhi
Sinhalese
Slovak
Slovenian
Somali
Spanish
Spanish (Latin American)
Sundanese
Swahili
Swedish
Tajik
Tamil
Tatar
Telugu
Thai
Tigrinya
Tonga
Tshiluba
Tumbuka
Turkish
Turkmen
Twi
Uighur
Ukrainian
Urdu
Uzbek
Vietnamese
Welsh
Wolof
Xhosa
Yiddish
Yoruba
Zulu
We made the wall look much more interesting in the last chapter, by randomizing the depth
of the bricks.
But we can also randomize their rotation, so that they are not all parallel to the plane.
This is especially nice, because it will change the shading on the bricks as they will get
lit from different angles.
In Chapter 7, we already randomized the 2D rotation of the bricks, so that they are not
completely horizontal, but let's now randomize the rotation in the two remaining axes.
There are many ways to approach this, but probably the easiest, is to just think of
what effect a brick rotation would have on the surface.
If we just consider a rotation around the vertical axis, the result would be that one
end of the brick sticks out of the wall more than the other.
Looking at the height map, that's basically just a linear gradient along the brick.
And the same goes for a rotation around the horizontal axis, it is just a gradient along
the height of the brick.
So to randomize the rotation, we would need to generate random linear gradients.
One way to achieve that, would be with an actual vector rotation.
If we take a look at the centered brick coordinates that we computed early on in the course, we
have an X value that changes horizontally, and a Y value that changes vertically, but
actually, we also have a Z value, which indicates depth, we just don't see it here, because
it is zero everywhere.
Now this becomes useful when we add a vector rotation.
Rotating around the plane's Z axis just rotates the 2D coordinates like we saw before, but
there is no change in the Z channel.
But it gets more interesting when we set the rotation to something like the Y axis.
Now, changing the angle, we start seeing a blue gradient, which is the Z channel being
rotated as well.
This is more clear if we look at a three dimensional object and see how all the coordinates are
rotating.
Our plane is just a cross section of those coordinates.
Now if we isolate the Z channel with a Separate XYZ node, we can see that we have a gradient
that varies with the rotation amount.
Note that the side that is black is not actually constant, it's the same as the other side,
but in the negative direction.
And if we now set the rotation to the X axis, we get the same thing happening in the other
direction.
But to generate the random rotation, we don't want to rotate around a specific axis.
Instead, we can set it to do an Euler rotation, which allows us to input the angle of rotation
for each axis as a vector.
Then we see that the gradient can go in all sorts of directions.
Let's bring this setup close to where we randomized the depth, as we can make use of the same
White Noise node for our random input.
Then let's neaten this node connection a bit, so that it's not overlapping everything.
To access all the random channels, we'll need a Separate RGB again.
Then let's also make some extra space here, and while we're at it, we can join these two
connections with a Reroute.
Then let's move these nodes over, and carry their input over from the Value output, to
the equivalent R channel, just to keep everything consistent.
Then we can drag our new nodes into the Frame, and finish straightening the connection.
Now, to feed the random values into the X and Y rotation channels of the Vector Rotate
node, we'll need a Combine XYZ node.
And then we can plug the two remaining random channels into X and Y, and plug the output
into the Vector Rotate.
Now our gradients are randomized, but the top left corner is always at a higher value
than the bottom right corner, and that's because with the random values between zero and one,
we are always rotating in the positive direction, so let's add a Vector Math node here, to subtract
0.5 from X and Y, so that they are centered around zero.
And now we have truly random gradients.
The specific amount of rotation isn't that important, as we can scale how much we want
to displace the height of the bricks by adding a Math node to the gradients themselves and
multiplying the intensity of the effect.
Finally, let's move these nodes over, so that we can add our rotation gradient onto the
brick height map.
Now if we look at the output, and increase the rotation intensity, we see the gradients
show up on some of the bricks.
Now, if we switch to Cycles, and look at the final output, setting the rotation intensity
to a high value, like ten, really shows the effect.
But let's set it to a more sensible value, like five.
Note that because we are doing this before we combine the bricks with the mortar, the
mortar respects the brick rotation, and the ends of the bricks that are rotated into the
wall, get buried in the mortar, which is a pretty nice effect.
But maybe we're seeing a bit to much of this happening all over the place, so let's compensate
by reducing the subtraction that we added in the last chapter, so that our bricks move
back out of the wall a bit.
Now we still have the mortar over the bricks, but it's a bit more balanced.
Now the only thing left to do, is renaming the Frame, as it's not just about the depth
anymore, but also the rotation.
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.