Inspiration

A while ago I was looking into trying 3D modelling, particularly character design, but quickly got turned off by the laborious process of manually tracing over sculpts to create geometry suitable for texturing, animation, and in general efficient rendering. I looked around for automatic tools to do that for me, and found two close candidates: Instant Meshes and Quadriflow. The reference implementation of Instant Meshes comes with some really powerful interactive tools that allow the artist to guide the topology however they desire. However, the output mesh ends up having quite a few undesirable artifacts. That's where Quadriflow comes in and builds on Instant Meshes, algorithmically removing the artifacts. However, there don't exist any implementations of Quadriflow which retain the interactive tools of Instant Meshes... until now!

What it does

Unfortunately, I was not able to get particularly far on the implementation. I was able to load a mesh using a custom, fully streaming PLY parser, display it in an HTML canvas with WebGPU, generate the orientation field of the mesh, which is the first step of both Instant Meshes and Quadriflow, and finally present a simple visualization of the orientation field. The gist of the orientation field is that crosses are randomly placed on the surface of the mesh, and then they are iteratively smoothed until they all roughly align and flow with the geometry of the mesh.

How we built it

To implement this I leveraged Rust and its rich WebAssembly ecosystem, allowing me to push the performance envelope of the web platform. I knew I wanted to put this application on the web to make it more accessible, but because the underlying problem has high computational demand, dealing with hundreds of thousands, if not millions of polygons, I knew I had to get creative. I chose to use WebGPU for the preview rendering, as I have some prior experience with it, and it fits in well with the WebAssembly ecosystem.

Challenges we ran into

  • In general, using Rust at a hackathon is not the greatest idea; lots has to be done manually.. hence the custom PLY parser
  • Achieving high WebAssembly performance is not as trivial as native CPU code, a couple times I had to rethink how I was doing things to get acceptable response times.
  • There is a discrepancy between the Instant Meshes paper and reference implementation with regards to accelerating orientation field generation, which took me hours to spot

Accomplishments that we're proud of

  • Streaming model loading
  • Working, high performance orientation field generation
    • Progressive hierarchical clustering of input mesh vertices to accelerate orientation field generation
    • Clustering uses special graph-dual areas to weight vertices

What we learned

  • Thinking about data structures at 4AM is not trivial

What's next for Flowguide

Cleaning up all the messy code I rushed together, then getting position field generation, Quadriflow singularity removal, mesh extraction, and interactive tools

Built With

  • rust
  • webassembly
  • webgpu
Share this project:

Updates