Monday, August 29, 2016

A simple digital globe - 2

I completed the basics of the simple digital globe I mentioned in a previous blog post.  Source code is available on GitHub.  You can select an image file and it will be wrapped around a sphere.  You can then treat the sphere like a globe.  Rotate it via left and right arrow keys, tilt it up or down with the up and down arrow keys, and zoom in and out with page up/page down or plus and minus.  Home restores it to default.  You can print or export, sans background.

Basic globe

Alas, that is about all it can do.  The purpose is more to demonstrate how to do the basics, and to serve as the basis for future development.  There are a few features that should be added and one anomaly that should be addressed before that.  The anomaly, as you can see below, is with the texture mapping of the final "slice" of the mesh.

Bug in texture mapping on the final "slice" of the globe.

That definitely represents a bug, and needs to get fixed.  The distortion below, though, is a combination of the intrinsic limitations of the distortions imposed by the representing an approximately spherical* planet on a flat surface (or image file) and the tendency of map makers to omit the extreme polar regions from many maps as a result.

Polar distortion

So what are the missing features?  Ideally the UV mapping process should support some additional projections, so if dealing with a Mercator project map it uses the correct math.  As it is now it simply interprets latitude linearly across the vertical aspect of the map.  For another, the lighting is always pointed in one direction, so even if you spin the globe the same area remains brightly lit and the remainder slightly dim.  Whether the background should be included when exporting and printing is currently not optional; it always prints/exports without the background.  The background should also be able to be selected, rather than fixed.  Lastly, there's no online help displaying the key information. Those are the features that are missing for the basic globe application.

Then there are the other things to build on top of this.  Cloud simulation, possibly animated, using Perlin noise and multiple textures.  A variety of the planetary terrain generation techniques described by Ken Musgrave.  Maybe some of the things I've experimented with in the past.  Possibly something along the lines of the plate tectonics-based techniques.  Maybe a modified version of Amit Patel's island generation technique.  Only time will tell.

* The Earth is actually a slightly irregular, slightly oblate ellipsoid.

No comments:

Post a Comment