The design of framework references "Realistic Ray Tracing" by Peter Shirley and R. Keith Morley
All images (512x512) are adaptive sampleing with 2 levels of subdivision, with Hall illumination model


Here is the first refraction image I got. There are two spheres, two boxes and a bunny in the image.
The green sphere is reflective, the yellow(diffusion color and specular color) sphere is refractive.
I use the strength of light ray to control recursion.
When internal refraction happens, I choose the direction of the refracted ray to be the same as the direction of the incident ray.

refraction.png
Running time: 4 + 12 seconds

After I changed the red box to a red cow and the violet box to a violet penguin. I also changed the yellow color.
I made the cow reflective, the bigger sphere refractive. The green sphere is reflective, too.

cowreflective.png
Running time: 286 + 1438 seconds

In this image, everything but the bigger sphere is reflective. The bigger sphere is refractive.

allreflective.png
Running time: 362 + 2301 seconds

Here's one image I made the bunny refractive, others reflective. I rearranged the objects a little bit, too.

refractivebunny.png
Running time: 250 + 2140 seconds

Compared with ray tracing part, the adaptive sampling part is really slow. I didn't come up with a more efficient way of doing the sampling earlier.