Dynamic terrain exaggeration consumes unnecessary GPU memory
- Dominant language
- JavaScript
- Stars
- 15.7k
- Forks
- 3.9k
- Avg merge
- 4d 6h
- Merged PRs (30d)
- 34
Description
I was just reading through the [PR](https://github.com/CesiumGS/cesium/pull/9603) that implemented dynamic terrain exaggeration. The description states that it works by storing a geodetic surface normal per vertex. The shader uses that normal to scale the vertex. It also mentions how storing that data increases buffer memory usage by _**30%!!**_
I don't think it's necessary to store those normals per vertex. Unless I'm missing something, we can and should just calculate those normals on the fly in the shader. It's basically just a multiplication of `vertexPosition * inverseEllipsoidRadiusSquared`.
I would bet this not only decreases memory usage, but also increases performance. Reading an extra vertex attribute (the surface normal) in the shader is typically much, much slower than doing a simple multiplication (essentially free).
This seems like a low hanging fruit, but I'm not sure how many people actually use dynamic vertical exaggeration and would benefit from this.
Contributor guide
Research direction
Start by reading PR #9603 and trace the dynamic terrain exaggeration path through its vertex data and shader changes. Compare deriving the geodetic surface normal from vertexPosition and inverseEllipsoidRadiusSquared with the current per-vertex attribute, then verify that terrain exaggeration remains correct while GPU buffer memory decreases and performance does not regress.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- computer-graphics, performance
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 39/100