Here is Sphereflake running at 60 FPS, 1920 x 1110. Stats: 48 million spheres (48,427,562, precisely - the ground plane is a large sphere), running on an NVIDIA Titan V card, 3.3 GHz Intel i9-7900x 10-core system. 32 years ago this image took an hour or more to render at 512 x 512 for 7382 primitives. This is a pure ray trace - I suspect if I even tried any hybrid "rasterize for eye rays" approach it would be considerably slower - 48 million spheres tessellated into triangles would be quite the load.
Note: all sphereflake images shown are progressively refined, with many rays shot per pixel over a minute or whenever I happened to capture the screenshot. In other words, images with area lights or depth of field are initially noisy, and I did not use any denoising post-process. That said, for sharp reflections and sharp shadows, what you see is pretty much what you get immediately, though there is some obviously sparkling as you move around the scene, since most of the spheres are of sub-pixel size and we take one sample per pixel initially.
Here's a close-up shot. 48 million spheres was the limit on this card, as the next step up would be 435 million. This scene runs at about 35 FPS, since each pixel spawns at least one reflection ray. Ray reflection depth is 5 levels deep; beyond this I couldn't see any difference.
This next shot shows the original hemispherical lighting used in Chris' code. The ground shadow is much more noisy, of course, since each shadow ray is shot in a random direction on a cosine-weighted hemisphere. Again, the image here shows the results after about a minute, i.e., 60*60 = 3600 rays per pixel.
Beyond the sheer speed of ray tracing such a large number of spheres, what impressed me is how fast the code can be changed. It took me about 15 minutes to add a little code to vary the direction to the directional lights, so making them area lights.
Adding a slider, a few more minutes of work, and you can interactively change the area light's radius.
Depth of field is also a snap: just jitter the ray's starting location and shoot it at the focal point for the lens, a few lines of code (which are in Chris' "Ray Tracing in a Weekend" demo, if you want to try it out).
September 17, 2018 by Eric Haines