OpenGL - lighting with the Phong reflection model (part 2 of 2)
Вставка
- Опубліковано 12 чер 2024
- Code samples derived from work by Joey de Vries, @joeydevries, author of learnopengl.com/
All code samples, unless explicitly stated otherwise, are licensed under the terms of the CC BY-NC 4.0 license as published by Creative Commons, either version 4 of the License, or (at your option) any later version.
Thank you will.
specular strength > 1 means the model is not conserving energy right?
Right, the result light value might be greater than the source light value.
What's the advantage of computing the inverse transpose of the model matrix in the vertex shader as opposed to on the cpu? We could have a uniform normal matrix instead that gets passed in cpu-side.
You are right. The inverse and transpose functions can be really costly on the shader-side, but because this is for demonstration purposes, I'm assuming that he just went ahead and did it in the vertex shader.
How does the reflect() formula work?
4:10 You might have used the wrong function here. I think you wanted to use the "pow(x, y)" function here and not the "exp(x)" function that only takes one argument.
specular = pow(max(dot(R, C), 0), k) * lightColor
Can someone explain why specular light usually has "halo" effect. what's the logic?
Hi. Do you know how to make this work in 2D?
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?
i try this source code with basic light ,my pc gpu go for 100 % usage ,,,,no good programming
If anyone is a bit lost, or just stumbled on this video and is not following the video series I'd recommend watching the following video first, /watch?v=nS3qwFOPieg, and then coming back to watch this video.
please give me the source code of this video