Skip to content

Instantly share code, notes, and snippets.

@phg1024
Last active August 29, 2015 13:56
Show Gist options
  • Save phg1024/8855428 to your computer and use it in GitHub Desktop.
Save phg1024/8855428 to your computer and use it in GitHub Desktop.
// hit point
float eta = 1.01;
ray.origin = h.p;
// entering or leaving
if( dot(ray.dir, h.n) < 0 )
// entering ray
ray.dir = refract(ray.dir, h.n, 1.0/eta);
else
// leaving ray
ray.dir = refract(ray.dir, -h.n, eta);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment