Fix close-camera line rendering for drei-based lines under reversed depth#748
Open
brentyi wants to merge 1 commit into
Open
Fix close-camera line rendering for drei-based lines under reversed depth#748brentyi wants to merge 1 commit into
brentyi wants to merge 1 commit into
Conversation
…epth three-stdlib LineMaterial's trimSegment near-plane estimate assumes a standard depth projection; under the reversed depth buffer we enable in App.tsx it evaluates to -far/2 instead of -near, so line segments crossing the camera plane get extrapolated hundreds of units away and the part of the line near the camera disappears. Our own <Line> carried a per-material onBeforeCompile patch for this (#720), but drei's <Line> -- used by camera frustums, Catmull-Rom / cubic Bezier splines, and internally by PivotControls -- constructs its own LineMaterial instances that never got patched. Replace the per-material patch with a vertexShader accessor on LineMaterial.prototype that rewrites the near-plane estimate at construction time for every instance, drei's included. This also stops us from overwriting three-stdlib's own onBeforeCompile, which manages the USE_LINE_COLOR_ALPHA define for transparent materials. Also fixes a PLW0108 lint error (newly stabilized in ruff 0.15) in test_get_render.py.
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.
Generated by Claude Code