Refraction Vector (Ray tracing)

2019-06-04 21:00发布

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"):

enter image description here

enter image description here

But I have seen it in another PDF as follows:enter image description here

Could you please explain for me why?

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

Thanks

1条回答
做自己的国王
2楼-- · 2019-06-04 21:14

Assuming that your vectors are actually xyz triplets:

float3 reflect( float3 i, float3 n )
{
  return i - 2.0 * n * dot(n,i);
}
查看更多
登录 后发表回答