Arc Forumnew | comments | leaders | submitlogin
1 point by almkglor 6086 days ago | link | parent

> But I forgot to return only the first two elements (needed for entering and exiting a shape for refraction).

Strange; I would have thought you needed only one intersection, because my mental model for refraction would be:

         |
    -----+-------
          \
           \ <-----new ray
    --------+----
            |
            |
          viewer
So you really need only one intersection - the nearest, because the second intersection wouldn't really be aligned to the refraction ray. But then I haven't read the book you are reading.

Basically at each intersection point I'd expect to split into three rays: a reflection ray (cross product to the normal), a refraction ray (if at least partially transparent) and a shadow ray (towards any source(s) of light).