Photorealistic Earth in Minecraft 1.16

Today, youtuber carykh released a video showing off a photorealistic globe he generated in minecraft. It was generated in an older version of the game, with a more limited block palette. I resolved to make a 1.16 version.

Making A Globemaker

To generate globes, I first had to write a globe-generating tool! This took the form of a Spigot plugin, which would provide but one command with which you may generate globes!

/sphere <radius> <image>

The sphere first clears out a large area surrounding your current location, before generating a massive, hollow sphere around you. The source image is treated as an equirectangularly-projected map.

Finding the correct blocks to use was tricky - I had to write a script to obtain the average colour of every minecraft texture. I then had to manually filter out certain tricky blocks - anything that might cause significant lag, like beacons and shulker boxes, was a no-go, as were any potentially destructive blocks.

Beyond the Globe

I soon considered that you could make more than planets using this strategy! Any equirectangular image is acceptable! Even a photograph of former US President Barack Obama (no, I don't know why that was the first thing I decided to try) is fair game, with amusing results.

Using The Plugin

Just download SpigoSphere.jar and add it to the plugins directory of your Spigot server, version 1.16.2 or later.

Be aware that SpigoSphere's /sphere command reads images as paths relative to the server's main directory, and employs no form of permission enforcement or other security measures to make it safe on public servers. You should also know that SpigoSphere is incredibly slow, potentially taking up to a full minute to clear terrain and generate a sphere. This is because SpigoSphere takes a brute-force approach to generating a voxelized sphere, often overwriting the same block numerous times. On the upside, however, this brute-force approach allowed me to easily implement multisampling, improving the overall clarity of the image!

Also beware - SpigoSphere will spam your console with error messages the entire time it generates the shape! This is because I can't figure out how to set block data correctly at the same time as changing the type of a given block. Don't worry - it should be harmless.

If /sphere cannot find the image in question, or encounters anything unexpected during sphere generation - such as, in rare cases, trying to read pixels outside the bounds of the image - it will simply fail silently for that particular pixel and carry on.