-
-
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
2D camera renders nothing if scale is < 1.0 #239
Comments
i have a feeling this has to do with depth / clip distance. if thats the problem, we could consider increasing the near/far distance to see if that resolves this problem. |
I just ran into this problem, and setting |
@Finnerale When you set |
@Matthew-Maclean All I did, was setting |
@Finnerale Ok, so you didn't touch the |
I am experiencing the same behavior, but setting
(*) I'm drawing a grid of lines (with lyon) and they start to "twinkle" in and out when I zoom out too far, but I'm guessing that's a different category of problem, something to do with rendering polygons that are smaller than a pixel. |
Closing as stale: the renderer has been completely reworked. Feel free to reopen if you have a modern reproduction. |
@alice-i-cecile unfortunately this is still an issue. Here is a minimum reproducible example using bevy main as of today: https://github.com/colepoirier/bevy_2d_camera_scale_repro/tree/master. |
I investigated a bit, but don't know enough about the rendering pipeline to have opinions on what to do about it. The
if When |
Adjust the orthographic projection scale, not the camera transform scale. The latter will end up moving the vertices outside the view frustum defined by the projection. Scaling the orthographic projection only adjusts the left/right/top/bottom bounds of the view frustum and doesn't touch the near/far, which is what you want for zooming. |
When I run this on Bevy|main, I always see the blue square, and scale is always reported as Vec3(1.0, 1.0, 1.0). a) Is this exercising the failure scenario?, b) Is the problem fixed?, c) Does the example need to be adjusted? |
This is a valid reproduction. Does the perceived zoom level actually change? If not, I would probably call this "basically fixed, but needs a warning somewhere". If it does, via implicitly updating the orthographic projection's scale field, I would call this fixed but likely in need of more documentation. |
I cannot reproduce the issue with Bevy 0.12 anymore, closing this issue. I used the reproduction code by @colepoirier, adapted to 0.12: colepoirier/bevy_2d_camera_scale_repro#1 I can see the zoom effect and the sprite is always rendered, also for a scale of |
This code sheet saves my nerves and time (thankfully GPT): commands.spawn(Camera2dBundle {
transform: Transform::from_xyz(100., 0., 1000.), // Set Z transform to 1000.0 for saving far distance in general option
projection: OrthographicProjection {
scaling_mode: ScalingMode::FixedVertical(500.0), // you can change scale based on your needings
..default()
}.into(),
..default()
}) So, the main problem is that, Camera have un-predictable option on zooming at long far distance when You don`t need to write code-lines where you setup distance (between your game objects and camera) and scaling for your camera. You can set this when you create Camera 2d and this can save your time. |
As I am trying to get my scene to fit on-screen (difficult with the default orthographic projection, but that's another issue), I noticed that nothing is being rendered if the camera scale is < 1.0.
If the scale is above 1.0, the view becomes "zoomed out" (everything renders smaller). If the scale is any value below 1.0 (like in the example above), I get a blank screen with nothing rendered.
The text was updated successfully, but these errors were encountered: