Gimp Spheremap Plugin

Version 2

EDIT: For Devfest’s opening hackathon, 2011/1/30

Okay, so I’ve updated the plugin: previously, the seam didn’t actually go away (it actually became quite apparent), because resynthesizer was working on the transformed polar domain instead of the normal rectangular domain. I fixed the code to work in the rectangular domain, which gives much better results. Once I have access to a computer that can render out 200 frames without boiling water, I’ll toss up another animation, or maybe a couple of stills.

Some rough benchmarks: running the script on a 10k by 5k image with a 200px border and 10px sensitivity or whatever I call it (it’s pretty much just softening the selection over which resynth works) takes around an hour.

Code

And of course, you want the code. Download it here (~7kB, MIT).

Version 1

I figured I should release this, since it’s one of the few pieces of code I’m not ashamed of.

What?

So, I’m working on an animation, which involves this tiny planet floating in the midst of a star-filled void (wait a sec…). Blender’s default star field wasn’t cutting it for me, so I decided to just paint my own. This didn’t really work, since the seams in the sphere map were showing up pretty prominently, and I couldn’t exactly hide them under a horizon. For an example of what I’m talking about, just take a look at this video (watch it in 1080p!).

Now that you have a good idea of the problem, I set out to make a plug-in that would make it easy to paint over the seams: hence, the spheremap plug-in was born. It essentially unwraps the image, smooths over the seams using resynthesizer, and then maps it back to the original image. Results are mixed: because of the polar mapping, the edges of the map don’t exactly smooth out that well. It needs some more work…

Code

So, have some code! You should’ve figured out that it needs gimp (2.6 as of the time of writing), the resynthesizer plugin installed, and the ability to run python scripts as plugins. To install this script, find your plug-ins directory (~/.gimp-2.6/plug-ins/, where ~ is your home directory) and just stick it there, and restart gimp. It should show up in Filters>Map>Seamless_Sphere_Map. Have fun! Not enough fun? Well…

Who lives in a pineapple under the sea?!