Hi everyone, and thanks for stopping by!
First things first, here is the model this post is all about: a visualization of all measured earthquakes (of magnitude above 2.5) that have occurred between January 2000 and July 2019:
I’ll try to give you a comprehensive tour of:
- Why I made it
- The science behind it
- How I created the visualization
- How I made it look nice 😀
I am Loïc, a French “lots-of-things” enthusiast as I like to describe myself, and, for a few months now, a 3D backend developer at Sketchfab (Yay!).
I first graduated from a French engineering school (Arts et Métiers) with a focus on fluid mechanics, before obtaining a Master of Sciences in Marine Geophysics at the European Institute for Marine Studies (IUEM).
Before actually joining Sketchfab, I had the chance to work in the field of scientific computing and visualization for 3 years alongside researchers at Sorbonne Université, in Paris.
And although I did not have a deep understanding of half of the projects I was working on (in various fields of applied mathematics, archaeology, marine biology…), one thing became clear: I love science (especially when it can be visualized in 3D) !
I discovered Sketchfab while working on an archaeology research project, and quickly became a huge fan of the platform (I can’t tell you otherwise, some of my new colleagues might read this article!) as a hobbyist while experimenting with Blender, programming, photogrammetry, and open data.
And as an exercise and hobby, I recently started having fun (yep, I’m that kind of guy…) creating visualizations based on some of the fantastic datasets available online, most often by writing simple Python scripts allowing me to map data to point-clouds, as on the following model based on open data (a.k.a. “available to the public”) from the city of Paris and representing trees and street lights:
Bits of Science
If you are in a hurry, just keep in mind that Earth does funny stuff.
If you have a little more time, but think that “tectonics” is a fun-looking dance-style or makes for a really good band name, then I’d definitely advise you to watch this very comprehensive 2-minute video from MinuteEarth on YouTube:
In short, the Earth is made of multiple “layers”. The outer crust is broken into plates, which drift on the earth’s surface at a rate of a few centimeters every year, as shown on the map below:
The “funny stuff” I mentioned before happens when those plates meet, collide, and often pass one over the other: one of those phenomena you might already be familiar with is called subduction (more about that on Wikipedia), and usually occurs when an oceanic plate slides under a continental one, often resulting in earthquakes.
While other types of plate encounters can result in high seismicity zones, such as the fault of San Andreas (along which two plates slowly—but steadily—slide), another kind of tectonics-induced event is the creation of topographical relief: give them a few million years and you can be pretty sure that two continental plates drifting towards one another will give birth to a nice mountain range!
The fact that earthquakes mostly happen at the boundaries between plates, as can be seen on the model at the top of this article, is a direct consequence of all those different phenomena.
As a complementary material, and if this short introduction felt over-simplified (it is) to you, I would advise you to have a look at this recent article published in Science if you did not already: What drives tectonic plates?
Although the science behind it is pretty serious, it is still an accessible and very interesting read!
And, just because I can, here is a nice stylized version of the Earth by Sketchfab user shooogp:
Aside from the landmask data which comes from the U.S. National Oceanic and Atmospheric Administration (NOAA), the data I used for this visualization comes from the Earthquake Catalog, a service provided by the U.S. Geological Survey (USGS), based on a database of earthquakes measured around the globe.
This service is used for earthquake surveillance and monitoring, and serves—amongst other usages—as a basis for alert dispatch programs. The associated data is accessible in various forms:
- Global map of the latest earthquakes
- Realtime feed in various formats
- Graphical search interface to the catalog
- And, most importantly in our case, an API to retrieve events programmatically
The latest access method—the API (Application Programming Interface)—is an efficient way for software developers to access the data stored on USGS servers.
The main idea is that by making a request (similar to the ones your browser makes when opening a webpage, or browsing models on Sketchfab) to a standard URL associated with custom parameters, the USGS servers can send you back the data you asked for.
For instance, try opening this link in your browser.
What you gained access to is the result of an API call, returning information for all earthquakes of magnitude above 6 that occurred between the 11th and 12th of March, 2011, as can be seen by the URL parameters used. As a side-note, this specific time range corresponds to the Tohoku earthquake in Japan, of which I had previously created an animation thanks to the same USGS data:
Without getting into further detail about this part of the programming, each line corresponds to an earthquake, and the columns I kept for this visualization were the Longitude, Latitude, Depth, and Magnitude. Getting the data on the whole time period was at this point “just” a matter of writing a script to make multiple similar API calls on the relevant time range, and keeping only the columns of interest.
Creating the Visualization
Now that you know where the data comes from and what it looks like, let’s jump into how I created the visualization with Python, a programming language that is used in a wide range of applications (we use it extensively to run Sketchfab, for instance!).
Thanks to the API described previously, I gathered all earthquakes of magnitude greater than 2.5 that occurred between January 2000 and July 2019. This resulted in a list of around 500,000 earthquakes, all of which had data about the latitude and longitude of the earthquake’s epicenter, its depth, as well as its magnitude.
With this list of at my disposal, all that was left to do was to programmatically map each earthquake to a color (to represent the magnitude), convert geographical coordinates into 3D, and write a .ply file containing the resulting colored point cloud (you can learn more about point clouds in Sketchfab in this dedicated Help Center article).
If you are curious or want to try it out (some adjustments might have to be done…), a rough version of the script I used to create this model is available here.
Coordinates (a.k.a. “Maths”)
As you might know, there are multiple ways to describe a point in 3D. The convention we are the most used to is to use a value on three orthogonal axes, usually called X, Y, and Z. Those are called Cartesian coordinates.
Another way to specify a point in 3D is by using spherical coordinates, which are also made of three numbers: the radial distance from a fixed point, as well as two angles, called the inclination and azimuth.
Sketchfab (and most 3D software) expects cartesian coordinates as input, but the original data retrieved from the Earthquake catalog is stored in spherical coordinates. I, therefore, had to write some (straightforward) code to convert the coordinates of each earthquake from spherical to cartesian coordinates according to the following formula:
- The radius, r, corresponds to the radius of the earth (approximately 6400km), minus the depth of the earthquake. As earthquakes are not THAT deep when compared to the size of the Earth, the depth was exaggerated by a factor of three in the visualization.
- The inclination angle, θ, equals 90° minus the latitude. It is also called the “colatitude”.
- The azimuth angle, φ, is the same as the longitude.
Colors (a.k.a “No Maths”)
I must admit, I faced some kind of dilemma with the parametrization of colors for this visualization…
I wanted the colors of each earthquake to faithfully represent their magnitude, but I also wanted to try and give a “wow” effect to this model, and make it look “sexy”. So I
100% focused on making it look “sexy” compromised.
Lots of scientific visualizations still use an old colormap (a way to associate a value with a color), called jet, which usually matches low values with blue, high values with red, and intermediate values with a gradient of turquoise to orange colors. This method looks fancy, but tends to modify the way we perceive the colored data by distorting the apparent gap between values.
Although I knew that I would use post-processing filters, altering the colors of the model anyway, I still decided to use what is called a perceptually uniform sequential colormap (called inferno, from the Python library Matplotlib) in order to try and keep the magnitude information relatively decipherable (and not to harm my scientific conscience!).
Below is a side-by-side comparison of the Mona Lisa in different colormaps to illustrate the color distortion effect (the images come from a Quora answer by user Hyunjun Ji. From left to right: original color, jet, and viridis, which is another perceptually uniform sequential colormap):
With points representing our data correctly located and colored, another additional possibility to convey interesting information through visualizations based on point clouds is to rely on Sketchfab support for Timeframe (or Stop Motion) animations.
The main idea behind this kind of animation is really simple: it is possible to upload a series of point cloud files and have Sketchfab play them in a sequence, frame per frame. You’ll find more details on the dedicated Help Center page for the specifics of the format you need to use.
Although I did not use it for this specific model, this feature can really help understand a dataset when used properly (and it definitely contributes to give a “Wow” factor to your models 😇).
Here are a few examples of such visualizations:
- To stick with the topic of earthquakes, I created an animation of earthquakes in 2010 and 2011 by using the data and methods described in this article. But instead of creating a static model, I used the USGS API to gather earthquakes 6 days at a time.
- This model depicts the distribution of crime in L.A. according to the time of day (and is based on Arrest data from the city of Los Angeles).
Each frame (or each ply file) corresponds to a 15 minutes period, which allows to better understand the daily geographical distribution of crimes, and each point was colored according to the corresponding felony category.
- Finally, my most recent model visible below represents the wind and precipitation around the world on a given day. This visualization (more information in the model description) was a little more tricky to create, and although each point does not directly match some geographical data, it still makes for a nice animated visualization in my opinion!
Uploading to Sketchfab
With some nice data, bits of maths, some Python magic, and after lots of iterations on the number of earthquakes, depth exaggeration, choice of colors, I finally managed to have my colored point cloud uploaded to Sketchfab. The time had finally come to mess around in the 3D editor!
I fiddled quite a bit before finding a set of properties I was happy with, but managed to not get lost too much in the magnificent realm of Sketchfab’s post-processing filters.
The changes I made when compared to default settings were:
- Using some additive opacity for the point cloud material. Not only did this give some sweet-looking transparency to the model, it also helped to focus the viewer’s attention on the areas with the most earthquakes.
- Using some Bloom in the Post-Processing. I especially love this filter when applied to point cloud visualization, but always try to not set it at too high threshold, intensity and radius values on polygonal models.
- Using Filmic Tone Mapping. This has the effect of distorting the true-colors of the models, but damn, I find that this filter really helps give a cinematic effect to 3D scenes.
- Adding some annotations to focus on some of the most important, or well-known, earthquakes which happened during the period of interest.
Here is a side-by-side view of the models to show the impact of those changes (left: no post-processing and opaque points / right: post-processing and additive transparency):
I’ll keep my biased conclusion concise:
- Science is cool, especially Earth Observation science
- Data Visualization is awesome
- Open data is awesome too
- Messing around with Science and open data can be fun (give it a go!)
- Science + open data + Sketchfab = 💗
Amongst the multiple benefits of using Sketchfab for similar models, the one which strikes me the most is linked to the community: creating 3D models related to science (or cultural heritage) is not only a great way to hopefully share interesting concepts with people, it also provides a cool pretext to learn new methods or tools, to interact with other science enthusiasts and to get feedback—even sometimes learn new things—from experts, through comments or direct contact.
Hope you enjoyed the read, and maybe even learned a thing or two through the article or the models linked!
PS: If you are into 3D and science (that’s probably the case if you are still reading), you might want to have a look at this interesting blog post on astrophysics visualization on Sketchfab!
PPS: If you are already familiar with programming and want to create animated point clouds, I have written a small Python script (based on VTK) to display such animations. I use it to check the results of my experiments locally, and gain a lot of time by not having to upload to Sketchfab until an animation I’m 100% satisfied with is ready! The script—and usage instructions—are available here.
PPPS: If you are in a complicated relationship with programming and mathematics, or feel that the formula in this article was out of place, I hope that you’ll accept the following GIF of a smart boy as an apology!