Skip to content

Ringing around pre-rasterized circles. #5810

Open
@karhu

Description

@karhu

Describe the bug:
Rendering darker circles on a brighter background can lead to "ringing" artifacts, where the outermost pixels of the circle are brighter than both the background and the circle. The artifact only shows when "Speed up filled circles with pre-rasterization" is enabled in the Tesselation Options (default).

Some details:

  • Circle fill is rgb(200,200,200)
  • Background fill is rgb(220,220,220)
  • Circle is rendered WITHOUT any border.
  • The observed ring is not just perceptual. Checked with MacOS color picker, and some pixels are rgb(230,230,230).
**Minimal Repro Example:**
#[derive(Default)]
struct ExampleApp {}

impl eframe::App for ExampleApp {
    fn update(&mut self, ctx: &egui::Context, _frame: &mut eframe::Frame) {
        // Tesselation Options GUI.
        egui::containers::SidePanel::left("left").show(ctx, |ui| {
            let mut options = ui.ctx().tessellation_options(|options| options.clone());
            ui.add(&mut options);
            ui.ctx()
                .tessellation_options_mut(|target| *target = options);
        });
        // Problematic dots/circles.
        egui::CentralPanel::default()
            .frame(egui::Frame::new())
            .show(ctx, |ui| {
                ui.painter().rect_filled(
                    ui.clip_rect(),
                    egui::CornerRadius::ZERO,
                    egui::Color32::from_rgb(220, 220, 220),
                );
                for x in 1..20 {
                    for y in 1..20 {
                        ui.painter().circle_filled(
                            ui.clip_rect().left_top() + egui::vec2(x as f32 * 10.0, y as f32 * 10.0),
                            1.5,
                            egui::Color32::from_rgb(200, 200, 200),
                        );
                    }
                }
            });
    }
}

fn main() -> eframe::Result {
    env_logger::init();
    eframe::run_native(
        "Bug Repro",
        Default::default(),
        Box::new(|_cc| Ok(Box::<ExampleApp>::default())),
    )
}

Expected behavior
No ringing. Same visuals independent of whether pre-rasterization is enabled.

Screenshots

Bad:
Image

Expected:
Image

Closeup:
Image

Desktop :

  • OSX, native

Additional context
This bears some similarities to #5751, but in a more controlled environment, given that an egui-internal texture is involved.

Metadata

Metadata

Assignees

Labels

bugSomething is brokenvisualsRenderings / graphics releated

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions