Skip to content

MSAA Changes colors and adds borders around sprites #419

Closed
@TheNeikos

Description

@TheNeikos

When setting a Msaa level above 1 sample the color changes:

Msaa 1:
image

Msaa 2:
image

Msaa 4:
image

Code:

use bevy::prelude::*;
use bevy::render::pass::ClearColor;

fn main() {
    env_logger::init();
    App::build()
        .add_resource(Msaa { samples: 4 })
        .add_resource(ClearColor(Color::rgb(0.5, 0.5, 0.0)))
        .add_default_plugins()
        .add_startup_system(setup.system())
        .run();
}

struct Square(u64);

fn setup(
    mut commands: Commands,
    mut materials: ResMut<Assets<ColorMaterial>>,
    asset_server: Res<AssetServer>,
) {
    commands
        .spawn(Camera2dComponents::default())
        .spawn(UiCameraComponents::default())
        .spawn((Square(1), Translation::new(0., 20., 0.)))
        .with_children(|parent| {
            parent.spawn(SpriteComponents {
                material: materials.add(Color::rgb(1.0, 0.2, 0.2).into()),
                sprite: Sprite {
                    size: Vec2::new(25., 25.),
                },
                translation: Translation::new(0., 0., 0.),
                ..Default::default()
            });
        });
}

My platform is Linux with an NVIDIA Corporation GP107GLM [Quadro P620] GPU

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-RenderingDrawing game state to the screen

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions