Search code examples
c++data-structures3d3d-rendering

Sphere World Implementation C++


What would be the best way to implement, store, and render spherical worlds, such as the ones in spore or infinity but without the in-between stages of spore, and multiple worlds ala infinity universe. Make no assumptions on how the planet itself is generated or its size/scale.


Solution

  • For rendering, you'll need to use some sort of level-of-detail algorithm in order to seamlessly move from close to the planet's surface to far away. There are many dynamic LOD algorithms (see here). An older algorithm, called ROAM, can be adapted to handle spherical objects, or planets (spherical ROAM). Geometry clipmaps is a newer, more popular algorithm that can be adapted to spherical surfaces as well.

    As for storing the data, you may want to look into procedural generation (depending on your needs) for texturing, heightmaps, etc. This is similar to how Infinity and Spore do things. You can read a little about procedural texturing here. Procedural heightmaps are simpler, depending on how complex/realistic you want your terrain. On the simplest level, you can simply displace your vertex height by a perlin noise function.