[問題] Snell's Low 的套用
【出處】https://gist.github.com/tomjpsun/f11cb8d692a9655bd5af 第 174 到 181 行
雖然問題是以程式的方式呈現,但是小弟感覺不懂的是這個定律的套用,
如果板上大大覺得 po 錯地方,還請鞭小力一點...
【題目】這一段是光跡追蹤,遇到透明物體的計算, 節錄如下:
174 if (sphere->transparency) {
175 float ior = 1.1, eta = (inside) ? ior : 1 / ior; // are we inside or outside the surface?
176 float cosi = -nhit.dot(raydir);
177 float k = 1 - eta * eta * (1 - cosi * cosi);
178 Vec3f refrdir = raydir * eta + nhit * (eta * cosi - sqrt(k));
179 refrdir.normalize();
180 refraction = trace(phit - nhit * bias, refrdir, spheres, depth + 1);
181 }
【瓶頸】
175 假設光線由球面外進入的情形,此時 inside=true, eta 設定為 ior(即 1.1)
176 nhit:入射點, raydir: 入射光, 皆已經 normalized, 所以 cosi 為入射角
177 1-cosi*cosi 為 入射角 sin 平方, 這裡看來是套用 snell's law, eta 不是
應該乘以 sin(折射角) 嗎?開始看不懂了...
178 為何這樣就得到折射線?也看不懂.
看了一天都不懂, 還請各位板上大大指點一下!謝謝!
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 61.231.108.44
※ 文章網址: https://www.ptt.cc/bbs/Physics/M.1457925341.A.63F.html
→
03/14 20:00, , 1F
03/14 20:00, 1F
→
03/14 20:02, , 2F
03/14 20:02, 2F
→
03/14 20:03, , 3F
03/14 20:03, 3F
→
03/14 20:04, , 4F
03/14 20:04, 4F
→
03/15 09:51, , 5F
03/15 09:51, 5F
→
03/15 09:58, , 6F
03/15 09:58, 6F