Skip to content

Fix CalculateNormals#1724

Merged
elalish merged 2 commits into
masterfrom
boarderNormals
May 19, 2026
Merged

Fix CalculateNormals#1724
elalish merged 2 commits into
masterfrom
boarderNormals

Conversation

@elalish

@elalish elalish commented May 19, 2026

Copy link
Copy Markdown
Owner

I noticed some ugliness near the edges of Booleans when using CalculateNormals (see #1720 (comment)), which ultimately stemmed from my trying to do too much fancy stuff. CalculateTangents(sharpenedEdges) identifies flat faces as sets of three or more neighboring triangles with the same normal and uses this normal instead of the pseudonormal. I tried to do the same thing with CalculateNormals and SmoothByNormals, but it's a poor heuristic because Boolean ops often cut triangles into polygons, which then get stuck as flat faces, breaking with the curving surface around them.

I fixed this by simplifying the logic considerably, which should make it more robust and less surprising. It does loose some of the cool features I was going for, but I think much of that can now come by using the missing normals approach. I also changed the default min sharp angle from 60 degrees to 52.5 (halfway between 60 and 45), since it's annoying to have it right on the edge for relatively common angles.

I still have more work to do in this space, especially around better handling of quads, but first I need better decimation.

@elalish elalish self-assigned this May 19, 2026
@elalish elalish merged commit 8cab4b6 into master May 19, 2026
38 checks passed
@elalish elalish deleted the boarderNormals branch May 19, 2026 11:16
@codecov

codecov Bot commented May 19, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.13%. Comparing base (bd56861) to head (ac398e1).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1724      +/-   ##
==========================================
- Coverage   95.34%   95.13%   -0.21%     
==========================================
  Files          37       37              
  Lines        8329     8291      -38     
==========================================
- Hits         7941     7888      -53     
- Misses        388      403      +15     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@mmiscool

Copy link
Copy Markdown
Contributor

Would this have any impact on doing fillets using a chamfer?

@elalish

elalish commented May 21, 2026

Copy link
Copy Markdown
Owner Author

Yes, this and several other of my recent PRs are in pursuit of this goal, but I haven't quite attained it yet. Stay tuned.

@elalish elalish mentioned this pull request May 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants