A developer details how they built a system to wrap procedurally generated 2D path meshes around arbitrary 3D mesh surfaces using geodesic walking algorithms. The process involves: generating intricate 2D paths with AABB tree-based collision detection, tessellating them into triangles using the Rust lyon crate, mapping vertices onto a 3D mesh surface via geodesic walks (using the C++ geometry-central library), and extruding the result along vertex normals. To handle distortion from long geodesic walks, a graph traversal approach is used so walks start from nearby already-mapped vertices. The whole pipeline runs in the browser via two WebAssembly modules (one from Rust, one from C++) glued together with TypeScript, running in a web worker to avoid blocking the main thread, with final output fed into Three.JS BufferGeometry.

13m read timeFrom cprimozic.net
Post cover image
Table of contents
Overview2D Path GenerationGeodesic PathsExtruding to 3DWeb Worker + Three.JS IntegrationInteractive DemoConclusion

Sort: