I’ve recently refined the geometry in the Eve Flight Simulator project to reduce texture pinching and allow for a unified mesh for all world geometry. Note that this was all done in the Irrlicht 3D graphics engine.
There are several ways to generate a spherical mesh. I initially picked the cheap and common method shown above. The resulting wireframe of ECP tessellation closely resembles the longitude and latitude lines found on a globe. The drawback illustrated here is the heavy texture distortion occurring at the poles of the planet where triangles meet to form singularities. Also, with this shape it is hard to fully manipulate this terrain at runtime, especially near the poles where there is a smaller density of vertices.
It is assumed there will always be some level of distortion texturing a spherical mesh using standard texturing methods, but we can mitigate this by distributing distortion more evenly across the surface, hopefully to a point where it is not noticeable.
Cubemapping the Planet
Counter-intuitively, applying the earth texture to a cube causes less overall texture distortion.
There is less optical distortion for the texture, but it’s obvious we can’t just leave it like this. We’ll need to squish it back into a spherical shape and check the results.
Quadrilateralized Spherical Cube (QLSC, or Quad Sphere)
All we have to do is simply translate displace the existing vertices from the cube above to form the new spherical shape. This is easier said than done, but here are the results:
In the first illustration in this post our sphere mesh had 2 singularities—that is, one at each pole—where the texture pinched and became distorted. Now we are distributing this distortion over the 8 corners of a cube and it is no longer noticeable. An added benefit is that I now have 6 distinct but geometrically similar sides that make up the spherical cube. As the viewer zooms in further, we even have the option to progressively refine the geometry to give us higher resolution the closer we zoom in. The vertices themselves can also be offset to create a mountainous landscape.
Alternative: The icosahedron, et al.
I just wanted to quickly address other viable alternatives. We’re not just working with a computer science problem. Cartographers have been investigating optimal ways to represent the curved surface of the earth with flat maps for centuries. Likewise, there’s also a number of ways to project that flat map back onto a spherical shape.
We could more equally distribute the texture singularities with another shape called an icosahedron. Since this shape has 12 vertices rather than the 8 vertices of a cube, there would be less texture distortion distributed among the resultant sphere. You can use a similar method to the one describe above to interpolate additional vertices to transform it into a rounder shape. The reason why I don’t use an icosahedron as my base shape is that it would be more difficult to implement terrain mapping and LOD features. The flat textures I was working with would also have to be projected differently to align correctly over triangular faces rather than the simple square textures that form a cube.
For me, the QLSC will provide a great balance of visual fidelity and programmatic ease.
I’m pausing for now to clean up the code, but next I will be moving on to creating the sky and illumination model on earth.
This is also a good stopping point to look more into the avionics components that will run aboard the TR-1 and focus on those. I think I need a break from graphics for a while.