Tuesday, January 17, 2017

A simple digital globe - 4

The simple digital globe from my September posts has had a small update to correct a texture (UV) mapping problem at the north pole.  This problem was actually longstanding, but when I was viewing the output from the Plate Tectonics simulator yesterday using it I finally decided to spend the time tracking the problem down and fixing it.

Globe program displaying output from Plate Tectonics simulator

It turns out the distortion results from the vertex sharing required for auto-generating normals that make the polyhedron look like a globe.  The fix turned out to be to deliberately introduce minute differences into the y coordinate of the vertex at the north pole, so each triangle at the top had a minutely different vertex position at the top but with much different texture coordinates.  The details can be seen in comments in the source code.

The source code is available under MIT license at https://github.com/AnAvidDeveloper/Globe.  I will look into making a binary available in the future.

Globe program displaying output from Plate Tectonics simulator, looking at the North Pole.
Note the minor distortion at the center (pole), expected of a flat map wrapped around a sphere.
That pinching is much improved over the strange swirl that was there before.
If there are ice caps, nobody will even notice.

No comments:

Post a Comment