-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
Upstream bevy_color_blindness #5606
Upstream bevy_color_blindness #5606
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not really in a position to judge if this is a good thing to actually have, but it can only be good to have that conversation
I'm by no means a rendering expert, but I've put in a conversation starter
Lots of feedback, but to be clear I think that this is incredibly valuable, and a fantastic foundation. Feel free to push back if you think I'm wrong; I'm not a rendering expert. |
To avoid the list of bevy crates from growing too large, would it make sense to put this into a |
/// | ||
/// [`UiCameraConfig`]: bevy_ui::entity::UiCameraConfig | ||
#[derive(Component)] | ||
pub struct ColorBlindnessCamera; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe call this ColorBlindCamera
? The camera itself is color blind and thus simulates how a color blind person would see the game.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure how I feel about this. It sounds nicer, but I think having all types except one have the -ness
suffix would lead to confusion.
As I said in the linked issue, I'd really like to avoid isolating accessibility features off on their own. Accessibility is a core requirement, not something to be tacked on at the end. Down the line, I think this probably belongs in something like |
I was the author of the PR for the post-processing example, allow me to link a few relevant discussions which we might want to address: Window resizing
Full screen triangleIt's discussing 2 things:
I'll keep an eye on this PR, I suspect this could lead to improve the post processing example 👍 |
@fragment | ||
fn fragment( | ||
@builtin(position) position: vec4<f32>, | ||
#import bevy_sprite::mesh2d_vertex_output | ||
) -> @location(0) vec4<f32> { | ||
// Get screen position with coordinates from 0 to 1 | ||
let uv = position.xy / vec2<f32>(view.width, view.height); | ||
|
||
var c = textureSample(texture, our_sampler, uv); | ||
|
||
return vec4<f32>( | ||
c.r * p.red.x + c.g * p.red.y + c.b * p.red.z, | ||
c.r * p.green.x + c.g * p.green.y + c.b * p.green.z, | ||
c.r * p.blue.x + c.g * p.blue.y + c.b * p.blue.z, | ||
c.a | ||
); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd love to see an informed comparison with the approach linked in the associated issue: https://github.com/electronicarts/Tunable-Colorblindness-Solution
I translated into bevy if it can help to make a comparison : https://github.com/Vrixyz/bevy/blob/colorblind/assets/shaders/colorblind.wgsl
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not well-versed enough in the mess that is the world of colors to be able to provide any sort of comparison, much less an informed one '^^. Is there any Bevy contributor who does and would be able to help us with this?
Oh whoops didn't read the full thread haha. Sure that makes sense and it'd be really great if a11y was treated as a vital part to the crate(s) they affect. That being said, though, it might be worthwhile to group them into their own crate to act as an intermediate step before fully integrating them (if they need an intermediate step, integration isn't straightforward, dependency issues, etc.). Just to get them in quickly and worry about refactoring/integrating in the future. Or to be a place for tools/APIs that might not fit into any one crate otherwise. But if this isn't actually as good an idea as I think it is I totally understand haha |
Regarding the question of "should we be splitting things into crates, or integrating into existing crates", I'd like to propose the following consideration: having a larger number of smaller crates is more scalable. Typical bevy users already depend on bevy as a whole, and access everything via reexports or prelude. In practice, there isn't much difference to user convenience or how practical the features are to use, from them being split into more crates.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new crate should also be added to the publishing script tools/publish.sh
.
Depending on how long future discussions/feedbacks take, this PR might be a good candidate for bevy nursery bevyengine/rfcs#63 |
Yep, this was one of the crates that prompted that discussion for me :) |
This commit moves `mode` and `enabled` into `ColorBlindnessCamera`, which allows for multiple cameras with different modes. This should allow multiple windows to work correctly, but it hasn't been tested yet.
02568fd
to
aa0fcb0
Compare
These last commits fix a bunch of stuff that was previously mentioned:
All of this stuff should make multiple/no windows work, but I haven't tested it yet cause I'm not too familiar with how that works. The existing example continues working correctly. |
}); | ||
} | ||
|
||
fn change_mode(input: Res<Input<KeyCode>>, mut cameras: Query<&mut ColorBlindnessCamera>) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor nitpick, to avoid useless computations when input didn't change:
fn change_mode(input: Res<Input<KeyCode>>, mut cameras: Query<&mut ColorBlindnessCamera>) {
if !input.is_changed() {
return;
}
Edit: as noted below, it's not useful.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this works - Input
is always update
d iirc?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indeed! Thanks for the correction
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me and is a needed and necessary component to the engine as a whole :) I would be happy getting this in as-is.
I don't think this should be included in Bevy. At least not yet. It is a dev tool to simulate color blindness and should be part of an editor, not something needed in a game directly that would modify automatically the colors to accommodate for color blindness |
@mockersf has convinced me. @annieversary, hopefully this review process has been helpful to you (and your code upstream), and I very much welcome you to submit this as an editor tool once we're there! |
I'm not sure I'm understanding the reasoning to close this PR. I agree it is a dev tool, but I don't see why it should be linked to an editor? Ideally, if I want to make a game and make sure that it's playable by people with various levels of color-blindness, I wouldn't just view my scenes through an editor and call it a day. If I have enough resources I would make colorblind people play it, but if I have just a handful of playtesters I would want to give some of them a colorblind emulation version of the game, or if I'm by myself I would like to fully play the game with this mode myself at least. Shouldn't there maybe be a |
Another reason why this PR didn't make it is that the post processing method used was more a "hack" than "the good way", it's based on an old post-processing example. Now bevy main has an updated example, and I think an "official" plugin should use that updated code as its base, it supports resizing out of the box, and doesn't impact the world with arbitrary mesh. |
This PR upstreams bevy_color_blindness, as discussed in #2724.
As mentioned in that issue, we would ideally have this be a submodule in
bevy_render
, in order for it to be well-integrated and not it's own segmented niche. Due to cyclic dependencies that's not possible, so for the time being I'm adding it as a top-level crate, pending further discussion.I've also copied over the main example from
bevy_color_blindness
, under a new Accessibility category, as a temporary thing.Changelog
bevy_color_blindness
as a top-level crate.examples/accessibility/color_blindness_simulation.rs
.