Skip to content

v1.1.22 — NormalSmoothing striations fix (#81)

Latest

Choose a tag to compare

@gsdali gsdali released this 21 Jun 20:11
· 2 commits to main since this release

NormalSmoothing "brushed" striations fix (closes #81)

Fixes the fine periodic "brushed" striations that appeared on highly anisotropic CAD meshes — most visibly on threadedShaft helical flanks. This is the root cause of OCCTSwift#255 (it's a viewport shading bug, not an OCCT geometry bug).

NormalSmoothing.smoothNormals was discarding the per-vertex normals it was handed and recomputing each from an area-weighted face-normal average. On long thin triangles running along a sweep that average is directionally biased and renders as a sandpaper-like ripple.

Fix

Assign the area-weighted average of the original per-vertex normals within each crease group (snapshotted before the in-place write). Face normals are still used for crease detection, so hard edges stay crisp.

  • Smooth B-rep meshes → OCCT's analytic normals are reproduced (verified byte-identical to a raw-normal render of an M10×1.5 thread, 728K triangles) → striations gone.
  • Flat STL (vertex normal == face normal) → reduces to the old face-normal average → backward-compatible.

Tests

New smoothInputNormalsPreserved (the #81 regression) + flatInputMatchesFaceNormalAverage (backward-compat); updated the crease test to seed realistic per-face normals. 163 tests pass.

Full Changelog: v1.1.21...v1.1.22