Published on 17 June 2010
Little planets are created by applying a stereographic projection to a spherical panorama. It is possible to seamlessly move from a birds-eye view in the sky to that of a bug on the ground!
The classic little planet effect. View original panorama.
To generate these images we start with a spherical (equirectangular) panorama. This is an image where the x-axis corresponds to the longitude around a sphere (0-360 degrees) and the y-axis is the latitude (-90 to 90 degrees). For any longitude or latitude position on a sphere we can retrieve the colour directly from the corresponding x,y coordinates on the panorama image. A proper equirectangular panorama should be twice as wide as tall, e.g. 1024x512 pixels.
Creating equirectangular panoramas is quite an art. If you want to create your own a few tutorials have been written on the subject. Luckily there is a huge selection of creative-commons licensed panoramas on Flickr we can start playing with.
Stereographic projection is a mapping that projects a sphere onto a plane, as illustrated with the world map below. It is conformal, which means that it preserves angles locally (note the grid lines still cross each other at right angles) although it doesn't preserve areas or distances.
As we already have the colour of each longitude and latitude point on a sphere from the equirectangular panorama the inverse stereographic projection formulas are used, as described by Mathworld.
Φ is the latitude and λ is the longitude. The parameters Φ0 and λ0 are user controlled and effectively set the projection point viewing position (try clicking and dragging the Flash demo below). R is the radius of the sphere, which controls the zooming effect.
Φ = asin( cos(c) sin(Φ0) + (y sin(c) cos(Φ0) / r )
λ = λ0 + atan( x sin(c) / (r cos(Φ0) cos(c) - y sin(Φ0) sin(c) )
which relate to the pixel x,y positions via:
r = sqrt(x2 + y2)
c = 2 atan( r / 2R )
Interactive Little Planets
Click and drag your mouse in the Flash movie below to change the longitude and latitude of the viewing point. Press any key to change the panorama image.
Download and installation
The Little Planets plugin will work with Adobe Photoshop, After Effects CS4+ or directly using the free Pixel Bender Toolkit (PBT). See the Pixel Bender Technology Center for details on setting it up for your system.
PBT: Just open the LittlePlanets.pbk file, choose a source panorama image and hit 'Run'.
Photoshop: Copy the LittlePlanets.pbk to 'Pixel Bender Files' folder within your Photoshop installation directory. Note, you need to have the Pixel Bender Plug-in for Photoshop CS5 installed first.
After Effects: Copy the LittlePlanets.pbk file into the Plug-ins/Effects folder for your installation.
Flash: There is an example Flash file used to create the movie above.
Input image size: must be set to exactly the same width and height of the source panorama in order to get a seamless result. When using within PBT you can use an image up to 4096x4096 pixels to create the highest quality results.
Output image size: the final output size. Best results are often obtained when the input image size is at least twice the output size.
Center point: pan the image to centre the area of interest.
Longitude and latitude offset: positions the projection eye. Try pushing the latitude above about 180 degrees to transform the planet into a tunnel!
Zoom: has the same effect as the field of view.
Wrap effect: wrap the projection as you zoom into the image from planet to tunnel. A 'Droste'-like effect.
Twist: twist the image by an amount proportional to its distance from the centre.
Bulge: can create some crazy distortions.
Push the latitude more than 180 degrees and you get a tunnel instead! View original panorama.
The panoramas I used in this article were taken from Flickr and are creative-commons licensed:
- Kyu Shiba Rikyu Garden: on the bridge by heiwa4126
- Outside the Saint Germain en Laye church by Seb Przd
- Immersive Saint Etienne du Mont by Seb Przd
- Green Eiffel by Gadl
- Equirectangular world map
Also thanks to Josh Sommers for suggesting the filter in the first place and beta testing it.
Check out some of his amazing work!
All images on this page released as Creative Commons, attribution, share-alike, noncommercial.
Update: there is another implementation of stereographic projections using a different algorithm for Pixel Bender and Flash over here that I wasn't aware of.
Last updated: 17 June 2010