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

Model is clipped when near to or far from the camera #19

Closed
hannobraun opened this issue Dec 5, 2021 · 3 comments
Closed

Model is clipped when near to or far from the camera #19

hannobraun opened this issue Dec 5, 2021 · 3 comments
Labels
topic: display Displaying Fornjot models type: bug Something isn't working

Comments

@hannobraun
Copy link
Owner

hannobraun commented Dec 5, 2021

When zooming in closely or far out, the the model is clipped. This happens because the near and far planes are at a constant distance from the camera. It would be better to set near and far plane distances so that the model is always fully visible.

I initially thought we could do this based on the bounding volume, but I realized this is not true. If the model is concave, the camera might be within the bounding volume, so we can't use the bounding volume to make decisions about the near plane in this case.

Maybe any of those are better solutions:

  • Use distance to the focus point.
  • Shoot one or more representative rays at the model.
  • Do collision detection between model and camera cone.
@hannobraun hannobraun added type: bug Something isn't working topic: display Displaying Fornjot models labels Dec 5, 2021
@hannobraun
Copy link
Owner Author

Updated the issue description with some more detailed thoughts.

@hannobraun hannobraun changed the title Model is clipped when near the camera Model is clipped when near to or far away from the camera Dec 11, 2021
@hannobraun
Copy link
Owner Author

Updated title and description to also include the far plane, which is a problem I've run into just now.

@hannobraun
Copy link
Owner Author

I realized I'm overthinking this. Here's how it should work, I think:

  • If the camera is outside the bounding volume, set near and far plane distances such, that the bounding volume is enclosed between the planes.
  • If the camera is inside the bounding volume, set far plane distance such, that the far plane is behind the bounding volume, and set near plane distance to a constant minimum value.

That should be enough. If it isn't, it can be improved later.

@hannobraun hannobraun changed the title Model is clipped when near to or far away from the camera Model is clipped when near to or far from the camera Dec 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: display Displaying Fornjot models type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant