MENU

Fun & Interesting

How Shaders Work (in OpenGL) | How to Code Minecraft Ep. 3

GamesWithGabe 119,904 3 years ago
Video Not Working? Fix It Now

Join the Discord: https://discord.gg/4tHeAkxNg7 Follow me on Twitch: https://www.twitch.tv/gameswthgabe In this episode I do a deep dive into the code and concepts behind GLSL shaders. I go over everything from how to construct them, compile and link them, and execute them on the GPU to how to think about shaders conceptually. This is the next episode in the Coding Minecraft tutorial series. In the next episode I will be covering dynamic textures and texture UVs. Challenges: https://github.com/codingminecraft/MinecraftCloneForYoutube/tree/master/Challenges#episode-3-shaders Planet Shader (HamzaHutchinson): https://www.shadertoy.com/view/llj3zV Plus Shader (Nimitz): https://www.shadertoy.com/view/4slXW7 Sierpenski Fractal Shader (Klems): https://www.shadertoy.com/view/XljSWm 3Blue1Brown Linear Transformations: https://www.youtube.com/watch?v=kYB8IZa5AuE Shader Versions: https://en.wikipedia.org/wiki/OpenGL_Shading_Language#Versions GLSL Builtin Variables: https://www.khronos.org/opengl/wiki/Built-in_Variable_(GLSL) Vector Constructors: https://www.khronos.org/opengl/wiki/Data_Type_(GLSL)#Vector_constructors Vector Types: https://www.khronos.org/opengl/wiki/Data_Type_(GLSL)#Vectors glCreateShader: https://www.khronos.org/registry/OpenGL-Refpages/gl4/html/glCreateShader.xhtml glUniform: https://www.khronos.org/registry/OpenGL-Refpages/gl4/html/glUniform.xhtml Qualifier Order: https://www.khronos.org/opengl/wiki/Type_Qualifier_(GLSL)#Qualifier_order My code: https://github.com/codingminecraft/MinecraftCloneForYoutube/tree/a17b58184df76ace1c428563b9eafc3ed426d8dc Bookmarks: 0:00 Intro 1:00 Subscribe! 1:13 Vertex Shader Transformations 3:31 Coding the Transformation Matrix 4:23 Coding the View Matrix 5:48 Coding the Projection Matrix 7:04 How GLSL Works 10:41 GLSL Custom Constructors 11:15 Vector Swizzling 12:43 Compiling Shaders 13:49 Error Checking Compilations 15:30 Linking Shaders 16:24 Error Checking Linking 17:19 GLSL Reflection 19:56 Uploading Uniforms 21:11 In/Out/Flat Keywords 24:00 Shaders Conceptually Shaders at the end of the video: (by Kali): https://www.shadertoy.com/view/NlsXDH (by knarkowicz): https://www.shadertoy.com/view/XtlSD7 (by EvilRyu): https://www.shadertoy.com/view/Xd3fR7 Book of Shaders: https://thebookofshaders.com/ Music from Music Vine Fire (by Raft): https://musicvine.com/track/raft/fire The Gift (by Onsoho): https://musicvine.com/track/onsoho/the-gift Blue Waltz (by Yoav Ilan): https://musicvine.com/track/yoav-ilan/blue-waltz “The Soft Block” licensed via Music Vine: 5KEXLAZZUKPIVGS2 Muse (by Braden Deal): https://musicvine.com/track/braden-deal/muse Tell Your Story (by Adi Goldstein): https://musicvine.com/track/adi-goldstein/tell-your-story “Fickle” licensed via Music Vine: ZX7THVN1L1UQWYD0 --------------------------------------------------------------------- Website: https://ambrosiogabe.github.io/ Github: https://github.com/ambrosiogabe Here are some books I recommend if you want to learn about game engine development more thoroughly. I do not profit off any of these sales, these are just some books that have helped me out :) My Recommended Game Engine Books: Game Engine Architecture: https://www.gameenginebook.com/ Game Physics Cookbook (Read this before the next physics book): https://www.amazon.com/Game-Physics-Cookbook-Gabor-Szauer/dp/1787123669 Game Physics (Ian Millington): https://www.amazon.com/Game-Physics-Engine-Development-Commercial-Grade/dp/0123819768 Game Programming Patterns (Free): https://gameprogrammingpatterns.com/ My Recommended Beginning Game Programming Books: JavaScript Game Design: https://www.apress.com/gp/book/9781430247166 My Recommended Java Books: Data Structures/Algorithms: https://www.amazon.com/Data-Structures-Algorithms-Java-6th-ebook/dp/B00JDRQF8C LWJGL (Free, but I haven't read this thoroughly): https://lwjglgamedev.gitbooks.io/3d-game-development-with-lwjgl/content/

Comment