Skip to content

Tools for r/Place data visualization with Blender and Python

License

Notifications You must be signed in to change notification settings

Catalyzzt/r-place-blender

 
 

Repository files navigation

r/Place Python and Blender Data Visualization

the creation of the Star Wars poster in r/Place 2022

Python scripts and instructions for:

  1. Trimming and formatting the r/Place 2022 dataset
  2. Generating color and heat maps for use in Blender
  3. Rendering r/Place in 3D with Blender

The scripts can be run with Jupyter Notebook guides, or by using the provided command line tool.

What is r/Place?

Starting April 1st 2022, the social news website Reddit hosted r/Place - an event where users could place pixels on a shared canvas. Each user was only allowed to place one pixel every five minutes. Various communities organized efforts to create complex works of art. In total, the event lasted four days with over six million participants. Over 160 million pixels were placed on the canvas.

What is This Project?

Reddit released a dataset containing the timestamp, hashed user ID, color, and x,y coordinate of every pixel placed during the whole event as an 11 GB CSV file with over 160 million rows.

This project takes that data, trims it down to a size around 1 GB, generates color and "heat" maps, and uses those maps to make beautiful 3D images and time lapses using the open source 3D software, Blender.

Prerequisites

  • Python >=3.10 (tested on 3.10.2)
  • Blender >=3.1 (tested on 3.1.2)
  • ~4 GB of free RAM (for processing the data)
  • ~15 GB of free space on the hard drive (until the raw data is trimmed)
  • It helps to have a powerful GPU for rendering the frames in Blender.

Some basic knowledge of Python and Blender is assumed. It also helps if you know the Pandas and NumPy (the Python libraries). If you are a beginner, here are some Tutorials I highly recommend:

Setup

  1. Install Python and Blender if you haven't already.

  2. Clone this repository (or download it as a Zip file and extract). How to download the repository as a zip file

  3. Download the r/Place 2022 dataset (named canvas-history/2022_place_canvas_history.csv.gzip) as a single file. Do not extract it.

  4. Open the repository in a terminal and create a new virtual environment with:

    python3 -m venv .venv
    
  5. Activate the virtual environment with:

    Windows:

    .\.venv\Scripts\activate
    

    Linux:

    source .venv/bin/activate
    
  6. Install the required packages with:

    python -m pip install -U pip wheel setuptools
    python -m pip install -r requirements.txt
    

    Or, if you have Poetry installed:

    poetry install
    

Running the Scripts with Jupyter Notebook

For a tutorial-like experience, you can run the scripts in Jupyter notebook. They allow you read along with the code and see the output.

In the command line, cd into the root of this repository. With the virtual environment activated, open the notebook by entering the following command and clicking on one of the listed guides:

jupyter notebook guides

Follow the guide and execute the code cells to execute each step of the process.

Running the Scripts with the Command Line

In the command line, cd into the root of this repository. With the virtual environment activated, run the following command:

python scripts/cli.py --help

For help with one of the subcommands, execute:

python scripts/cli.py <subcommand> --help

CLI Examples

Process the raw data and save it in 2022_place_canvas_history.parquet:

python scripts/cli.py trim data/2022_place_canvas_history.csv.gzip data/2022_place_canvas_history.parquet

Starting at the 72-hour mark, generate 1000 frames at 30 FPS at 1000x speed. Store the results in data/frames_color and data/frames_heat:

python scripts/cli.py generate data/2022_place_canvas_history.parquet data/frames_color data/frames_heat --start_ms 259200000 --timescale 1000 --frames 1000 --fps 30

Development

Generating a new requirements.txt file

Use the following command to generate a new requirements.txt file for non-Poetry users:

poetry export --without-hashes > requirements.txt

Older "Age Map" Version

This project has recently updated to use "heat maps" instead of "age maps". You can still find the older version here.

Other Fun Stuff

About

Tools for r/Place data visualization with Blender and Python

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Jupyter Notebook 92.6%
  • Python 7.4%