I migrated my experiment to the brand new LowLevelMesh API and fixed the pinch gesture, feels good!
One benefit of using this API instead of hacks is that shadow casting now works properly, adding a great deal of realism ↓
I'm happy to share my new open-source Vision Pro example project called «Photons».
It's a particle simulation demo that literally gives you superpowers!
I did some research on mesh extraction from SDF last weekend, and I didn’t like what I saw…
The best techniques I was able to find were dual contouring, surface nets, and restricted Voronoi adaptation, which only works for dense grids.
Is there anything better?
A very interesting technique for mesh simplification and skinning weight optimization.
While it may seem trivial, extracting a single layer from a multi-layered object while avoiding collisions is far from easy.
The love letter to Voronoi 💔
I used bisector cell clipping by
@BrunoLevy01
and the team to identify Voronoi vertices. It’s a very elegant technique!
Super useful for triangulation, RVD, and other things.
VR-GS: A Physical Dynamics-Aware Interactive Gaussian Splatting
System in Virtual Reality
Very similar idea to tet proxy mesh, but for GS with some two-level embedding tricks to avoid rendering artifacts.
It’s not mobile VR though, but it can be done.
Connecting Voronoi neighbors by verifying that the voxel at the circumcenter contains all vertices of the potential primitive results in an almost perfect Delaunay tetrahedron, just as in the 2D case.
I did almost no CPU calculations, but it feels like I am pretty close 🙂↔️
I decided to spend time reimplementing my broad-phase collision detection, and it paid off!
Instead of heavily tuned voronoi particle tracking, I am now using GPU spatial hashing.
Now I can do 40k vertices (85k triangles) in under 15ms, getting closer to the goal🫡
Here we go, I finally implemented VBD with the StVK hyperelastic model (λ = 1e5, μ = 5e4).
Currently, I do:
- 8 (max) force elements per vertex in parallel
- 4 vertices in an SIMD group (8*4)
- 0 loops for reduction
- A lot of loops for Hessian 😅
It looks like I'm ready to simulate the proxy mesh.
Here is a discrete Voronoi with quasi-random initialization, weighted by mean curvature, and bounded by SDF.
It uses constrained Lloyd's for relaxation and builds Delaunay tetrahedrons, which I render with ray marching.
Optimizing for robustness over accuracy can get you pretty good results!
Now I am doing soft vertex-vertex collision after initialization and hard vertex-triangle collisions during the solve step.
Here is a stress test with pretty high velocity and elasticity —
Took a step back and added surface reconstruction.
Instead of Lloyd’s relaxation, I use inverse cube law energy, which I minimize with VBD. To keep vertices on a surface, I use closest point attraction.
I will optimize it jointly with internal tets with almost zero overhead.
Well, that’s something!
At least I‘ve implemented an SDF renderer that will help me debug my attempts to build tetrahedral meshing.
All I need is some nice density function…
Proper collision handling is very satisfying to observe, so I chose it next!
This shows a collision with friction as described in the paper (using IPC).
No self-collisions yet, but I can already see the improvement over other methods 🤩
It is still in a very experimental stage, but if anyone else wants to play with it, let me know, and I will add you to the TestFlight.
In the meantime, I am cooking something else 👨🏾🍳
If you are curious about building complex physics for Vision Pro or any Apple device, the best way is to start by learning Metal Compute.
It’s simpler than you think! Here are some great tools and materials by my friend
@eugenebokhan
→
EdgeRunner: Auto-regressive Auto-encoder for Artistic Mesh Generation
This paper introduces a tokenizer based on the EdgeBreaker algorithm to sequentially traverse triangular meshes.
It’s great to see a classic CG algorithm from the last century being used to push the state of
I need to constrain the tetrahedralization process to avoid out-of-shape connections, but it’s not clear how to do it robustly.
I can’t rely on SDF - some edges could be outside.
I tried to fill empty space with indicator seeds, but it didn’t go well.
I am open to ideas!
Here's a more technical showcase:
- 24,000 vertices
- An XPBD solver
- Self-collision
- Mesh collision
- Multiple constraints
- Various materials (per vertex configuration)
All in real-time, starting from iPhone 12
This is a result of surface nets vertex initialization and energy-based relaxation with Voronoi-Delaunay triangle extraction.
No CPU post-processing, so there are holes and imperfections.
Next, I will try to do Voronoi edge - SDF intersection test to improve connectivity.
Funny enough, the performance on the iPhone 15 Pro is roughly the same as on the M1 Ultra Mac Studio 😅
Obviously, the iPhone only lasts a couple of minutes before thermal throttling kicks in
Here, I implemented simple bending and ported my XPBD self-collision implementation by converting constraints to an energy-based approach.
To my surprise, even without conversion, we can run constraint-based resolution as post-processing to initialization, and it will still
I am considering pursuing a part-time PhD in fields such as discrete differential geometry or differentiable physics. Is it worth it?
Are there any benefits beyond career and collaboration opportunities in research?
A few things I want someone to try:
•Add ambient occlusion (could be done analytically)
•Implement SPH for fluid simulation
•Render particles as liquid
•Use a mesh as an initial shape
•Add shadow maps
I'm happy to share my new open-source Vision Pro example project called «Photons».
It's a particle simulation demo that literally gives you superpowers!
One thing I particularly enjoy about vertex-triangle collision handling is that it allows to resolve penetrations using surface information.
Applying cosine similarity tests against the vertex-triangle pair in the rest state significantly enhances DCD for multilayered garments.
I do tetrahedral skinning similarly to the amazing example by
@matthimf
But instead of a hash table, I do JFA, so we always know the closest circumcenter, and it’s much faster on a GPU.
Slightly enhanced my broad phase collision detection with some tricks for better reuse of cached proximity pairs.
Collisions still make up ~40% of the pipeline, but I hope to reduce the cost further with CCD, allowing larger steps.
It explicitly provides developers with scene mesh vertices and indices. How you use them is up to you. You can go beyond collisions, doing things like occlusions, custom shadows, drawing, and more.
I am in the process of interview prep, so I am spending time grinding LeetCode instead of prototyping more cool stuff.
It's a weird reality, but I accept the challenge 🫡
One of most recent rabbit holes I went down was about geometry processing, specifically remeshing algorithms. I spent quite some time on it, but I am happy with what I got and learned ↓🧵↓
SDF-RVD looks pretty though, I will try it out.
The algorithm would be:
1. Initialize seeds
2. Complete 3D Voronoi
3. Project seeds on SDF
4. Get 3D Voronoi edge intersection points with SDF to build “2D” cell
5. Compute centroids to update seeds
6. Repeat
I spent an eternity trying to figure out how to properly update vertex positions in RealityKit, so I just have to share a quick guide now.
1. Compute your positions.
2. Create a shader that takes the positions as a buffer and stores them in a texture.
3. Create a DrawableQueue
Quick update on my VBD performance improvements:
- Improved graph coloring with MCS algorithm: fewer, more balanced colors for better GPU utilization
- Updated local solver to use Cholesky decomposition: faster on Apple’s GPU
- Bug fixes and improvements for mass-spring kernel:
This field of research is promising, but "classic" simulators are still undefeated.
While HOOD has demonstrated an excellent use case for GNN and energy-based loss, it's not efficient or accurate enough to replace non-neural methods.
This new paper is a great step forward!
Tick tock... 2:20 today at
#SIGGRAPH2024
, I'll present "ContourCraft: Learning to Resolve Intersections in Neural Multi-garment Simulations." Mile High 4.
@ArturGrigorev57
, the lead author didn't get a visa so I'm the designated hitter. What's it about? 🧵
A new RealityKit API for dynamic mesh updates is here!
Seems like I can throw away my weekend hacks and just put positions directly in the vertex buffer from the GPU.
Here is my attempt at implementing the Two-Way Continuous Collision Handling paper, but in 2D 👾
It seems to be working, but if you are into simulation or math, please check the code against the equations for me 🥹
Mesh to SDF using JFA is super fast (1000+ fps), but there is a known issue with a sign which can lead to artifacts.
One way to fix it is with ray tracing, but it requires costly BVH construction.
Is there any known method that is as fast, but with sign guarantees?
You know what's really mind-blowing? The Metal debugger in Xcode beta doesn't crash!
I've used it multiple times for both macOS and visionOS apps, and it just works 🫨