AEJuice Free Plugins [ Ссылка ]
AEJuice I Want It All Bundle [ Ссылка ]
AEJuice YouTube Channel [ Ссылка ]
In this video we will learn how to implement diffuse lighting which is the second type of light in the Phong Reflection Model. We've covered ambient lighting in the previous tutorial and specular lighting will be covered in the next one.
In this tutorial I have used the following public domain assets:
Wine barrel model - [ Ссылка ] by James Ray Cock
Terrain texture - [ Ссылка ] by Rob Tuytel
Thanks a lot to James and Rob for providing their creations!
🔥 I'm using the following books as background information for my tutorials and I highly recommend them for learning more about OpenGL and Vulkan.
These are affiliate links so if you use them to buy the books the price is the same for you and I will get a small commision (thank-you!).
📖 OpenGL 4 Shading Language Cookbook - Third Edition: Build high-quality, real-time 3D graphics with OpenGL 4.6, GLSL 4.6 and C++17 3rd ed. Edition: [ Ссылка ]
📖 3D Graphics Rendering Cookbook: A comprehensive guide to exploring rendering algorithms in modern OpenGL and Vulkan: [ Ссылка ]
(Watch my short video review on this book: [ Ссылка ])
📖 Vulkan Programming Guide: The Official Guide to Learning Vulkan: [ Ссылка ]
(Watch my short video review on this book: [ Ссылка ])
Make sure to watch all the previous tutorials in the "OpenGL For Beginners" playlist at [ Ссылка ]
Please visit [ Ссылка ] to see more of my tutorials on modern OpenGL.
Link to source: [ Ссылка ]
If you want to get the same version that was used in the video checkout the tag TUT_20_DIFFUSE_LIGHTING.
OpenGL 4.6 specification: [ Ссылка ]
Timecodes:
0:00 Intro
0:57 Light sources types
3:02 The diffuse light factor
3:51 Lambert’s Cosine Law
4:33 Diffusely reflecting surface
5:10 The surface normal
6:11 Calculating the diffuse factor
7:29 Surface vs Vertex normals
9:00 Transforming the normal
10:27 Diffuse lighting in local space
11:05 Generating the world-to-local matrix
12:37 Code Review
12:45 Step 1: Add a diffuse component to the material
13:36 Step 2: Create a directional light with a diffuse component
14:50 Step 3: Calculate the light direction in local space
16:01 Step 4: Add uniform locations for shader diffuse params
16:37 Step 5: Add vertex normal to the vertex shader
17:22 Step 6: Implement diffuse lighting in the fragment shader
19:39 Step 7: Minor changes to the main app code
20:17 Test and experiment
Feel free to comment below.
Email: ogldev1@gmail.com
Github: [ Ссылка ]
Twitter: @ogldev
One time donations (Paypal): [ Ссылка ]
Patreon: [ Ссылка ]
Credits:
Music - "Small Guitar" from [ Ссылка ]
Duke Nukem image - [ Ссылка ]
Johann Heinrich Lambert pic - [ Ссылка ]
Cosine pic - [ Ссылка ]
Enjoy,
Etay Meiri
#opengl #ogldev #opengtutorials
Diffuse Lighting // OpenGL Tutorial #20
Теги
ogldevopenglopengl tutorialsetay meirimodern openglopengl for beginnersgraphics programming3d programmingtriangle renderingshadersopengl c++ tutorialslearning openglopengl trainingopengl tutorial ubuntuopengl tutorial linuxopengl tutorialopengl game developmentopengl dev c++diffuse lightingopengl diffuse lightingdiffuse lighting in openglopengl phongopengl vertex normals