折射向量(光线追踪)向量、光线

2023-09-08 10:29:22 作者:浅挚つ半离兮

我做光线追踪和我用下面的关系光线的折射(我从PDF格式被称为重新FL ections和折射的光线跟踪得到了它):

I am doing ray tracing and I do the refraction of the ray using the following relation (I got it from PDF called "Reflections and Refractions in Ray Tracing"):

不过,我已经看到它在其他PDF如下:

But I have seen it in another PDF as follows:

能否请您给我解释一下为什么?

Could you please explain for me why?

和我怎么能放心了,我计算我的折射矢量是否正确?

And how can I reassure that my refraction vector that I calculated is correct?

感谢

推荐答案

假设你的载体实际上是某某三胞胎:

Assuming that your vectors are actually xyz triplets:

float3 reflect( float3 i, float3 n )
{
  return i - 2.0 * n * dot(n,i);
}