A student of mine was asking about shaders, so I decided to make a Godot shader tutorial for absolute beginners. I hope you enjoy the video and find it informative! P.S. I'm running a fall sale on my 1-bit Godot 4 course and my LTS turn-based course.
This must be the 20th video I've watched on shaders, and it's the first one that actually made sense, and I was able to follow along with. Please make some more advanced shader videos as this was very helpful.
slightly more advanced, but instead of using an if to change the color a better approach would be using a mix with a smoothstep as the control parameter. this would let you transition from one color to another rather than have a hard cutoff which will tend to alias.
Thank you for the tutorial, very nice. In the if conditions, you could only check the color_average or just one of the components RGB, instead of checking for all RGB components, since they all have the same value.
Excellent video. I would definitely watch more if you were to go deeper into shaders; I have had trouble trying to learn them due to lack of documentation and tutorials. Specifically, practical application of them in your games. How to apply a shader to an object for a specified amount of time, how to apply shaders to all objects in your viewport in a specific area, how to change the area the shader affects, etc.
Thanks a lot for the video Ben. Just in case it could be useful for somebody, there is another good introductory video on Godot shaders on the godotneers channel.
Hey, I just wanted to thank you for everything you did for Godot ! I started a year ago and it's a blast, and I managed to keep learning thanks to your action RPG tutorial ! It's absolutely vital to have quality resources like yours for beginners like I was and I always suggest your series to any newcomer !
this is the first shader tutorial that i really learned! hope to see a whole series of fuctions in shaders! or guys you can recommend me a good shader tutorial
Completely unnecessary nitpick for this simple of a tutorial, but since you should always be thinking of optimization even at the beginner level: If you just set all 3 color values to the same value (color_average), you can save some typing and an eensy-teensy bit of processing time by just checking a single variable for the level. I.e. instead of the if statement (final code line7) could be reduced to just either: if (output_color.r > 7.0) { OR since you just set all 3 color channels to the color_average you could use that in your if statement: if (color_average > 7.0) {
for the if statement in this video why did you check the r g and b of output_color? All 3 are the same value so you could have just checked one of them, alternatively you could have just checked color_average as it would have given the same result.
I ran across a shader that scrolls and copied it but don't really understand it fully shader_type canvas_item; uniform float speed; void fragment () { COLOR = texture(TEXTURE, vec2(UV.x + TIME * speed, UV.y)); } it makes a texture scroll in the "x" axis great for constant scrolling background
It's setting the output color of the pixel to be the color of a pixel to the right of the current pixel based on the TIME that has passed in the game. Uniforms are kind of like export variables in gdscript. It just allows you to change values in the editor. Don't know if that helps you understand it better but thanks for sharing another great example of a basic fragment shader!
more parts would be greatly appreciated as i just spend an hour trying to somehow attach my water reflective shader to camera or player in order to work as i want to :)))
There are already plenty of Godot shader tutorials covering the basics. Are there any tutorials, that are intermediate to advanced, that cover topics such as using the screen buffer? Like I'd like to make an effect that warps the texture and the image behind the alpha channel within the confines of the UV of the object. I have tried to do this myself using what I could derive from shader toy shaders, but never could get it to work.
Could’ve easily simplify that if-statement, since the values are the same anyways. The effect would’ve been the same if you only compared the average you’ve calculated earlier with .8
If you averaged all of the colors into each of the rgb values of output_color then do you really need to compare if each one is > 8? Can't you just check if one of them is greater than 8 since they are all the same for that given pixel?
Hi HeartBeast! I really like your tutorials and appreciate your work. I want to make a game based on your tutorials. I'd like to know if it's available if I recreate the assets based on your works (the pixel guy)? Sorry for messaging here; I couldn't find another way to contact you.
are there any limitations of using the shader graphical editor instead of coding the shader? I mean, Godot does have a node based editor for shaders, why code by hand instead?
It seems Godot devs finally came to their senses and decided to go with GLSL instead of coming up with yet another shader language. They wasted enough time reinventing the wheel with GDScript and a built-in code editor.
@@sametcnlkr I never said they used GDScript for shaders. I said it's a sane decision to *not invent* yet another shader language because they *did invent* yet another *scripting* language (a.k.a. GDScript), which was reinventing a wheel and an enormous waste of time because they could've gone with real Python or LUA or any of the hundreds of existing scripting languages that are also a valid resume entry (the implication here is GDScript isn't universal).
@@schnitzelhannes6431 I am the opposite of ignorant. I have both, the expertize and experience with wide variety of programming languages and different complexity projects, to know wastage when I see it. GDScript is a very thin Python-like layer over the C++ internals of the engine. Even compared to the actual Python It's restrictive, slow, there's less resources teaching the language, way less libraries (there are some in Godot Assets Library but very few). The only good thing I can say about it is that it's easy to read and write, but that's because it's syntax is Python-derived and going with native Python from the beginning would've been as easy to use but easier to implement. And wouldn't be so specific - GDScript strongly depends on under-the-hood C++ implementations implicitly influencing things like memory management and working with different data types. I doubt anything changed on that regard over the last 5 years. I admit, it does have a very good documentation but manual isn't a course - it doesn't teach programming principles so prior programming knowledge is necessary (or at least makes a real difference) when starting to learn it. And someone who already speaks some flavour of C, Rust or other GDNative supported languages doesn't have any imperative whatsoever to switch to this weird incomplete version of Python with few extra magic keywords.
A student of mine was asking about shaders, so I decided to make a Godot shader tutorial for absolute beginners. I hope you enjoy the video and find it informative!
P.S. I'm running a fall sale on my 1-bit Godot 4 course and my LTS turn-based course.
Loved this tutorial! Can you do more for shaders? Thanks!
Oh my goodness I would LOVE a full series on Shaders…these have always terrified me
+1!
+1 too !
+1 excellent explanation, would love to see more!
BABE WAKE UP BEN JUST DROPPED A NEW AWESOME TUTORIAL
Finally a shader tutorial i don't get lost 3 seconds in! Awesome tutorial! More shader tutorials following this one would be very appreciated!
This must be the 20th video I've watched on shaders, and it's the first one that actually made sense, and I was able to follow along with. Please make some more advanced shader videos as this was very helpful.
Really good hands on introduction, thanks
slightly more advanced, but instead of using an if to change the color a better approach would be using a mix with a smoothstep as the control parameter. this would let you transition from one color to another rather than have a hard cutoff which will tend to alias.
This was a great primer for shaders!! Thank you!
Thank you for the tutorial, very nice.
In the if conditions, you could only check the color_average or just one of the components RGB, instead of checking for all RGB components, since they all have the same value.
That is surprisingly intuitive.
Ben, one of those creators you like the video 1st, watch second! Good job as always :) It's good to see you back on youtube :D
Awesome tutorial, thank you! Been very interested to see how you can do shaders in Godot.
Excellent video. I would definitely watch more if you were to go deeper into shaders; I have had trouble trying to learn them due to lack of documentation and tutorials.
Specifically, practical application of them in your games. How to apply a shader to an object for a specified amount of time, how to apply shaders to all objects in your viewport in a specific area, how to change the area the shader affects, etc.
Thank you for this. I would really love to see a series that dives more in depth with shader usage, and tips on how to build your own customized ones.
Wake up Babe, there's a new heartbeast tutorial
Thanks a lot for the video Ben. Just in case it could be useful for somebody, there is another good introductory video on Godot shaders on the godotneers channel.
a perfect introduction!
This looks interesting. I’ll understand more when I try this for myself.
this does a very good job of breaking down the basics. this finally made a lot of what happens in shaders make sense.
Hey, I just wanted to thank you for everything you did for Godot ! I started a year ago and it's a blast, and I managed to keep learning thanks to your action RPG tutorial !
It's absolutely vital to have quality resources like yours for beginners like I was and I always suggest your series to any newcomer !
this is the first shader tutorial that i really learned! hope to see a whole series of fuctions in shaders!
or guys you can recommend me a good shader tutorial
I don't found any beginner tutorial for shaders before. Thanks you! I would love a series for this c:
the GOAT of godot tutorials. keep up the great work my man
Great tutorial, that was very helpful. Would love more videos like this going into other tutorials. You explaining the why and the how is huge.
I was waiting this content! 😍
You are very talanted at explaining things. You dont even need good graphics visualisation for it
LETS GO
Thanks Ben. You are always so useful!!!
Completely unnecessary nitpick for this simple of a tutorial, but since you should always be thinking of optimization even at the beginner level:
If you just set all 3 color values to the same value (color_average), you can save some typing and an eensy-teensy bit of processing time by just checking a single variable for the level. I.e. instead of the if statement (final code line7) could be reduced to just either:
if (output_color.r > 7.0) {
OR since you just set all 3 color channels to the color_average you could use that in your if statement:
if (color_average > 7.0) {
Yo, ben thank you for this tutorial!
for the if statement in this video why did you check the r g and b of output_color? All 3 are the same value so you could have just checked one of them, alternatively you could have just checked color_average as it would have given the same result.
I ran across a shader that scrolls and copied it but don't really understand it fully
shader_type canvas_item;
uniform float speed;
void fragment () {
COLOR = texture(TEXTURE, vec2(UV.x + TIME * speed, UV.y));
}
it makes a texture scroll in the "x" axis great for constant scrolling background
It's setting the output color of the pixel to be the color of a pixel to the right of the current pixel based on the TIME that has passed in the game.
Uniforms are kind of like export variables in gdscript. It just allows you to change values in the editor.
Don't know if that helps you understand it better but thanks for sharing another great example of a basic fragment shader!
@@uheartbeast that actually helped a lot , thanks
Great video, simple and easy to follow.
I will bi nice if you can do intermediate and advance after this video, nice work
more parts would be greatly appreciated as i just spend an hour trying to somehow attach my water reflective shader to camera or player in order to work as i want to :)))
This video was perfectly timed for my game jam project :)
thank you benjamin!
There are already plenty of Godot shader tutorials covering the basics. Are there any tutorials, that are intermediate to advanced, that cover topics such as using the screen buffer? Like I'd like to make an effect that warps the texture and the image behind the alpha channel within the confines of the UV of the object. I have tried to do this myself using what I could derive from shader toy shaders, but never could get it to work.
This channel is in my " if I ever make any money I want to support this project" list. Do you have Patreon or any donation link?
Could’ve easily simplify that if-statement, since the values are the same anyways. The effect would’ve been the same if you only compared the average you’ve calculated earlier with .8
I want more shaders! ))
I feel like I am being attacked with that title but thank you very much 💖
9:45 rbg man, xyz, uvw, hsv, etc...
Finally 🔥🔥
Ben?! What did you do with Benjamin!? :P Lovely first look into shaders for me, thanks!
If you averaged all of the colors into each of the rgb values of output_color then do you really need to compare if each one is > 8? Can't you just check if one of them is greater than 8 since they are all the same for that given pixel?
Hi, could you make a video about how to create a 3d maze/dungeon in Godot?
that's excellent, thanks a lot!
Thanks! :)
What happened to the Wolfenstein 3D clone that you said you would postpone because of a card game tutorial series you said you would do?
That is awesome!
you could probably have used swizzling with the if statement, would've been good to demonstrate it as it is unbelievably useful
the if could also just have checked color_average > 0.8 rather than test every rgb component
@@n__mthat also would've worked
Why when i type texture(TEXTURE, UV) it seas "Unknown indentifier in expresion 'TEXTURE' "?
Nvm found out answer my self :) Thanks for good tutorial.
Hi HeartBeast! I really like your tutorials and appreciate your work. I want to make a game based on your tutorials. I'd like to know if it's available if I recreate the assets based on your works (the pixel guy)? Sorry for messaging here; I couldn't find another way to contact you.
please make this a serie :)
are there any limitations of using the shader graphical editor instead of coding the shader? I mean, Godot does have a node based editor for shaders, why code by hand instead?
nice one
nice. rizz accepts it😉
It seems Godot devs finally came to their senses and decided to go with GLSL instead of coming up with yet another shader language. They wasted enough time reinventing the wheel with GDScript and a built-in code editor.
@@sametcnlkr And I'm saying it's a sensible decision. What's your point?
@@sametcnlkr I never said they used GDScript for shaders. I said it's a sane decision to *not invent* yet another shader language because they *did invent* yet another *scripting* language (a.k.a. GDScript), which was reinventing a wheel and an enormous waste of time because they could've gone with real Python or LUA or any of the hundreds of existing scripting languages that are also a valid resume entry (the implication here is GDScript isn't universal).
GDScript is an awesome language with very good reasons for using it. If you dont see this youre just ignorant
I love gdscript and the build-in code editor so for me their efforts on those fronts are very appreciated.
@@schnitzelhannes6431 I am the opposite of ignorant. I have both, the expertize and experience with wide variety of programming languages and different complexity projects, to know wastage when I see it. GDScript is a very thin Python-like layer over the C++ internals of the engine. Even compared to the actual Python It's restrictive, slow, there's less resources teaching the language, way less libraries (there are some in Godot Assets Library but very few). The only good thing I can say about it is that it's easy to read and write, but that's because it's syntax is Python-derived and going with native Python from the beginning would've been as easy to use but easier to implement. And wouldn't be so specific - GDScript strongly depends on under-the-hood C++ implementations implicitly influencing things like memory management and working with different data types. I doubt anything changed on that regard over the last 5 years. I admit, it does have a very good documentation but manual isn't a course - it doesn't teach programming principles so prior programming knowledge is necessary (or at least makes a real difference) when starting to learn it. And someone who already speaks some flavour of C, Rust or other GDNative supported languages doesn't have any imperative whatsoever to switch to this weird incomplete version of Python with few extra magic keywords.
Do moreeeeeeeeeeeeeeeee 🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏
Great another language i have to learn 😑