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

Invisible UI Images when using certain transforms #5293

Closed
Runi-c opened this issue Jul 12, 2022 · 3 comments
Closed

Invisible UI Images when using certain transforms #5293

Runi-c opened this issue Jul 12, 2022 · 3 comments
Labels
A-Rendering Drawing game state to the screen C-Bug An unexpected or incorrect behavior P-High This is particularly urgent, and deserves immediate attention
Milestone

Comments

@Runi-c
Copy link

Runi-c commented Jul 12, 2022

Bevy version

a1d3f1b

This does not reproduce on current stable version 0.7

Relevant system information

AdapterInfo { name: "NVIDIA GeForce RTX 3070", vendor: 4318, device: 9348, device_type: DiscreteGpu, backend: Vulkan }

What you did

Spawned a UI image with a transform (e.g. to flip a UI sprite using rotation or scale):

    commands.spawn_bundle(Camera2dBundle::default());
    commands.spawn_bundle(ImageBundle {
        style: Style {
            size: Size::new(Val::Px(500.0), Val::Px(500.0)),
            ..default()
        },
        image: asset_server.load("branding/bevy_logo_dark_big.png").into(),
        transform: Transform::from_rotation(Quat::from_rotation_x(1.0)),
        ..default()
    });

What went wrong

Depending on the transform, the image either renders clipped or does not render at all.

Additional information

transform: Transform::from_rotation(Quat::from_rotation_z(0.5)), (rotates with distortion on both)
image

transform: Transform::from_rotation(Quat::from_rotation_z(1.0)), (does not render on main)
image

transform: Transform::from_scale(vec3(1.0, 0.5, 1.0)), (scales correctly on both)
image

transform: Transform::from_scale(vec3(1.0, -0.5, 1.0)), (does not render on main)
image

@Runi-c Runi-c added C-Bug An unexpected or incorrect behavior S-Needs-Triage This issue needs to be labelled labels Jul 12, 2022
@alice-i-cecile alice-i-cecile added A-Rendering Drawing game state to the screen and removed S-Needs-Triage This issue needs to be labelled labels Jul 12, 2022
@alice-i-cecile alice-i-cecile added this to the Bevy 0.8 milestone Jul 12, 2022
@alice-i-cecile alice-i-cecile added the P-High This is particularly urgent, and deserves immediate attention label Jul 12, 2022
@alice-i-cecile
Copy link
Member

@superdump @cart I think we need to ensure this is fixed by 0.8; this is a severe regression.

@Runi-c Runi-c changed the title Clipping and invisible UI Images when using transforms Invisible UI Images when using certain transforms Jul 12, 2022
@Runi-c
Copy link
Author

Runi-c commented Jul 12, 2022

The clipping with x-rotation previously included in the issue description is actually not a regression, the same behavior is exhibited on 0.7. So the only regression here is the images going invisible with certain transforms. I opened another issue about the clipping and distortion present in 0.7: #5294

@mockersf
Copy link
Member

I tried a quick fix for this in #5389

@bors bors bot closed this as completed in c0b87d2 Jul 20, 2022
inodentry pushed a commit to IyesGames/bevy that referenced this issue Aug 8, 2022
# Objective

- Fixes bevyengine#5293 
- UI nodes with a rotation that made the top left corner lower than the top right corner (z rotations greater than π/4) were culled

## Solution

- Do not cull nodes with a rotation, but don't do proper culling in this case



As a reminder, changing rotation and scale of UI nodes is not recommended as it won't impact layout. This is a quick fix but doesn't handle properly rotations and scale in clipping/culling. This would need a lot more work as mentioned here: https://github.com/bevyengine/bevy/blob/c2b332f98a0bcab7390e4b184099202cfb4fbbe1/crates/bevy_ui/src/render/mod.rs#L404-L405
james7132 pushed a commit to james7132/bevy that referenced this issue Oct 28, 2022
# Objective

- Fixes bevyengine#5293 
- UI nodes with a rotation that made the top left corner lower than the top right corner (z rotations greater than π/4) were culled

## Solution

- Do not cull nodes with a rotation, but don't do proper culling in this case



As a reminder, changing rotation and scale of UI nodes is not recommended as it won't impact layout. This is a quick fix but doesn't handle properly rotations and scale in clipping/culling. This would need a lot more work as mentioned here: https://github.com/bevyengine/bevy/blob/c2b332f98a0bcab7390e4b184099202cfb4fbbe1/crates/bevy_ui/src/render/mod.rs#L404-L405
ItsDoot pushed a commit to ItsDoot/bevy that referenced this issue Feb 1, 2023
# Objective

- Fixes bevyengine#5293 
- UI nodes with a rotation that made the top left corner lower than the top right corner (z rotations greater than π/4) were culled

## Solution

- Do not cull nodes with a rotation, but don't do proper culling in this case



As a reminder, changing rotation and scale of UI nodes is not recommended as it won't impact layout. This is a quick fix but doesn't handle properly rotations and scale in clipping/culling. This would need a lot more work as mentioned here: https://github.com/bevyengine/bevy/blob/c2b332f98a0bcab7390e4b184099202cfb4fbbe1/crates/bevy_ui/src/render/mod.rs#L404-L405
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Rendering Drawing game state to the screen C-Bug An unexpected or incorrect behavior P-High This is particularly urgent, and deserves immediate attention
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants