I'm learning to write shader program from scratch and now I'm at diffuse lighting. Currently the equation is
我正在学习从头开始写着色程序,现在我在漫射照明。目前,方程是
Diffuse Intensity = Intensity of light * 'k' diffuse constant of material * (dot product of surface's normal vector and light direction vector)
The thing is, I've read that for white material the k constant is 1 and if the material is black then the k is 0. Which is not the case of real world because my black object does get lighter when I expose it to light source. Why the algorithm is like this?
问题是,我读过,对于白色的材料k常数是1如果材料是黑色的那么k是0。这不是真实世界的情况,因为当我把它暴露给光源时,我的黑色物体会变得更轻。为什么算法是这样的?
I'm studying from this link which teaches how to write GLSL in Unity. I can set up the scene easier to experimenting with shader in Unity. http://en.wikibooks.org/wiki/GLSL_Programming/Unity/Diffuse_Reflection
我正在学习如何在统一中编写GLSL。我可以设置场景更容易实验与阴影在统一。http://en.wikibooks.org/wiki/GLSL_Programming/Unity/Diffuse_Reflection
1 个解决方案
#1
4
Lighting models in computer graphics are only simplifications/approximations of the reality. Most introductions start with the Phong model. You resource uses only the diffuse part from this. If the shader is extended with specular light you could get the effect of having a black object with specular highlights on it.
计算机图形学中的照明模型只是对现实的简化/近似。大多数介绍都是从Phong模型开始的。你的资源只使用这个的扩散部分。如果阴影用高光扩展,你可以得到一个带有高光的黑色物体的效果。
You real world objects reflections are probably much more complex than could be express with only diffuse and specular components from the Phong model.
现实世界中的物体的反射可能比仅用Phong模型中的漫反射和镜面分量所能表达的要复杂得多。
It is also non-trivial to find real world surfaces that reflect only diffuse light (lambertian reflectors).
在现实世界中寻找只反射漫射光的表面(兰伯特反射镜)也并非易事。
#1
4
Lighting models in computer graphics are only simplifications/approximations of the reality. Most introductions start with the Phong model. You resource uses only the diffuse part from this. If the shader is extended with specular light you could get the effect of having a black object with specular highlights on it.
计算机图形学中的照明模型只是对现实的简化/近似。大多数介绍都是从Phong模型开始的。你的资源只使用这个的扩散部分。如果阴影用高光扩展,你可以得到一个带有高光的黑色物体的效果。
You real world objects reflections are probably much more complex than could be express with only diffuse and specular components from the Phong model.
现实世界中的物体的反射可能比仅用Phong模型中的漫反射和镜面分量所能表达的要复杂得多。
It is also non-trivial to find real world surfaces that reflect only diffuse light (lambertian reflectors).
在现实世界中寻找只反射漫射光的表面(兰伯特反射镜)也并非易事。