Skip to content

Latest commit

 

History

History
43 lines (33 loc) · 1.86 KB

README.md

File metadata and controls

43 lines (33 loc) · 1.86 KB

Planetmap

Planetmap is a library for processing lazily evaluated radial functions with dynamic level-of-detail.

Screenshots

high orbit low orbit close

Terrain Rendering

Planetmap is motivated by the desire to model to-scale planetary terrain in real time on commodity hardware. To accomplish this, it addresses multiple challenges:

  • Dynamic level of detail
  • Streaming larger-than-memory or procedural heightmap data
  • Addressing the surface of the sphere without singularities
  • Maintaining numerical stability over massive distances

This is accomplished by organizing data into a 6 virtual quadtrees, each corresponding to one face of a cubemap. Each node in a quadtree, referred to as a Chunk, can be associated with a square grid of height samples, each of which represents the altitude relative to sea level along a ray originating at the center of a planet. Streaming and level of detail can then be implemented with a CacheManager associated with GPU-resident buffers.

When generating geometry to be displaced by the heightmap, care must be taken to ensure numerical stability and avoid hairline cracks between neighboring chunks. One effective tactic is to upload the corners of each chunk from the CPU, then find interior points using interpolation in a vertex shader.

Features

  • parry exposes helpers for rapier-compatible collision detection against the surface of a radial heightmap
  • simd exposes simdeez-based iterators for data-parallel computation of sample coordinates within a Chunk or chunk::Coord, useful for fast noise sampling