The MOST IMPORTANT Shader Method | Godot Shader Beginners!

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
[Music] what if someone started crack while remaking the c programming language well that's c plus plus but what if it was graphics hi i'm nikoto and i'm a certified [Music] [Applause] [Music] most of the code in a game governs the game's logic ways in which inputs are processed into the game actions enemy ai responds to things the player does and various behind the scenes stuff most of you probably write this using gd script c sharp or c plus if you're a masochist but shaders are a little different the sole purpose of a shader is to manipulate basically anything that can be rendered to the screen video uses opengl to render things and so it uses a glsl where gl in glsl stands for opengl because somebody forgot how acronyms work to be very frank i get confused between these terms pretty often myself there's glsl hlsl cg lsd remember how i said godot uses glsl well that was a lie godot actually uses a simplified custom version of glsl that is tightly integrated with the engine and has the added benefit of less features of course there's ways to work around this i've made literally every shader you've seen on this channel but how [Music] textures are really just images and images come in all sorts of different sizes called resolutions applying a texture onto an object though poses several problems take for instance the humble rectangle which is also called a quad if i wanted to apply a 256 by 256 texture onto it i could place the pixel at 0 0 on the top left while placing the pixel at 256 to 56 on the bottom right and let everything else just be in between that but what if i change the resolution to 512x512 now only a quarter of the whole image is displayed on this squad which is no good instead a system was needed where we could just place the beginning of the texture at the beginning of the object and the end of the texture at the end of the object this is what the uv system does where u is the x-axis and v is the y-axis because the creators just decided to name their coordinates after letters that absolutely no one is familiar with the uv runs from 0 to 1 on both axes meaning that 0 0 is the top left of the texture and 1 1 is the bottom right of the texture regardless of what its resolution is but that's not what shaders are about shaders are meant to manipulate stuff for example if i wanted to move a texture in some direction i can simply just add that direction to the uv coordinate when sampling the texture [Music] if you have already completed the stereotypical procedural minecraft clone of being an indie game developer watched a sebastian log video have nothing better to do in life or worse studied computer science at a university then you might be familiar with the term purlin noise noise functions are just a bunch of math that produces cool wavy looking stuff there are many different kinds of wavy noise patterns such as the aforementioned purlin noise simplex noise and whirly noise that has the cool voronoi dlc that looks nothing like anything the output of these mathematical functions can be stored onto pixels on a texture creating a noise texture ideally these values would lie somewhere in the range between 0 and 1 if we exclude the people who use hdr values or are otherwise referred to as lunatics we can read this noise texture the same way we read any other texture using our uv system but since reading this texture returns a value between 0 and 1 we can add that to the uv coordinates of literally anything else and create these cool wave-like distortions if we multiply the noise value by a number less than 1 we can tone down its strength and there you go you now know how to make 95 of all shaders that have ever been created don't believe me background distortion effect just add the noise to the screen textures uv coordinates grass waving in the wind use three noise values and add them on each axis of the grass plate's position smash ultimate's character selection background just take the average of two noise values moving at different speeds and add color to them clouds in the sky use one noise value to determine the color and then subtract a second noise value to make some parts invisible waving leaves take a 2d noise texture and offset it using the y value of the leaves then sample it and do basically the same thing as with the grass and basically every other shader is the same nonsense i just described to you who said shaders were hard [Music] people keep asking me how do i get into shaders isn't there a lot of math involved nah just move uv coordinates with a noise texture and you'll probably be able to make anything and don't worry about the syntax either like any language you'll pick it up the more you use it of course everything i've talked about is a gross oversimplification of the nightmare fuel that goes into the shaders that i make it doesn't include anything talking about but the truth is unless you're making some kind of aaa based grass physics system like me you probably don't need to run into too many of those things most of the shaders i've written usually just have something to do with noise textures and uv coordinates but perhaps i ought to explain the edge functions and interpolation in a future video after all with just those three you'd be able to make [Music] [Applause] [Music] so [Music] [Music] oh [Music] interested in shaders well i do a lot of tutorials on them and i try to make things easy and fun so sub to my channel [Music] foreign
Info
Channel: NekotoArts
Views: 32,026
Rating: undefined out of 5
Keywords: Nekoto, Nekoto Arts
Id: OG-rRVpjxFw
Channel Id: undefined
Length: 7min 12sec (432 seconds)
Published: Tue Mar 29 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.