How to create a visualization of the spread of COVID-19 with Poser

Apr 29, 2020 at 10:00 am by LarryWBerg

COVID-19 visualizatio

For this visualization I used the confirmed-case statistical time-series that is updated daily by a team at Johns Hopkins University Center for Systems Science and Engineering.
This shows the progression of confirmed Covid-19 cases in the U.S. through April 11. The 1,200 top locations are shown.

Step 1. Grabbing the data

The repository of data can be found on GitHub.

I cloned the data repository into a folder locally:

git clone

Step 2. Having Python modules needed

I knew I would need to use Python to pull out the data I wanted from the .csv files that the repo contained. So I used pyenv and made sure that I had Python 3 installed and that the python pandas module was also installed. I would use Poser’s python later, but it doesn’t have the modules installed that I would need and on the Mac it is still Python 2.7.1.

Step 3. Decide on data format to read into Poser

The goal here was to convert the data I needed to a .json file in a format I could easily import into Poser’s python interpreter so that I could use it to create objects inside Poser.

I decided on this JSON file format to include name, longitude, latitude, and values:

  "locations": [ 
             "name": "New York City...", 
             "latitude" : 40.76727260000001,
             "longitude" : -73.97152637,
             "values" : [0,0,....., 98308, 103208, 106763]

          {   "name": ...}, 

          {   "name": ...}

I won't put all the python code here but the important calls were:

import pandas as pd
numBoxes = 1800

# Read the data
data = pd.read_csv(time_series_covid19_confirmed_US.csv, sep=',')

# Remove cities with zero and sort 
# the data by the most recent day as index 
# and the highest values to the top

nonZeroSorted = data[data[dayID] > 0].sort_values(by=[dayID],ascending=False)

for index in range(numBoxes): 
  name = nonZeroSorted.iloc[index]['Combined_Key']
  latitude = nonZeroSorted.iloc[index]['Lat'] 
  longitude = nonZeroSorted.iloc[index]['Long_'] 
  for single_date in daterange(start_date, end_date):
    dateStr = single_date.strftime('%-m/%-d/%y')
    columnsWanted = [dateStr] 
    activeCases = nonZeroSorted.iloc[index][columnsWanted]
    timeline[jj] = int(activeCases.values[0])
  locations[index] = { "name": name,
    "latitude": latitude,
    "longitude": longitude,
    "values": timeline }

jsonData = {'locations':locations}
with open(jsonFileName, 'w') as outfile:   
    json.dump(jsonData, outfile)

Step 4. Build a base Poser file with an Earth.

I built a base file in Poser using a properly spherically texture mapped sphere and was able to find some public earth textures I could start with. I eventually combined textures from multiple sources. The important thing is that they are accurate and that the longitude and latitude could be mapped to simple rotations on the rendered globe. There are many choices out there for earth textures. I subdivided the sphere to make sure it looked good up close. Textures I think I got here:

In the base file I also added an object that I would use as the geometry for the boxes. It's a simple 6 polygon box. I also added a grouping object I would use as a parent for the added boxes to make them easy to turn on and off.

I also experimented with parents on a box to get the correct order of z-scale, z-translation, x-rotation first and then y-rotation next, so I could directly map the longitude and latitude values.

Here is a look at the materials in progress. This one has some transparency on the ocean areas. The main texture is color adjusted with shader nodes — made gray instead of black and white, and inverted for the transparency map:

Step 6. Build blocks on the earth from the data.

In order to build blocks on the earth, each block needs to be created with an origin at the bottom of the box, scaled in height (z scale), placed on the surface of the earth (translated in Z), then rotated through two parent rotations: X rot and then Y rot.

I used grouping objects inside Poser as the parents of each block

All of this was done using the Python scripting available inside Poser 11 Pro.

Here is the script that inputs the data from json and builds a block for each location. The time series values are read in and the z-scale channel is animated for each block.

import json
import random

expand = 4
path = "topUS.json"
s = poser.Scene()

unitBox = s.ActorByInternalName("box_1")
boxGeom = unitBox.Geometry()
earth = s.ActorByInternalName("earth 1")

blockParent = None
    blockParent = s.ActorByInternalName("BlockParent")
if blockParent == None:
    blockParent = s.CreateGrouping()

with open(path) as json_file:
    data = json.load(json_file)
    # For each location in the file: 
    for location in   data[u'locations']: 
        name = location[u'name'] 
        latitude = location[u'latitude'] 
        longitude = location[u'longitude'] 
        values = location[u'values']; 

        numFrames = len(values) 
        s.SetNumFrames(numFrames * expand) 
        # Make a new box that we will animate later 
        newBox = None 
            newBox = s.ActorByInternalName(name) 
        createNew = False 
        if (newBox == None): 
            createNew = True 
            newBox = s.CreatePropFromGeom(boxGeom,name)
            newBox.SetOrigin(0.0, 0.0, -0.05)
        brightness = 1.1 
        r = random.uniform(brightness*0.76,brightness*0.82)
        g = random.uniform(brightness*0.53,brightness*0.63)
        b = random.uniform(brightness*0.34,brightness*0.44)
        material = newBox.Materials()[0] 
        tree = material.ShaderTree()
        node = tree.RendererRootNode(1)
        input = node.InputByInternalName("Diffuse_Color")
        input.SetColor(r, g, b ) 

        # Create longitude parent: 
        if (createNew): 
            longitudeActor = s.CreateGrouping()
            # Create latitude : 
            latitudeActor = s.CreateGrouping() 
            # Move the main parent: 
            ytran = longitudeActor.Parameter("yTran") 
            # Set the latitude and longitude 
            xrot = latitudeActor.Parameter("xRotate")
            yrot = longitudeActor.Parameter("yRotate") 

            # Move the box 
            xtran = newBox.Parameter("xTran") 
            ytran = newBox.Parameter("yTran") 
            ztran = newBox.Parameter("zTran") 

        scale = newBox.Parameter("Scale") 
        # For every frame set the scale channel value 
        zscale = newBox.Parameter("zScale") 
        for frame in range(0,numFrames): 
            zscale.SetValueFrame(values[frame] / 700.0, frame) 
            if (values[frame] <= 0): 
                scale.SetValueFrame(0, frame) 
                scale.SetValueFrame(0.033, frame)

Once I create this script in a text file, I opened the Python scripts palette and clicked on an empty button, so I could load the script into the button. The next click on the button would run it. I set the script up to run it again and it would be faster if the objects were already created inside Poser. It takes a while to build the scene the first time (and I tracked down some things that could speed this up for the future.)

Step 7. Retime the animation to slow it down.

At this point I needed a new feature that Poser didn't have. So I added it. 

I wanted to retime the animation of everything in the scene so that I could spread the data points to more frames and interpolate between them. I added a radio button to retime everything in the scene. I guess I could have done this in the initial setting up of the keyframes too.

I then loaded some pre-saved camera animation from a camera library entry I created.

This was added to in the final Poser 11.3 update. ?

Step 8. Add the incrementing dates

Now I needed another Poser python script that could create the text objects for the dates that would need to increment. This was another missing feature in Poser — to be able to create a text prop from Python. It can be done interactively but there was no python function — so I added it! In the 11.3 coming out this week you will find CreateTextProp() on the poser scene object.

This python is a little sloppy and could probably be made simpler but this is what I used to create the numbers:

import random
import datetime
from datetime import timedelta, date

numDays = 83
expand = 4
numFrames = numDays*expand
s = poser.Scene()
dateParent = s.ActorByInternalName("DateParent")
date1 = date(2020, 1, 22)
date2 =
day = timedelta(days=1)
frame = 0
while date1 <= date2:
    dateStr = date1.strftime('%-m/%-d/%y')
    dateProp = s.CreateTextProp(dateStr, 0)

    # Set the materials material = dateProp.Materials()[0] 
    tree = material.ShaderTree() 
    node = tree.RendererRootNode(1) 
    input = node.InputByInternalName("Ambient_Color") 
    input.SetColor(1.0, 1.0, 1.0) 
    input = node.InputByInternalName("Ambient_Value") 
    input.SetFloat(0.5) scale = dateProp.Parameter("Scale")
    scale.SetValueFrame(0, 0) 
    if frame < numFrames: 
        scale.SetValueFrame(2.5, frame) 
    if frame+1 < numFrames: 
        scale.SetValueFrame(2.5, frame+1) 
    if frame+2 < numFrames: 
        scale.SetValueFrame(2.5, frame+2) 
    if frame+3 < numFrames: 
        scale.SetValueFrame(2.5, frame+3) 
    if frame+4 < numFrames: 
        scale.SetValueFrame(0, frame+4) 
    frame = frame + expand 
    date1 = date1 + day   

Then I rendered the sequence overnight.

Final Scenes in Poser

This shows 260 countries confirmed Covid-19 cases growth over time. This 3D visualization was rendered in Poser 11 Pro.

Larry Weinberg created Poser and now works with the Poser Software development team. Find out more about his current projects at his website.