Skip to content

Add selectable inside/outside method for SDF sign determination (#1393)#1393

Closed
cdtwigg wants to merge 1 commit into
mainfrom
export-D104091366
Closed

Add selectable inside/outside method for SDF sign determination (#1393)#1393
cdtwigg wants to merge 1 commit into
mainfrom
export-D104091366

Conversation

@cdtwigg
Copy link
Copy Markdown
Contributor

@cdtwigg cdtwigg commented May 13, 2026

Summary:

Add a SignMethod enum to MeshToSdfConfig with three options:

  • RayCasting (default): existing 6-direction majority vote. Fast but fails on non-watertight meshes where rays pass through gaps.
  • WindingNumber: signed winding number (wn > 0.5), assumes consistent outward-facing normals. Will reject meshes with accidentally flipped normals rather than silently accepting them.
  • WindingNumberPermissive: absolute winding number (abs(wn) > 0.5), tolerant of either winding convention. Handles mesh soups, mixed orientations, and geometry from multiple sources.

Both winding number variants use the Van Oosterom-Strackee solid angle formula, computed per voxel over all triangles. No new dependencies — the computation is self-contained.

The sign determination step was already isolated in applySignsToDistanceField, so the change is minimal: the function now accepts a SignMethod parameter and dispatches to the appropriate classifier.

Reviewed By: cstollmeta

Differential Revision: D104091366

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label May 13, 2026
@meta-codesync
Copy link
Copy Markdown
Contributor

meta-codesync Bot commented May 13, 2026

@cdtwigg has exported this pull request. If you are a Meta employee, you can view the originating Diff in D104091366.

@meta-codesync meta-codesync Bot changed the title Add selectable inside/outside method for SDF sign determination Add selectable inside/outside method for SDF sign determination (#1393) May 15, 2026
meta-codesync Bot pushed a commit that referenced this pull request May 15, 2026
Summary:

Add a `SignMethod` enum to `MeshToSdfConfig` with three options:

- `RayCasting` (default): existing 6-direction majority vote. Fast but fails on non-watertight meshes where rays pass through gaps.
- `WindingNumber`: signed winding number (wn > 0.5), assumes consistent outward-facing normals. Will reject meshes with accidentally flipped normals rather than silently accepting them.
- `WindingNumberPermissive`: absolute winding number (abs(wn) > 0.5), tolerant of either winding convention. Handles mesh soups, mixed orientations, and geometry from multiple sources.

Both winding number variants use the Van Oosterom-Strackee solid angle formula, computed per voxel over all triangles. No new dependencies — the computation is self-contained.

The sign determination step was already isolated in `applySignsToDistanceField`, so the change is minimal: the function now accepts a `SignMethod` parameter and dispatches to the appropriate classifier.

Reviewed By: cstollmeta

Differential Revision: D104091366
@meta-codesync meta-codesync Bot force-pushed the export-D104091366 branch from b00cce0 to a9c8463 Compare May 15, 2026 23:01
meta-codesync Bot pushed a commit that referenced this pull request May 15, 2026
Summary:

Add a `SignMethod` enum to `MeshToSdfConfig` with three options:

- `RayCasting` (default): existing 6-direction majority vote. Fast but fails on non-watertight meshes where rays pass through gaps.
- `WindingNumber`: signed winding number (wn > 0.5), assumes consistent outward-facing normals. Will reject meshes with accidentally flipped normals rather than silently accepting them.
- `WindingNumberPermissive`: absolute winding number (abs(wn) > 0.5), tolerant of either winding convention. Handles mesh soups, mixed orientations, and geometry from multiple sources.

Both winding number variants use the Van Oosterom-Strackee solid angle formula, computed per voxel over all triangles. No new dependencies — the computation is self-contained.

The sign determination step was already isolated in `applySignsToDistanceField`, so the change is minimal: the function now accepts a `SignMethod` parameter and dispatches to the appropriate classifier.

Reviewed By: cstollmeta

Differential Revision: D104091366
@meta-codesync meta-codesync Bot force-pushed the export-D104091366 branch from a9c8463 to 5740f86 Compare May 15, 2026 23:05
Summary:

Add a `SignMethod` enum to `MeshToSdfConfig` with three options:

- `RayCasting` (default): existing 6-direction majority vote. Fast but fails on non-watertight meshes where rays pass through gaps.
- `WindingNumber`: signed winding number (wn > 0.5), assumes consistent outward-facing normals. Will reject meshes with accidentally flipped normals rather than silently accepting them.
- `WindingNumberPermissive`: absolute winding number (abs(wn) > 0.5), tolerant of either winding convention. Handles mesh soups, mixed orientations, and geometry from multiple sources.

Both winding number variants use the Van Oosterom-Strackee solid angle formula, computed per voxel over all triangles. No new dependencies — the computation is self-contained.

The sign determination step was already isolated in `applySignsToDistanceField`, so the change is minimal: the function now accepts a `SignMethod` parameter and dispatches to the appropriate classifier.

Reviewed By: cstollmeta

Differential Revision: D104091366
@meta-codesync
Copy link
Copy Markdown
Contributor

meta-codesync Bot commented May 16, 2026

This pull request has been merged in 2210f0a.

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

Labels

CLA Signed This label is managed by the Meta Open Source bot. fb-exported Merged meta-exported

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant