Conversation
Adds optional transmission/ior/thickness/attenuation/clearcoat fields to MaterialPreset and MaterialDef. SceneMesh swaps to meshPhysicalMaterial when transmission > 0 so glass enclosures and acrylic housings render with refraction instead of looking like opaque polished plastic. New presets: Acrylic (Clear), Polycarbonate (Frosted). Existing Glass and Tinted Glass presets gain transmission=1.0 / 0.95. The .loon vcode format keeps its positional M-line — the new fields survive in the JSON .vcad format only for now.
The post-processing pass was gated on !isCameraMoving, so AO and vignette vanished the moment the user started orbiting. The scene went visibly flat during interaction, then snapped back to "good" at rest. Now the EffectComposer stays mounted across motion and we drop the AO sample count from 6 → 3 (and denoise 4 → 1) while moving. Same depth cues during orbit, no framerate cliff.
Adds optional `chord_tolerance` and `angular_tolerance` fields to TessellationParams plus a `circle_segments_for_radius()` helper that raises the segment count so curvature error stays below the configured sag. Cylindrical, conical, spherical, and toroidal face tessellators now use this so a 1mm fillet doesn't get the same 32 segments as a 100mm cylinder. Defaults stay `None`, so existing callers see no behavior change. New constructor `TessellationParams::from_tolerances(chord, angular)` is the opt-in path for downstream consumers.
Adds a screen-space outline pass that draws a subtle dark contour around every rendered part — the touch polished CAD viewers use to keep parts legible against busy backgrounds. Implementation: <Selection>/<Select> from @react-three/postprocessing wraps the rendered scene meshes; a single Outline effect picks up the selection and runs once per frame. Shadow color tracks the theme so the contour stays subtle in dark mode. The three branched EffectComposers (AO+vignette / AO only / vignette only) collapse into one composer with conditionally-mounted children, which is also what made room for the new Outline child without an 8-way truth table. New SceneSettings.postProcessing.silhouette flag (defaults on); turn off via doc settings if a project doesn't want the contour.
EffectComposer types its children as `JSX.Element | JSX.Element[]`, which rejects the inlined `cond && <Effect/>` shorthand because that expression is `false | Element`. Build the array up-front so disabled effects drop out cleanly.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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.
Summary
Four targeted rendering fixes after auditing why a vcad scene doesn't yet
look like a polished commercial CAD viewer (translucent enclosure over a
PCB, soft AO during motion, smooth curves, subtle silhouettes). Each
change is its own commit so they can be reverted independently.
Commits, in order
feat(render): translucent materials via MeshPhysicalMaterialAdds optional
transmission/ior/thickness/attenuationDistance/
attenuationColor/clearcoat/clearcoatRoughnesstoMaterialPresetandMaterialDef.SceneMeshnow emits<meshPhysicalMaterial>when transmission > 0, otherwise the cheaper<meshStandardMaterial>. Existingglass/glass-tintedpresets gaintransmission and IOR; new presets: Acrylic (Clear) and
Polycarbonate (Frosted). The biggest visible gap — translucent
housings rendering as opaque polished plastic — is closed.
fix(render): keep AO running during camera motion at reduced samplesThe post-processing pass was gated on
!isCameraMoving, so AO andvignette vanished the moment the user started orbiting. The scene went
visibly flat during interaction, then snapped back at rest. Now the
EffectComposerstays mounted andaoSamplesdrops 6→3 (denoise 4→1)while moving.
feat(tessellate): chord and angular tolerance for adaptive segmentationAdds optional
chord_toleranceandangular_tolerancefields toTessellationParamsplus acircle_segments_for_radius()helper.Cylindrical, conical, spherical, and toroidal face tessellators now
call it so a 1mm fillet doesn't get the same 32 segments as a 100mm
cylinder. Defaults stay
None— existing callers see no behaviorchange. Opt-in entry:
TessellationParams::from_tolerances(chord, ang).feat(render): silhouette outline post-process around every partWraps the rendered scene in
<Selection>/<Select>from@react-three/postprocessingand adds anOutlinepass for the darkcontour polished CAD viewers all use. Color tracks the theme so the
contour stays subtle in dark mode. The three branched
EffectComposers (AO+vignette / AO only / vignette only) collapseinto one composer with conditionally-mounted children. New
SceneSettings.postProcessing.silhouetteflag, defaults on.fix(render): build EffectComposer children as a typed arrayFollowup to commit 4:
EffectComposertypes its children strictly(
JSX.Element | JSX.Element[]), so the inlinedcond && <Effect/>shorthand was rejected. Build the array up-front instead.
Test plan
cargo test -p vcad-kernel-tessellate --lib— all 14 passcargo test -p vcad-kernel --lib— all 47 passcargo clippy -p vcad-kernel-tessellate -p vcad-kernel -- -D warnings— cleannpm run build -w @vcad/ir— cleannpm test -w @vcad/ir— 34/34 passnpm test -w @vcad/app— 15/15 passVCAD_WASM_SKIP=1 npm run build -w @vcad/app— clean (vite + tsc -b)glassmaterial and confirmit actually transmits light through the housing
in both light and dark themes
What this does NOT do
The original audit also flagged: contact / PCSS shadows, ray-traced
transmission, per-component PCB rendering. Those are bigger projects
and intentionally out of scope here.
https://claude.ai/code/session_01HsoFZhtUKiU22qRZp4SbUR
Generated by Claude Code