kvark / vange-rs

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

GPU-based terrain collisions #44

Closed kvark closed 6 years ago

kvark commented 6 years ago

What

The original computes a collision impulse per polygon of the collision mesh. It does so by rasterizing the mesh against the terrain and accumulating the per-pixel penetrations.

Current code tries to simulate it by tessellating each polygon into samples, and then iterating those samples on CPU.

The fundamental physics equations (there aren't many that are needed, really) seem to be correct as of 56fb63238af867ee6d606ca3d92eb69e1870844c. But the integration is unstable, regardless of the time deltas I supply. Hence my latest investigation points to the lack of collision resolution being the cause of the trouble.

How

Basic algorithm:

Problems:

  1. read-back latency
  2. implementation complexity

Possible improvements: