In this video we complete the Phong lighting model by implementing specular lighting.
For the demo I'm using the 'Antique Ceramic Vase' model by James Ray Cock: https://polyhaven.com/a/antique_ceramic_vase_01
Make sure to watch all the previous tutorials in the "OpenGL For Beginners" playlist at https://youtube.com/playlist?list=PLA0dXqQjCx0S04ntJKUftl6OaOgsiwHjA
Please visit https://ogldev.org to see more of my tutorials on modern OpenGL.
Link to source: https://github.com/emeiri/ogldev/blob/master/tutorial
OpenGL 4.6 specification: https://www.khronos.org/registry/OpenGL/specs/gl/glspec46.core.pdf
Timecodes:
0:00 Intro
1:08 The specular effect
2:10 Calculating the specular factor
4:40 The specular exponent
5:56 Setting the specular exponent
6:56 The final light equation
8:37 Reflecting the light vector
10:59 Coordinate space considerations
11:30 World to local space transform
13:19 Code review
13:27 The Material class
13:54 Changes to the BasicMesh
15:36 Changes to the LightingTechnique
16:44 Output local pos from the VS
17:19 Add the specular factor to the FS
20:15 Changes to the main application code
20:23 Set the specular exponent texture unit
21:09 Transform the light position from world to local space
22:23 The final result
Feel free to comment below.
Email: ogldev1@gmail.com
Facebook: https://www.facebook.com/Ogldev-188319114585587
GIthub: https://github.com/emeiri/ogldev.git
Twitter: @ogldev
One time donations (Paypal): https://ogldev.org/donate.html
Patreon: https://www.patreon.com/ogldev
My gear (Amazon affiliate links):
Camera - Canon EOS M50: https://amzn.to/3duVIOh
Camera mic - Rode Videomic: https://amzn.to/3dsGVDs
Desktop mic - Rode NT-USB-Mini: https://amzn.to/3giMoif
Credits:
Music - "Dreams" by https://bensound.com
Images from https://pixabay.com by pen_ash, fancycrave1, Free-Photos, Rudy and Peter Skitterians, TravelCoffeeBook, No-longer-here, Artturi Mäntysaari, Jill Wellington and Couleur.
Enjoy,
Etay Meiri
#opengl #ogldev #opengtutorials