4 ms·
This is cool. I'm just starting out on a similarish idea at the moment to visualise depth data on the great barrier reef - using RTIN (mapbox's demo martini lib
by somishere 6y ago
This is cool. I'm just starting out on a similarish idea at the moment to visualise depth data on the great barrier reef - using RTIN (mapbox's demo martini library) to simplify the dataset before render. Have you seen / tried this method at all?
https://github.com/mapbox/martini https://github.com/mapbox/martini
Proof of context demo (garbage code!): https://lab.citizensgbr.org/census-map/index-martini.html https://lab.citizensgbr.org/census-map/index-martini.html
- blaze33 6y agoWow, Martini looks really interesting! I did some research about mesh simplification and had some success using https://github.com/zeux/meshoptimizer https://github.com/zeux/meshoptimizer. Meshoptimizer is in c++ so I had to use the Rust wrapper https://github.com/gwihlidal/meshopt-rs https://github.com/gwihlidal/meshopt-rs and compile it to wasm. I actually opensourced this code at https://github.com/blaze33/dem2mesh https://github.com/blaze33/dem2mesh, just have to use dem2mesh.png2mesh which given a png data, computes the heightmap, builds a mesh, simplifies it and return the data to javascript. (can be tricky though to deal with wasm)
- kylebarron 6y agoI'd be really interested in seeing performance comparisons with Martini!
- somishere 6y agoDitto :)
- somishere 6y agoYeah, Martini seems promising. Yet to implement at map scale which is why I was interested if you'd tried already! The RTIN processing itself is very straightforward / lo-rent ... that said, if you were optimising the DEM tiles on the fly you'd probably refactor / integrate the two processes to save some loops. Dropped into a service worker (or WASM) I'm guessing it would be reasonably performant. Though perhaps meshoptimizer is more flexible with mesh dimensions?? (rtin is limited to a 2^nish grid) With that in mind had you considered zooming out for your dem only, so as to lower the heightmap resolution (but leave the env map as is)? Maybe you're already doing that?
- somishere 6y agoActually here's a similar demo I put together in 2017 using heightmap only .. it's low-res, stitching together higher-altitude DEMs, but actually fairly performant without any trickery. You can zoom in on a section by drawing on the rendered tile on the left. https://codepen.io/theprojectsomething/details/rmmePG https://codepen.io/theprojectsomething/details/rmmePG
- kylebarron 6y agoThe Martini JS library is ideal for on-demand generation client side. If you're looking to pre-generate your mesh with the same algorithm, I ported it to Python/Cython: https://github.com/kylebarron/pymartini https://github.com/kylebarron/pymartini