-
-
Notifications
You must be signed in to change notification settings - Fork 25.4k
Add new Camera3D type: Oblique #89140
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -122,6 +122,13 @@ | |||||
| Sets the camera projection to frustum mode (see [constant PROJECTION_FRUSTUM]), by specifying a [param size], an [param offset], and the [param z_near] and [param z_far] clip planes in world space units. See also [member frustum_offset]. | ||||||
| </description> | ||||||
| </method> | ||||||
| <method name="set_oblique_plane_from_transform"> | ||||||
| <return type="void" /> | ||||||
| <param index="0" name="oblique_transform" type="Transform3D" /> | ||||||
| <description> | ||||||
| Sets the [member oblique_normal] and [member oblique_position] values of an oblique projection camera using a the origin and forward vector of the transform argument. For ease of using plane meshes as portals and mirrors. | ||||||
| </description> | ||||||
| </method> | ||||||
| <method name="set_orthogonal"> | ||||||
| <return type="void" /> | ||||||
| <param index="0" name="size" type="float" /> | ||||||
|
|
@@ -202,12 +209,24 @@ | |||||
| <member name="near" type="float" setter="set_near" getter="get_near" default="0.05"> | ||||||
| The distance to the near culling boundary for this camera relative to its local Z axis. Lower values allow the camera to see objects more up close to its origin, at the cost of lower precision across the [i]entire[/i] range. Values lower than the default can lead to increased Z-fighting. | ||||||
| </member> | ||||||
| <member name="oblique_normal" type="Vector3" setter="set_oblique_normal" getter="get_oblique_normal" default="Vector3(0, 1, 0)"> | ||||||
| The desired normal vector of the world space plane used by an oblique camera as an oblique near clipping plane. | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should the normal vector of the mentioned world space plane be provided in World space or in View space to this function ? Either way this should be clarified.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Gave it further thinking, and in the end I believe the oblique plane's normal and position attributes should be expressed in view space for consistency. |
||||||
| </member> | ||||||
| <member name="oblique_offset" type="float" setter="set_oblique_offset" getter="get_oblique_offset" default="0.0"> | ||||||
| The offset value for the oblique plane along its forward vector. | ||||||
| </member> | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not convinced about this using a separate projection mode from perspective. Most of the code seems to mimic perspective, just with some extra options. Perhaps we can condition this on whether those extra options are in use (for example, if
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've mentioned this in the top PR comment, which is that Lengyel's algorithm can technically be applied to any projection matrix, and it will remain the same except for the changes to the near clipping plane. My suggestions is to add a boolean flag to the camera which appends the matrix manipulation algorithm to the end of all the camera types. Rather than duplicating a single camera type. This would also further justify the added second
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
it sounds reasonable to me. we just have to be careful not to add overhead in the common case (not using oblique)
Comment on lines
+215
to
+217
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What's the reason for having an offset ? Seems like it plays more or less the same role than the znear. |
||||||
| <member name="oblique_position" type="Vector3" setter="set_oblique_position" getter="get_oblique_position" default="Vector3(0, 0, 0)"> | ||||||
| The world space position of the plane used by an oblique camera as an oblique near clipping plane. | ||||||
| </member> | ||||||
|
Comment on lines
+218
to
+220
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ideally we don't need an oblique position neither (see my comment on the oblique offset). The oblique near plane should be fully determined by the oblique normal and the camera znear value. Of course it would mean more math to synchronize it with the portal position, but less UI clutter. |
||||||
| <member name="projection" type="int" setter="set_projection" getter="get_projection" enum="Camera3D.ProjectionType" default="0"> | ||||||
| The camera's projection mode. In [constant PROJECTION_PERSPECTIVE] mode, objects' Z distance from the camera's local space scales their perceived size. | ||||||
| </member> | ||||||
| <member name="size" type="float" setter="set_size" getter="get_size" default="1.0"> | ||||||
| The camera's size in meters measured as the diameter of the width or height, depending on [member keep_aspect]. Only applicable in orthogonal and frustum modes. | ||||||
| </member> | ||||||
| <member name="use_oblique_frustum" type="bool" setter="set_use_oblique_frustum" getter="get_use_oblique_frustum" default="false"> | ||||||
| Toggle for applying oblique near plane frustum culling. | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
I would personally elaborate on what this means, as well. |
||||||
| </member> | ||||||
| <member name="v_offset" type="float" setter="set_v_offset" getter="get_v_offset" default="0.0"> | ||||||
| The vertical (Y) offset of the camera viewport. | ||||||
| </member> | ||||||
|
|
||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.