bevyengine / bevyengine/bevy

Color rounding difference between clear color and shapes

Open
#23,577 8 comments 0 reactions 0 assignees View on GitHub
A-Color A-Rendering C-Bug C-Machine-Specific S-Needs-Investigation
Dominant language
Rust
Stars
48.2k
Forks
4.8k
Avg merge
3d 22h
Merged PRs (30d)
161

Description

## Bevy version and features

- tested with 0.18.1 and 3cf98a6130cf37060da89bc6a079b9d9c5dd05f4
- `features="2d"`

```ignore
AdapterInfo { name: "AMD Radeon RX 6400 (RADV NAVI24)", vendor: 4098, device: 29759, device_type: DiscreteGpu, device_pci_bus_id: "0000:03:00.0", driver: "radv", driver_info: "Mesa 26.0.3-arch1.1", backend: Vulkan, subgroup_min_size: 32, subgroup_max_size: 64, transient_saves_memory: false }
```

- wgpu 29.0.1
- winit 0.30.13

## What you did

```rust
use bevy::prelude::*;

const COLOR: Color = Color::srgb(0.1, 0.1, 0.1);

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

fn setup(
mut commands: Commands,
mut meshes: ResMut>,
mut materials: ResMut>,
) {
commands.spawn(Camera2d);
commands.spawn((
Mesh2d(meshes.add(Circle::new(100.0))),
MeshMaterial2d(materials.add(COLOR)),
));
}
```

## What went wrong

The circle color is not the same as the background color (slightly differs):

Image

Circle is `#1a1a1a` and background is `#191919`.

I looks like a rounding of 25.5 being different on one side (0x1a = 26) and the other (0x19 = 25).

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.