Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix lines deforming or disappearing when partially behind the camera #50

Merged

Conversation

irate-devil
Copy link
Contributor

If a line has one point behind the camera(near plane) then it would deform or, if the depth_bias setting was set to a negative value, disappear.

Solution

The issue is that performing a perspective divide does not work correctly for points behind the near plane and a perspective divide is used inside the shader to define the line width in screen space.
The solution is to perform near plane clipping manually inside the shader before the perspective divide is done.

I have not investigated the performance of this fix.

Related

Screenshots of this issue with Bevy's own lines: discord link
The identical PR to fix this same issue in Bevy: bevyengine/bevy#9470

@IceSentry IceSentry merged commit bcc2479 into ForesightMiningSoftwareCorporation:main Jan 26, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants