Refraction Vector (Ray tracing)

五迷三道 提交于 2019-12-08 06:02:06

问题


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

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?

Thanks


回答1:


Assuming that your vectors are actually xyz triplets:

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


来源:https://stackoverflow.com/questions/19548384/refraction-vector-ray-tracing

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!