I made a Compression Algorithm for Heightmap Terrain
Created on 2024-01-30T13:57:11-06:00
Quantization
- Lossless: If all numbers in a vector are below 255: use bytes to encode the vector.
- Lossy: Reducing 64-bit floats to 32-bit floats.
Quadtree
- Splitting the height map evenly in to four smaller planes.
- Evaluate which quantization method would give the smallest size without exceeding error tolerance
- Include the cost of overhead for each of the four splits--sometimes its better to just not bother splitting.
Delta encoding
- Encode pixels as relative changes from other nearby pixels.
- Changes between neighbors can often be small enough that the data can now be quantized effectively.
Regression
- Compute a line/curve for a strip of pixels and represent the data with it
- Store residuals from the curve (which should now be much smaller and easier to quantize.)