Repository navigation
B-rep inspector: shade flat faces flat under the orthographic camera - #102
Merged
Merged
Conversation
The face shader took its eye vector from the camera *point*, normalize(camera_pos - world). Under an orthographic projection, the viewer's default, every ray is parallel to the view axis, so that vector varied across a plane and a flat face shaded as a radial gradient, brightest where the plane passes nearest the eye: the pink "glow" on the starter's back wall. The overlay uniform gains `view_dir` (camera forward axis, w = 1 when orthographic; the block grows 112 -> 128 bytes), and fs_brep uses that direction under an orthographic projection and the eye point under a perspective one. The other half of the starter's artifacts was in the corner normals the private tier serves: mixed-sign corners on planes, and per-corner blend normals that stepped. That is fixed in diff-brep (branch fix/corner-normal-orientation). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…tifacts # Conflicts: # cadjoint/viewer/static/assets/main-0Bz4AUvN.js # cadjoint/viewer/static/assets/main-CWRSwsGN.js # cadjoint/viewer/static/assets/main-CzjXYnhe.js # cadjoint/viewer/static/index.html
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes the shading artifacts in the B-rep inspector on
scenes/starter.py: glows on flat faces, a wrinkle on the blend around the fin-root pocket, and streaks on the left pin.Cause. The inspector's faces replace the raymarched solid: the solid is hidden and depth is cleared. So neither depth fighting with the SDF surface nor the AO and outline passes play a part. With the payload intercepted, the glows appeared with the served corner normals and never with flat facet normals. There were two causes:
fs_breptook its eye vector from the camera point,normalize(camera_pos - world). The viewer's default orthographic projection has parallel rays, so that vector varied across a plane, and a flat face shaded as a radial gradient. The overlay uniform gainsview_dir: the camera's forward axis, with w = 1 when orthographic. The block grows from 112 to 128 bytes.fs_brepuses that direction under orthographic projection and the eye point under perspective. The static bundle is rebuilt.Verified
tests/viewer/test_brep_inspector.py: 11 passed. vitest 717 passed, tsc clean.brepInspector.spec.tsandgpu.spec.tspass.vite buildreproduces the committed bundle.Left
🤖 Generated with Claude Code