Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Wrapping Meshes with Geodesic Walks (cprimozic.net)
52 points by Ameo on Oct 17, 2023 | hide | past | favorite | 8 comments


The distortion comes from trying to map R^2 onto the surface of the mesh, since they have different curvature, so they only "match" near the origin.

But the random-walk algorithm doesn't actually need to happen in R^2; I think it should be relatively straightforward to adapt to walk directly on the mesh.

Instead of tracking an "angle", you just need to track the forward tangent vector. And then walk in very small steps using the geodesic walk algorithm, turning the tangent at each point proportional to the derivative and normal at the new location.

It will probably be slower, but it means it will be distortion-free, since you're no longer trying to force flat coordinates onto a non-flat surface.

Dealing with intersection is more complicated, though - I think you could probably just use an octree structure for acceleration (like the spatial tree in 2D). Since the segments can be each placed (almost) exactly on planar triangle faces, you can just project onto one/both of the segments' containing faces to check for intersection.


Ah, that's an excellent idea!!

I hadn't considered walking on the mesh directly like that, but now that you say it that makes a ton of sense. I will have to try that out


I wonder if it'd be worth adding an auto-spin until interacted with, regarding the 3D model at the very bottom of the page. Almost seems like it's not interactive at first. The FPS meter is cool.


Until I read your comment, I had assumed it was just a static image! Pretty cool to go back and move it around and stuff, thank you!


This is a random tip/thought but it is pretty straightforward to export a 3D model as a .glb file and use it in a ThreeJS embed. The lighting/camera rotation angles might need work though to look right.

I have exported stuff out of SketchUp and brought it into a webpage.


This is badass! Very into proc-gen as a starting point for content creation, but I haven't really found much use for proc-gen as a finishing utility. This seems like a great example of that, though! Detailing should be a lot more modular, using this process. I dig it!


There's a great paper from Ryan Schmidt called "Interactive decal compositing with discrete exponential maps" which tackles this exact problem as well. A more modern variant can be found in the "Vector Heat Method" by the authors of geometry-central, Nicholas Sharp and Keenan Crane, which can compute very accurate "log maps".

It's really cool to see this running interactively in the web!! Super slick stuff :)


These trajectories must be how an electron would fly within a chaotic electric field. The field acts on the electron from a perpendicular direction, creating the effect of rotating its velocity vector.




Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: