My first Dodgers game was in the spring of 2016. I'd just moved to L.A. the previous winter after spending two years far outside MLB territory, and I was excited to see big-league baseball again.
Because my first visit to Dodger Stadium was for a 6 p.m. game, I didn't think the sun would be an issue. How wrong I was. Our seats were at the very top of the upper deck down the right-field line and the sun was directly in our eyes.
After a few innings, the sun got low enough to give our eyes some relief, but I vowed to never sit on the right-field side of the stadium again.
At another game later that spring, I remembered my experience and chose seats at the front of the upper deck on the left-field side. What I didn't take into account was that this was a day game. We wouldn't have the sun in our eyes, but we had it on our necks and sweaty backs for several hours.
Rookie mistake? Sure. But it got me thinking: How can I visualize the way the sun affects Dodger Stadium? Could I build a simulation of where the shadows will be at each point in the season?
I started with a website that collects models for SketchUp, a 3-D modeling program, which had a pretty good model of the stadium. It didn't have every detail, but it had enough to map the general path of shadows with the right proportions.
After importing the model into a 3-D rendering program, Blender, the model was compared to photos of the stadium to make sure things generally lined up. To make sure the shadows on the seating areas were visible, the roofs were set to cast shadows but be invisible to the camera.
The next step was putting the sun in the right place for each time of day, and on every day of the season. A Blender plugin that uses NOAA's sun position algorithm took care of the math. Once set up, the "sun," a light-emitting object in the scene, would go to the right place based on the date and time and generate reasonably accurate shadows.
After setting up a virtual camera, the scene was ready to render. A short python script looped through the days from March to October and rendered 90 high-contrast frames for each day — one for every six minutes between noon and 9 p.m.
After many hours of rendering, I had 22,000 images, each showing the shadows at a different time. Each day's 90 images could be combined into an animation.
Now the way the sun moved throughout each day was clear, but what about throughout the baseball season? Each day could be summed up by calculating the average brightness in each pixel over all 90 images. That way, if an area was lit the whole time, it would be brighter on average than an area that was in shadow the whole time.
Because it's hardest to find shade during a day game, the average sun intensity was limited to 1 to 4:30 p.m. That covers most day games and gives a decent overview of how the shadows will change throughout the year.
Each pixel's average brightness was then translated to a color scale, to help emphasize the difference between sun and shade.
Finally the colorized images for each day were combined into an animation that shows how the shadows change as the sun's position changes through the months.
The main factor in what part of a stadium faces the sun is the orientation in relation to north. Most MLB venues face either north or east, so that the sun doesn't set in the outfield, which would make it very difficult to see the ball. Dodger Stadium faces about 28 degrees offset from north, which gives the left-field side of the stadium the advantage when it comes to shade.