kvark / vange-rs

Rusty Vangers clone
https://vange.rs
Apache License 2.0
437 stars 21 forks source link

Correct and slow terrain render #105

Open kvark opened 4 years ago

kvark commented 4 years ago

All the currently implemented terrain renderers in this project are approximate. Each having its own set of compromises between the speed and quality. It would be useful to have a method as a quality baseline: something that would render ideally well, even if it's very slow.

Here is such method:

  1. find out the XY area of the terrain that may end up affecting the screen
  2. find out the mapping from instance ID to each and every point to this area
  3. launch an instanced draw that would draw lines: one for the lower chunk, one for the higher chunk

With depth write enabled, and some trickery to make the front texels drawn first, this can end up in an acceptable performance.

Technically, that would be "true" Painter's algorithm, unlike the current compute scattering method.

kvark commented 4 years ago

Basic version is implemented in 53abc6988aeecbea05dcc064dc3a9b2b96c3efd8 It's not yet fully correct though, the distribution needs to be worked out.