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

Lines with perspective disappear at certain camera angles #46

Closed
NEO97online opened this issue May 5, 2023 · 8 comments
Closed

Lines with perspective disappear at certain camera angles #46

NEO97online opened this issue May 5, 2023 · 8 comments

Comments

@NEO97online
Copy link

NEO97online commented May 5, 2023

With perspective: true, moving the camera close to lines or in certain angles makes them disappear. I'm not exactly sure if they're being culled or if something else is going on:

2023-05-04.21-32-09.mp4

(Don't mind the strangely uncropped window)

@aevyrie
Copy link
Collaborator

aevyrie commented May 5, 2023

Yeah, this looks like culling of some kind. Have you tried adding NoFrustumCulling to those entities? I use polylines with perspective all the time, so I'm surprised I haven't seen this until now.

@NEO97online
Copy link
Author

NoFrustumCulling on the entity with the PolylineBundle didn't have any effect, unfortunately

@aevyrie
Copy link
Collaborator

aevyrie commented May 8, 2023

Hm... I have a hunch that what's happening is the vertex that goes offscreen is turning into a NaN. I haven't seen this before because usually I don't have long two-vertex segments, instead they are subdivided into much more dense polylines so this issue is not visible.

@NEO97online
Copy link
Author

NEO97online commented May 9, 2023

Seems like it might be something like that. It definitely seems to be happening when either of the two points goes outside the camera's frustum.

Interestingly, when HDR is enabled, the lines don't disappear but take on a blueish translucent appearance. Maybe this is a clue:

Untitled.video.-.Made.with.Clipchamp.mp4

@aevyrie
Copy link
Collaborator

aevyrie commented May 11, 2023

Well this is spooky, thanks for providing more details. Could you try adding a bunch of subdivisions to your lines to see if that functions as a workaround?

Oddly enough I was using the bevy 0.9 version of this today and had a similar case of a two-vertex line, but was unable to replicate this.

@NEO97online
Copy link
Author

NEO97online commented May 12, 2023

I believe this started with bevy 0.10.

Adding more line segments doesn't resolve the issue, but rather than the entire line turning translucent blue, it's split at the subdivisions like this (sorry for the pause menu overlay, but you can still see the issue):

image

@aevyrie
Copy link
Collaborator

aevyrie commented May 12, 2023

@IceSentry any idea what could be causing this? You did the 0.10 migration, and you might have some insight into other bevy changes that may be causing this.

@IceSentry
Copy link
Contributor

Fixed in #47

github-merge-queue bot pushed a commit to bevyengine/bevy that referenced this issue Jul 31, 2023
# Objective

- In bevy_polyline, we discovered an issue that happens when line width
is smaller than 1.0 and using perspective. It would sometimes end up
negative or NaN. I'm not entirely sure _why_ it happens.

## Solution

- Make sure the width doesn't go below 0 before multiplying it with the
alpha

# Notes 

Here's a link to the bevy_polyline issue
ForesightMiningSoftwareCorporation/bevy_polyline#46

I'm not sure if the solution is correct but it solved the issue in my
testing.

Co-authored-by: François <[email protected]>
cart pushed a commit to bevyengine/bevy that referenced this issue Aug 10, 2023
- In bevy_polyline, we discovered an issue that happens when line width
is smaller than 1.0 and using perspective. It would sometimes end up
negative or NaN. I'm not entirely sure _why_ it happens.

- Make sure the width doesn't go below 0 before multiplying it with the
alpha

Here's a link to the bevy_polyline issue
ForesightMiningSoftwareCorporation/bevy_polyline#46

I'm not sure if the solution is correct but it solved the issue in my
testing.

Co-authored-by: François <[email protected]>
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

No branches or pull requests

3 participants