Not the Shortest Path: Animating Geospatial Data in Blender

Animated runs from my days back in Sherbrooke. Can you spot Mont Bellevue?

What is 'Not the Shortest Path'?

Welcome to the 3rd episode of Not the Shortest Path. Releasing a new episode every two weeks seems sustainable with my workload. Of course, it would be great to write every week consistently, but the extra time allows me to experiment a lot more.

Some Context

We covered the data pipeline I've been using to convert traditional GIS data for 3D animation within Blender. You can check them out you are interested in understanding what the CSVs used by the Blender scripts contain.

Side Note on Converting .fit

Alexis Pont (a friend and coworker at Anagraph) wanted to dabble in 3D animation of his Strava activities. Unfortunately, Alexis had an issue with his data being in the .fit format, perhaps because of his Suunto watch.

How to learn Scripting in Blender?

There's a lot of information available online, and you can probably get by with some experience and trial and error. Some fantastic tutorials are publicly available and cover incredibly creative and disparate ways of using the 3D render engine. If you want to dig deeper into scripting with Blender and want a more linear path, I would highly recommend the official course available in Blender studio called Scripting for Artists. I followed the lesson, and it helped me understand a lot of strange notions. I would recommend having some experience with Python to accelerate the learning curve and focus on Blender's particularities.

A First Attempt at Importing a Road Network

Before learning about Blender Add-Ons, I went completely berserk with my experimentations, and it spiraled downward from there. Applying good software engineering practices while testing different visual effects is challenging. Even getting the camera positioned without even starting to test out customs rigs is an art of itself. Moreso, the feedback times can become very long when waiting on Blender to render the result of large datasets.

  • The material function should be imported within the script and made accessible to all other custom scripts.
  • We should figure out a way to externalize the actual initialization logic of our data and how we initialize it.
  • Altogether avoiding hard-coded values can become extraordinarily daunting and perhaps even overwhelming for an outside user.

The Structure of Custom Blender Add-Ons

The official Blender documentation does a great job at explaining how add-ons work. However, they assume an implicit understanding of the advantages of add-ons. The most crucial aspect of add-ons is creating highly advanced tools usable through the Blender GUI with minimal code. Another critical point is the discipline add-ons bring in defining our custom logic. Not only is our code made accessible through the GUI, but we can also re-use it from our custom scripts.

bl_info = {
"name": "My Test Add-on",
"blender": (2, 80, 0),
"category": "Object",
}
def register():
print("Hello World")
def unregister():
print("Goodbye World")
  1. The variables define the options presented to an end-user.
  2. The execute method determines the precise instructions to follow.
  3. The register method so the engine can access our add-on.
  4. The unregister method so the engine can disable our add-on.
Searching for our custom road network add-on
Add-on menu appearing at lower left

Refactoring the Road Network Import Script

The add-on should have many changes. However, we are improving upon the last custom script. I also introduced an attempt at adding some noise to the lines. The idea was to reproduce Craig Taylor's Coral Cities (more complicated than it looks!). The noise functions are not accessible through the GUI but can be by a custom script.

The GPX Animation Add-On

The GPX animation add-on is the one used to produce the header GIF. The TrackImporter can be called from a script or directly within the GUI.

The Gradient Coloring by Distance from Point Add-On

During the attempt to replicate Craig Taylor's Coral Cities, I thought it would be a good idea to script out the coloring of the objects with an add-on. The script uses the currently selected objects and the defined point to calculate the distance used for the color gradient.

The Gradient Coloring by Distance from Point Add-On

Conclusion

Displaying a result from geographic data is simple, but getting things to look picture perfect is tough. There is significant complexity in mastering the entire GIS data pipeline, but manoeuvering the 3D animation ecosystem might be even more challenging. I think it’s safe to say j’ai encore des croûtes à manger. From camera rigging to defining frames, there’s a tone to learn.

GPX animation with the new approach discussed in the next episode. Skippy because of the GIF format used.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store