Skip to content

Faint lines between nodes in 0.14.0rc2 #13807

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

Closed
rparrett opened this issue Jun 11, 2024 · 2 comments · Fixed by #13814
Closed

Faint lines between nodes in 0.14.0rc2 #13807

rparrett opened this issue Jun 11, 2024 · 2 comments · Fixed by #13814
Labels
A-Rendering Drawing game state to the screen A-UI Graphical user interfaces, styles, layouts, and widgets C-Bug An unexpected or incorrect behavior
Milestone

Comments

@rparrett
Copy link
Contributor

Bevy version

release-0.14, current main (d659a1f7d506c5c6eba9dfe2a6e878a8c72ecef6)
bisected to #13523

Relevant system information

SystemInfo { os: "MacOS 14.5 ", kernel: "23.5.0", cpu: "Apple M1 Max", core_count: "10", memory: "64.0 GiB" }
AdapterInfo { name: "Apple M1 Max", vendor: 0, device: 0, device_type: IntegratedGpu, driver: "", driver_info: "", backend: Metal }

scale_factor 2.0

What you did

Code
use bevy::prelude::*;

const BG: Color = Color::BLACK;

fn main() {
    App::new()
        .add_plugins(DefaultPlugins)
        .add_systems(Startup, setup)
        .run();
}

fn setup(mut commands: Commands) {
    commands.spawn(Camera2dBundle::default());

    let container = commands
        .spawn(NodeBundle {
            style: Style {
                width: Val::Percent(100.0),
                height: Val::Percent(100.0),
                flex_direction: FlexDirection::Column,
                align_items: AlignItems::Center,
                justify_content: JustifyContent::Center,
                ..default()
            },
            background_color: Color::NONE.into(),
            ..default()
        })
        .id();

    let top = commands
        .spawn(NodeBundle {
            style: Style {
                width: Val::Px(300.),
                height: Val::Px(50.0),
                ..default()
            },
            background_color: BG.into(),
            ..default()
        })
        .id();

    let bottom = commands
        .spawn(NodeBundle {
            style: Style {
                width: Val::Px(300.),
                height: Val::Px(51.0),
                ..default()
            },
            background_color: BG.into(),
            ..default()
        })
        .id();

    commands.entity(container).push_children(&[top, bottom]);
}

What went wrong

There are faint lines between the adjacent flex nodes.

0.13.2 image
main image

Additional information

This was reported by a user who experienced a similar issue in the wild while migrating their project to 0.14.0-rc.2.

@rparrett rparrett added C-Bug An unexpected or incorrect behavior S-Needs-Triage This issue needs to be labelled labels Jun 11, 2024
@alice-i-cecile alice-i-cecile added this to the 0.14 milestone Jun 11, 2024
@alice-i-cecile alice-i-cecile added A-UI Graphical user interfaces, styles, layouts, and widgets A-Rendering Drawing game state to the screen and removed S-Needs-Triage This issue needs to be labelled labels Jun 11, 2024
@hymm
Copy link
Contributor

hymm commented Jun 11, 2024

The issue probably that the edges are on a half pixel, so they end up getting antialiased. But I'm not sure what the right fix is here. If there wasn't another shape there the edge should get antialiased since it's not fully on the pixel.

@rparrett
Copy link
Contributor Author

The issue probably that the edges are on a half pixel

I had a similar thought and added 1px to one of the boxes and saw the same behavior. I'm not sure if that's the right way to test though.

github-merge-queue bot pushed a commit that referenced this issue Jun 14, 2024
# Objective

- Fixes #13807

## Solution

- Before this pr we antialiased between 0.5 and -0.5. This pr changes
things to antialias between 0.25 and -0.25. I tried slightly larger
ranges, but the edge between the boxes still showed. I'm not 100% sure
this is the correct solution, but from what I could find the range you
use is more art than science.

## Testing

- Ran rounded_borders example, the code in the linked issue, and the
testing example from #12702.

---

## Changelog

- reduce antialiasing in ui shader.
mockersf pushed a commit that referenced this issue Jun 14, 2024
# Objective

- Fixes #13807

## Solution

- Before this pr we antialiased between 0.5 and -0.5. This pr changes
things to antialias between 0.25 and -0.25. I tried slightly larger
ranges, but the edge between the boxes still showed. I'm not 100% sure
this is the correct solution, but from what I could find the range you
use is more art than science.

## Testing

- Ran rounded_borders example, the code in the linked issue, and the
testing example from #12702.

---

## Changelog

- reduce antialiasing in ui shader.
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 A-UI Graphical user interfaces, styles, layouts, and widgets C-Bug An unexpected or incorrect behavior
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants