Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Here's how we use this in the standard shader:

AtRay ray;
AiMakeRay(&ray, AI_RAY_REFRACTED, &sg->P, NULL, AI_BIG, sg);
const bool refracted = AiRefractRay(&ray, &sg->Nf, n1, n2, sg);
AiTrace(&ray, &sample);

 


Here is a simple example of what using AiRefractRay() provides. This was rendered with 2 AA_samples and where each sphere is a refractive material. The amount of texture data read in is listed below the rendered image:

...

Center

Gallery
includeLabelray


With AiRefractRay(), we have the correct ray derivatives and so are able to read from the correct texture mipmap level. This allows us to both remove the aliasing seen in the refracted textures through the spheres and cut down substantially on texture data read in. This should make it quite clear why it is important to use AiRefractRay() when casting refraction rays!

...