关于镜面反射的问题
有谁知道为什么镜面反射被定义为 反射 = 2 ( 正常 . 光 ) 正常 - 光 其中法线是平面的法线, 光是来自光源的归一化矢量?
Does anybody know why Specular Reflection is defined as
Reflection = 2 ( Normal . Light ) Normal - Light
where Normal is the normal of the plane and
Light is the normalize vector from the light source?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
要反映矢量,您需要反转该矢量在特定轴上的分量。例如,要反映 x 轴的向量,您只需翻转 y 分量的符号即可。另一种看待这个问题的方法是将 y 分量乘以因子 -1。实现该目标的另一种方法是减去 y 分量自身的两倍。最后一个变体是您网站的公式中使用的变体。
我们想要从方向向量中减去表面法线的一些倍数。 (Normal.Light) 项给出了沿着法线的光矢量分量(类似于上例中的 y 分量)。然后,我们需要两倍的量(因此是 2),并且我们想要沿法线方向更改向量,因此需要将该数字乘以法线。您似乎确实在减号周围交换了术语。
To reflect a vector you need to reverse the component of that vector that lies on a particular axis. For example, to reflect a vector off the x-axis, you could just flip the sign of the y component. Another way to look at that is to multiply the y component by a factor of -1. Yet another way to achieve that goal is to subtract twice the y component from itself. This last variant is what is used in the formula you site.
We want to subtract some multiple of the surface normal from our direction vector. The (Normal.Light) term gives you the component of the light vector that lies along the normal (similar to the y component in the example above). We then need twice that amount (hence the 2) and we want to change the vector in the direction of the normal, so that number needs to be multiplied by the normal. You do seem to have swapped the terms on around the minus.
这可能是这里描述的一般反思的结果:
http://en.wikipedia.org/wiki /Reflection_(数学)
您可能需要了解位向量几何或线性代数才能理解原因。
It is perhaps a consequence of the general reflection described here:
http://en.wikipedia.org/wiki/Reflection_(mathematics)
You probably need to know a bit vector geometry or linear algebra to understand why though.