Introduction to Phong Lighting

  Рет қаралды 13,507

Suboptimal Engineer

Suboptimal Engineer

Күн бұрын

In this GLSL shader tutorial, we will go over the basics of Phong lighting. We start off by understanding the importance of lighting in computer graphics. Then we will look at the intuition behind the Phong lighting equation. Finally, we add ambient, diffuse, and specular lighting to our GLSL fragment shader.
📖 Code - github.com/SuboptimalEng/shad...
🐦 Twitter - / suboptimaleng
💻 GitHub - github.com/SuboptimalEng
🌎 Website - suboptimaleng.com
== [ Resources ] ==
Inigo Quilez’s Articles - iquilezles.org/articles
The Book of Shaders - thebookofshaders.com
Simon Dev’s Shader Course - simondev.teachable.com
VS Code GLSL Shader Setup Guide - • How to Write GLSL Shad...
== [ Timestamps ] ==
00:00 Intro to GLSL Shaders
01:12 What is Phong Lighting?
01:45 Ambient vs Diffuse vs Specular
03:02 Ambient Lighting
04:16 Diffuse Lighting
05:57 Specular Lighting
08:26 Phong Lighting Demos
== [ Tags ] ==
#suboptimal #glsl #shaders

Пікірлер: 38
@Byynx
@Byynx Жыл бұрын
It seems the best lightning tutorial so far.
@ksalarang
@ksalarang Жыл бұрын
Exactly what I was looking for, thanks. Keep up the good work
@JackLeiLing
@JackLeiLing 3 ай бұрын
Liked and subscribed! The most clearer explanation for this difficult topic. Super helpful. Many thanks
@SuboptimalEng
@SuboptimalEng 2 ай бұрын
I made the video because I was learning phong lighting and struggled to understand it. Glad it helped!
@OrgStinx
@OrgStinx 9 ай бұрын
Thanks, I appreciate this.
@calderarox
@calderarox 10 ай бұрын
this is a really good video! thanks
@justanotherhotguy
@justanotherhotguy Жыл бұрын
Tomorrow exam in real time computer graphics, thank you very much!
@SuboptimalEng
@SuboptimalEng Жыл бұрын
Good luck!
@nexusplus4960
@nexusplus4960 Жыл бұрын
Hi when I import model in three js. model load with light what should I do??
@Coding_and_Gaming
@Coding_and_Gaming Ай бұрын
Thank you very clear simple but enough detailed explanation especially graphics of the calculations are very useful thank you again for this great video
@SuboptimalEng
@SuboptimalEng Ай бұрын
Glad you found it useful!
@nebuladevelopments
@nebuladevelopments Жыл бұрын
awesome!
@Iridium.
@Iridium. 6 ай бұрын
You can use a halfway vector instead of reflect for better performance
@SuboptimalEng
@SuboptimalEng 28 күн бұрын
Recently learned about this watching Cem Yuksel’s Utah course!
@susussususuususuusuuususussusu
@susussususuususuusuuususussusu 28 күн бұрын
life changing lesson :0
@thesituation5315
@thesituation5315 Жыл бұрын
Hi. I've been trying to learn how lighting works, and I'm having a really hard time with this. I understand the base of the whole idea, but the part I'm having a hard time with is how to make it work in 2D. I was wondering if you know how to port it to two dimensions? I can't really find anything online specifically regarding 2D phong shading.
@OrgStinx
@OrgStinx 9 ай бұрын
Do you mean lighting in 2D world (e.g. for 2d games) or how to cast 3D world to 2D screen?
@pingwinek_1337
@pingwinek_1337 Жыл бұрын
your voice is so soothing oh my gawddd
@SuboptimalEng
@SuboptimalEng Жыл бұрын
Guess I’ll have to start an ASMR channel now jk… unless 🤔😂
@pingwinek_1337
@pingwinek_1337 Жыл бұрын
@@SuboptimalEng UNLESS
@diddy_dante
@diddy_dante 9 ай бұрын
If fragment shaders work on a pixel by pixel basis, does the rasterizer also give eye-direction vector values for each pixel? I can't understand how else you could pull off specular lighting.
@SuboptimalEng
@SuboptimalEng 9 ай бұрын
I fake the eye direction in the code, setting it to -1 in the Z axis.
@javifontalva7752
@javifontalva7752 Жыл бұрын
Wonderful vid!! Can you make more vida on shaders?
@SuboptimalEng
@SuboptimalEng Жыл бұрын
That’s the plan!
@MrMariozzz78
@MrMariozzz78 2 ай бұрын
i use opegl in dev c++ gl library i guess it pre 2.0 so it dont use GLSL ...can i use phong light with 2.0 pre.version?
@konigsberg72
@konigsberg72 Жыл бұрын
what's the song? 00:00
@kevinto8955
@kevinto8955 Жыл бұрын
Yes more shaders! Curious, what was your roadmap for learning all this? I'm reading through the book of shaders, but once I'm off it, I feel totally lost :(
@SuboptimalEng
@SuboptimalEng Жыл бұрын
I started with the book of shaders and got stuck as well. Good to hear I’m not the only one who felt this way tbh. SimonDev’s GLSL shader course helped me learn a lot more quickly! I’ve talked about this more extensively on Twitter. And yep, I plan to make more videos on shaders 😊
@janreinsch9725
@janreinsch9725 3 ай бұрын
So, what I found confusing is that the vector is named lightSource... Isn't this actually the lightDirection and the lightSource is at a point infinitely far away, so that all light rays hit the scene at the same angle?
@SuboptimalEng
@SuboptimalEng 3 ай бұрын
Yea that’s a good question. I think a better name for the variable would be direction to light source from origin.
@janreinsch9725
@janreinsch9725 3 ай бұрын
@@SuboptimalEng Thanks for your answer! I named it relativeLightPos in my exercises, because that gives me the intuition that the light is always coming from the same direction for all objects of the scene
@SuboptimalEng
@SuboptimalEng 3 ай бұрын
@@janreinsch9725 That's great to hear! Happy to help a fellow graphics enthusiast.
@janreinsch9725
@janreinsch9725 3 ай бұрын
@@SuboptimalEng Thank you for these tutorials!
@AllianceHalifax
@AllianceHalifax Жыл бұрын
where is the duck model in the code?
@SuboptimalEng
@SuboptimalEng Жыл бұрын
The duck model is included in the VS Code extension! I made a video explaining how to set it up 🙂
@ku16610
@ku16610 6 ай бұрын
Yes but not explaining how to show the duck model ...... @@SuboptimalEng
@ku16610
@ku16610 6 ай бұрын
Click on the glslCanvas left most icon at bottum to change object
@alberoDiSpazio
@alberoDiSpazio 10 ай бұрын
There's a Monopoly Game app that has that duck, fully shaded.
Introduction to Signed Distance Fields
9:00
Suboptimal Engineer
Рет қаралды 24 М.
Writing a Basic Renderer in OpenGL
14:43
The Cherno
Рет қаралды 118 М.
Cat Corn?! 🙀 #cat #cute #catlover
00:54
Stocat
Рет қаралды 15 МЛН
Зачем он туда залез?
00:25
Vlad Samokatchik
Рет қаралды 3 МЛН
An introduction to Raymarching
34:03
kishimisu
Рет қаралды 128 М.
Introduction to shaders: Learn the basics!
34:50
Barney Codes
Рет қаралды 303 М.
What Is 𝓖𝓸𝓸𝓬𝓱 Shading?
7:07
Acerola
Рет қаралды 86 М.
История компьютерной графики
14:21
ViewTronic3k
Рет қаралды 157 М.
An introduction to Shader Art Coding
22:40
kishimisu
Рет қаралды 943 М.
Giving Personality to Procedural Animations using Math
15:30
t3ssel8r
Рет қаралды 2,4 МЛН
Computer Graphics Tutorial - PBR (Physically Based Rendering)
13:40
Victor Gordan
Рет қаралды 31 М.
7 Examples Proving Shaders are Amazing
8:09
DesignCourse
Рет қаралды 34 М.
Красиво, но телефон жаль
0:32
Бесполезные Новости
Рет қаралды 1,3 МЛН
iPhone 15 Pro в реальной жизни
24:07
HUDAKOV
Рет қаралды 408 М.