3 ms·
I wrote the texture atlas implementation for Google Maps and it's basically the same as the "simple shelf allocator" mentioned here with a few twists (grid-snap
by aappleby 6y ago
I wrote the texture atlas implementation for Google Maps and it's basically the same as the "simple shelf allocator" mentioned here with a few twists (grid-snapped allocation, tunable allocation granularity, resizable atlases).
You can peek behind the scenes of maps.google.com using WebGL Inspector or similar, it's kinda fun to watch.
- aappleby 6y agoOh and it does zero dynamic allocations except during atlas resize, which was very helpful in older builds of V8.
- Jasper_ 6y agoI wrote a basic allocator for runtime lightmap packing (a very different problem than dynamic image packing tbf), and a simple skyline got me very good results, for about 50 lines of code: https://github.com/magcius/noclip.website/blob/master/src/SourceEngine/BSPFile.ts#L407-L464 https://github.com/magcius/noclip.website/blob/master/src/So... Compared to shelf, I think it did really well on the input data I had. I didn't even use the Halo Reach tricks for removing border padding when packing subpixel lightmaps!
- mooman219 6y agoThe skyline algorithm is definitely very pleasant to work with and has some impressive results! Adding additional heuristics on top of it is also very straightforward which is great.