-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Confusing near and far fields in Camera #4456
Labels
Comments
AronDerenyi
added
C-Feature
A new feature, making something new possible
S-Needs-Triage
This issue needs to be labelled
labels
Apr 11, 2022
james7132
added
A-Rendering
Drawing game state to the screen
and removed
S-Needs-Triage
This issue needs to be labelled
labels
Apr 11, 2022
robtfm
pushed a commit
to robtfm/bevy
that referenced
this issue
May 17, 2022
# Objective - Fixes bevyengine#4456 ## Solution - Removed the `near` and `far` fields from the camera and the views. --- ## Changelog - Removed the `near` and `far` fields from the camera and the views. - Removed the `ClusterFarZMode::CameraFarPlane` far z mode. ## Migration Guide - Cameras no longer accept near and far values during initialization - `ClusterFarZMode::Constant` should be used with the far value instead of `ClusterFarZMode::CameraFarPlane`
exjam
pushed a commit
to exjam/bevy
that referenced
this issue
May 22, 2022
# Objective - Fixes bevyengine#4456 ## Solution - Removed the `near` and `far` fields from the camera and the views. --- ## Changelog - Removed the `near` and `far` fields from the camera and the views. - Removed the `ClusterFarZMode::CameraFarPlane` far z mode. ## Migration Guide - Cameras no longer accept near and far values during initialization - `ClusterFarZMode::Constant` should be used with the far value instead of `ClusterFarZMode::CameraFarPlane`
ItsDoot
pushed a commit
to ItsDoot/bevy
that referenced
this issue
Feb 1, 2023
# Objective - Fixes bevyengine#4456 ## Solution - Removed the `near` and `far` fields from the camera and the views. --- ## Changelog - Removed the `near` and `far` fields from the camera and the views. - Removed the `ClusterFarZMode::CameraFarPlane` far z mode. ## Migration Guide - Cameras no longer accept near and far values during initialization - `ClusterFarZMode::Constant` should be used with the far value instead of `ClusterFarZMode::CameraFarPlane`
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
What problem does this solve or what need does it fill?
Currently the camera keeps track of the near and far values. These values are not only not used but in many cases cause confusion as there can be projection matrices where a particular near or far value doesn't make sense. One example is the currently used reverse infinite perspective projection matrix which has no far plane.
Additionally since these values correspond to properties of the projection matrix it's expected that they are always in sync. This introduces points of failure if these values are not handled correctly.
What solution would you like?
I propose that we should remove these values from the camera (and views) since they to my knowledge they are never used. The only exception is the
ClusterFarZMode::CameraFarPlane
which just simply uses the camera'sfar
field. Since the camera's far value is already just an arbitrary number we could just as well use theClusterFarZMode::Constant
.What alternative(s) have you considered?
Since the main confusion is caused by having both a projection matrix and it's internal properties in the same component another solution could be merging the projections and the camera and having the camera compute it's projection matrix. This solution would simplify the use of camera but would make arbitrary projection matrices practically impossible.
Additional context
If there is a reason why the near and far values are tied to the camera and not only to the specific projections please let me know and maybe I can document it in the future.
The text was updated successfully, but these errors were encountered: