opencax / GSoC

Google Summer of Code Projects
30 stars 14 forks source link

Implement 3D mesh offset #84

Open pca006132 opened 5 months ago

pca006132 commented 5 months ago

Outline

Implement efficient 3D mesh offset, instead of using minkowski sum with high resolution spheres. (https://github.com/elalish/manifold/issues/192)

Details

3D mesh offset is a useful feature that many users asked for, but is difficult to implement efficiently. Many users use minkowski sum with sphere to perform positive offset, but this can be very slow due to the need for exact convex decomposition.

Our approach will only work for positive offset, negative offset can be implemented by performing additional mesh boolean operations, so this is not an issue. The approach has four phases:

  1. Figure out all pairs of faces that do not share any vertex and may overlap after offsetting. (let's call them conflict pairs)
  2. Cut the mesh in a way such that for each part, no two faces are in the same conflict pair. (decomposition step, requires monte carlo tree search)
  3. Perform the positive offset on each part, using a modified algorithm from Offset Triangular Mesh Using the Multiple Normal Vectors of a Vertex. Note that we need to figure out how to blend the surfaces for smooth results.
  4. Union the parts.

    Expected Outcome

A fast 3D mesh decomposition algorithm!

Project Properties

Skills

Difficulty

Size

Additional Information

zalo commented 5 months ago

It might be worth observing previous attempts at Mesh Offsetting:

My Convex Decomposition PoC (Slow, Unclean Topology, Offset is just Minkowski Sum): https://github.com/elalish/manifold/pull/663

Emmet’s Pure Offsetting PoC (Slow, Rough Seams): https://github.com/elalish/manifold/pull/668

My Pure Offsetting Attempt (Slow, Smooth Seams, Brittle): https://github.com/elalish/manifold/pull/669

Minkowski Sums (Very Slow, Smooth Seams, Robust): https://github.com/elalish/manifold/pull/666

Ideally the offsetting solution should be fast, with smooth seams, and robust to multiple repeated applications. 😄

I’m still actively thinking about my Convex Decomposition algorithm; the next step will be to add merging between the Voronoi cells to simplify the resulting structure when possible 🤔

hyunjinku commented 5 months ago

I was looking for the exact function, and found that meshlib supports it! Check this example!

pca006132 commented 5 months ago

@hyunjinku they are using voxels for offset, which works but have drawbacks, e.g. losing fine details if the resolution is not high enough.

MJ2021 commented 4 months ago

Hi @zalo @pca006132 are there any plans already available for this project or do we need to come up ourselves with some new ideas for the algorithm ?

pca006132 commented 4 months ago

there are some ideas, but we don't know how well they will work, and this can be quite challenging to implement

MJ2021 commented 4 months ago

Oh okay I understand