Animating xplanet

Jan 11, 2009 17:56


Originally published at Dom's Blog. You can comment here or there.



In order to make an animation showing a rotating earth, I used xplanet, imagemagick and mpeg2encode. Each individual frame is rendered with clouds overlayed from satellite imagery, details of which can be found on the xplanet homepage.

First, to allow xplanet to overlay clouds, its configuration file needs to know the path to the file containing the cloud map. I tend to use custom dayside and nightside images too; the file ~/.xplanet/config/default should contain:

[earth]
image=/home/dominic/.xplanet/images/earth.jpg
night_map=/home/dominic/.xplanet/images/night.jpg
cloud_map=/home/dominic/.xplanet/images/clouds.jpg

To make 360 images, one for each degree, use the following bash for-next loop:

$ for i in `seq -w 0 359` ; do xplanet -geometry 320x240 -num_times 1 -latitude 53 -longitude $i -output xplanet_$i.png && echo $i ; done

Then convert with imagemagick’s “convert” command and “mpeg2encode” from http://www.mpeg.org/MPEG/video/mssg-free-mpeg-software.html having compiled it (the Ubuntu release of Imagemagick does not include mpeg2encode):

$ convert xplanet_???.png xplanet_large.mpg

shell

Previous post Next post
Up