You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I attempted to use the newly added sub_camera_view API (#15537 ) to create a subview that overlays a shader effect onto a part of the full image. However this only works when the size and full_size of the sub_camera_view have the same aspect ratio.
I made an example to illustrate this effect in a fork
What went wrong
Regardless of the aspect ratios of size and full_size, the shader effect should cleanly overlap the image of the main camera.
Instead in both orthographic and perspective projection the projection of the sub view is skewed when the aspect ratio of size and full_size differ.
Additional information
Perspective (overlay working correctly when aspect ratio is the same):
Perspective (overlay is skewed when aspect ratios differ):
Analogous in orthographic projection.
To run the example yourself, check out the branch and run cargo run --example camera_sub_view.
Press P to switch projection and A to switch aspect ratios.
Likely cause
The most likely reason is that I made a mistake in the projection calculations here and here.
The text was updated successfully, but these errors were encountered:
I will attempt to find the fix for this issue myself in the coming days. However I'm very much an amateur when it comes to projection calculations, so if anyone with more experience in the area would like to take a look, the help would be greatly appreciated.
Bevy version
Main branch (c841dd9)
What you did
I attempted to use the newly added
sub_camera_view
API (#15537 ) to create a subview that overlays a shader effect onto a part of the full image. However this only works when thesize
andfull_size
of thesub_camera_view
have the same aspect ratio.I made an example to illustrate this effect in a fork
What went wrong
Regardless of the aspect ratios of
size
andfull_size
, the shader effect should cleanly overlap the image of the main camera.Instead in both orthographic and perspective projection the projection of the sub view is skewed when the aspect ratio of
size
andfull_size
differ.Additional information
Perspective (overlay working correctly when aspect ratio is the same):
Perspective (overlay is skewed when aspect ratios differ):
Analogous in orthographic projection.
To run the example yourself, check out the branch and run
cargo run --example camera_sub_view
.Press P to switch projection and A to switch aspect ratios.
Likely cause
The most likely reason is that I made a mistake in the projection calculations here and here.
The text was updated successfully, but these errors were encountered: