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 gizmo lines deforming or disappearing when partially behind the camera #9470

Merged
merged 1 commit into from
Aug 17, 2023

Conversation

tim-blackbird
Copy link
Contributor

@tim-blackbird tim-blackbird commented Aug 17, 2023

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.

@github-actions
Copy link
Contributor

Example alien_cake_addict failed to run, please try running it locally and check the result.

@cart cart added this pull request to the merge queue Aug 17, 2023
Merged via the queue into bevyengine:main with commit e2ed42f Aug 17, 2023
22 of 23 checks passed
@cart cart added this to the 0.11.2 milestone Aug 17, 2023
cart pushed a commit that referenced this pull request Aug 17, 2023
…amera (#9470)

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.
@tim-blackbird tim-blackbird deleted the fix-gizmo-perspective-divide branch August 17, 2023 22:03
@cart cart mentioned this pull request Oct 13, 2023
43 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Rendering Drawing game state to the screen C-Bug An unexpected or incorrect behavior
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants