Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add utility for simplifying flat mesh surfaces #96

Open
gkjohnson opened this issue Dec 4, 2022 · 2 comments
Open

Add utility for simplifying flat mesh surfaces #96

gkjohnson opened this issue Dec 4, 2022 · 2 comments
Milestone

Comments

@gkjohnson
Copy link
Owner

gkjohnson commented Dec 4, 2022

During the process of applying CSG to a mesh flat surfaces become unnecessarily complex. During lulls in user operation it would be good to remesh brushes so they use a minimal number of triangles while still being connected - ie retriangulate flat / coplanar surfaces.

  • Find all large, flat surfaces while retaining half edges
  • Mark shared vertices as being removeable or not - ie required to define the contour of a shape.
  • Remove unnecessary vertices from the new shapes
  • Earcut to triangulate the surfaces

Alternative:

  • Find all polygon contours
  • Remove vertices along straight edges
  • Find connected edges of contours and join them (check for coplanarity)
  • Ensure holes are retained
  • Use earcut to produce a new geometry

TODO:

  • How do deal with uv or other buffer attributes?
@gkjohnson gkjohnson added this to the v0.0.x milestone Dec 4, 2022
@johncalvinyoung
Copy link

For a variety of use cases, it'd be good to make this a purely optional part of the workflow--I have applications where retaining the position & connectivity of any un-changed vertices is mildly important

@gkjohnson gkjohnson modified the milestones: v0.0.x, v0.0.5 Jan 18, 2023
@gkjohnson
Copy link
Owner Author

gkjohnson commented Mar 1, 2023

Possibly related:

mrdoob/three.js#10517

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants