Fixes the Build: Watching the Eclipse Like a Graphics Programmer
Author: David Koloski, Engineer
I was fortunate enough to have the time to go to the path of totality to view the recent eclipse. What I expected from the eclipse turned out to be completely different from what I actually saw. Some of the phenomena that you can observe are absolutely fascinating, and the more I saw the more connections I drew between them and graphics programming. Here are some of the more interesting and fascinating ones and the insights they brought me. If you love graphics programming, you should definitely see the next eclipse!
The sun is bright
Seeing the eclipse brought the sun’s brightness into perspective for me. It’s obviously much brighter than any other light we see on a daily basis, but just how much brighter can be easy to forget.
The sun is almost always a dot
Even when the sun was a thin crescent, it still looked like a bright regular sun if you weren’t wearing glasses. While the moon does obscure the sun, it just reduces the amount of light from it. It doesn’t change the brightness of the little that we do. That light is so strong that regardless of how much we receive, it causes intense visual bloom and rounds out the shape.
During totality, you might have seen pictures taken that look like a thin white halo around the sun. What you might not realize is that the cameras taking those photos are still using a pretty strong filter, even though you can look at it with the naked eye. With the naked eye, you’ll instead see a large, brilliant white halo surrounding the blocked-out sun. This shows just how intense that visual bloom is and how bright the sun actually is.
50% Obscurance: Unusually dark shadows
One of the more unexpected effects of the eclipse was that the shadows cast by objects became unusually dark. I thought it was odd, and didn’t think much of it until I remembered an article I had read about fixing photorealistic rendering in Blender. In it, they describe a limitation with Blender’s default rendering that limits it to showing just 8 f-stops of range. More importantly though, this limitation causes the issue by forcing people to decrease the brightness of the sun to avoid blowing out the color range. This has the knock-on effect of putting less light into the environment via scattering, which makes the shadows much darker than they should be. The same effect is happening here! Anything that’s directly lit by the sun still looks about as bright as it usually does because we can’t see much of a difference between some sunlight and full sunlight. But all the shadows look too dark because we can easily see the difference between some backscatter and full backscatter.
80% obscurance: Strangely sharp shadows
At first, I thought I was going crazy. I could swear that the shadows on the ground were somehow sharper than they should have been. To make sure, I took a photo and compared it to another one I took after the eclipse. There were some very fine details – individual hairs and water bottle refractions – that showed up during the eclipse but not afterward. Some youtubers noticed the same thing, and after giving it a little thought it made perfect sense. Because the sun had shrunk in size, that effectively made the patch surface for its light much smaller as well. If you’ve done any raytracing, you know that lights with large patch surfaces naturally cause soft shadows to form by creating partial shadow. Likewise, lights with small patch surfaces naturally cause hard shadows to form. After seeing this, I couldn’t stop seeing the effects of light size on shadow softness everywhere!
95% obscurance: Shadow bands
Shadow bands are a difficult-to-observe phenomenon that can occur directly before or after totality. If you’re not careful, you won’t be able to observe them because in order to see them you must keep your eyes still. They’re a subtle shimmering of shadows on the ground that look similar to the shadows caused by heat shimmer, but these occur everywhere even when it’s not particularly hot. The reason these can show up near totality is the same reason that shadows get extra sharp. The sun has become so small that it’s basically acting like a point light, which increases the visibility of atmospheric distortion. What is essentially random noise due to refraction by the atmosphere gets sharpened instead of blurred and spread out like it normally is, and becomes visible to the careful observer.
100% obscurance: Sunrise/sunset in every direction
This is one of the coolest parts of the eclipse. During totality, it looks like there’s a sunset happening in every direction. This one is pretty simple to explain, but still shows us how much farther we have to go before we can achieve truly realistic lighting in real time. The red color that makes up the sunset is actually always there, even during the day. During an eclipse however, the blue light that would normally reach our eyes due to rayleigh scattering from air in between doesn’t exist, and we can see the fainter red coloring on the horizon. While we can’t see that red light during the day, we can tell it’s there just by looking at the sky. The sky is a deep dark blue at the top which gets progressively more whitish as you look down to the horizon. The whitish color near the horizon is just the mixing of the regular blue light with the scattered red light from the obscured sunset! It’s as if the world has multiple skyboxes that are all nested inside each other and add up to give us the colors that we see.
There are a lot of subtleties in the nature of light and the way we perceive it that are brought out for display during a solar eclipse. Just being there when it happened was enough to get my mind running wild thinking about all the interesting little things that I could see and why they were occurring.
A lot of these phenomena can be efficiently simulated with raytracers, but can’t be done as easily with traditional rasterization techniques. Shadow softness is a small detail that you can see everywhere, but you might not pay attention to. Unfortunately for raytracers, they’re still much too slow for real-time graphics and the graphics pipeline just isn’t made to support it. Rendering highly detailed scenes with raytracing requires custom software, and is usually reserved for high-fidelity slow rendering like 3D movies. However, our technology is always getting faster and more powerful! There are plenty of techniques to get soft shadows, and getting the right mix of soft and hard shadows could just mean putting some of these successful techniques together. Maybe one day, we’ll be able to render a total solar eclipse.
The eclipse was an amazing experience, and if you get the chance to see the next one in 2024, I’d definitely suggest that you take it!
This is not what the sun looks like with the naked eye.
You can see how much more intense the sun’s corona is in this image.
This is my shadow on a regular sunny day.
This is my shadow at about 80% obscurance.