I'm drawing planets in OpenGL ES, and running into some interesting performance issues. The general question is: how best to render "hugely detailed" textures on a sphere?
(the sphere is guaranteed; I'm interested in sphere-specific optimizations)
Base case:
- Window is approx. 2048 x 1536 (e.g. iPad3)
- Texture map for globe is 24,000 x 12,000 pixels (an area half the size of USA fits the full width of screen)
- Globe is displayed at everything from zoomed in (USA fills screen) to zoomed out (whole globe visible)
- I need a MINIMUM of 3 texture layers (1 for the planet surface, 1 for day/night differences, 1 for user-interface (hilighting different regions)
- Some of the layers are animated (i.e. they have to load and drop their texture at runtime, rapidly)
Limitations:
- top-end tablets are limited to 4096x4096 textures
- top-end tablets are limited to 8 simultaneous texture units
Problems:
- In total, it's naively 500 million pixels of texture data
- Splitting into smaller textures doesn't work well because devices only have 8 units; with only a single texture layer, I could split into 8 texture units and all textures would be less than 4096x4096 - but that only allows a single layer
- Rendering the layers as separate geometry works poorly because they need to be blended using fragment-shaders
...at the moment, the only idea I have that sounds viable is:
- split the sphere into NxM "pieces of sphere" and render each one as separate geometry
- use mipmaps to render low-res textures when zoomed out
- ...rely on simple culling to cut out most of them when zoomed in, and mipmapping to use small(er) textures when they can't be culled
...but it seems there ought to be an easier way / better options?