-
-
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
Closed
annieversary
wants to merge
10
commits into
bevyengine:main
from
annieversary:upstream_bevy_color_blindness
Closed
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
7bcb661
Add bevy_color_blindness as a top level crate
annieversary e329e76
Move example to new Accessibility category
annieversary 1160186
fix imports in doc examples
annieversary 905f173
run `cargo run -p build-example-pages -- update`
annieversary 465cc97
Improve names and documentation.
annieversary 4b672f9
run `cargo run -p build-example-pages -- update`
annieversary f82464d
`TextureFormat::bevy_default()`
annieversary 0a8a176
add bevy_color_blindness to `tools/publish.sh`
annieversary aa0fcb0
remove `ColorBlindnessParams`
annieversary 278f568
Respect render target
annieversary File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
[package] | ||
name = "bevy_color_blindness" | ||
version = "0.9.0-dev" | ||
edition = "2021" | ||
description = "Provides color blindness simulation for Bevy Engine" | ||
homepage = "https://bevyengine.org" | ||
repository = "https://github.com/bevyengine/bevy" | ||
license = "MIT OR Apache-2.0" | ||
keywords = ["bevy"] | ||
|
||
[dependencies] | ||
# bevy | ||
bevy_app = { path = "../bevy_app", version = "0.9.0-dev" } | ||
bevy_asset = { path = "../bevy_asset", version = "0.9.0-dev" } | ||
bevy_core_pipeline = { path = "../bevy_core_pipeline", version = "0.9.0-dev" } | ||
bevy_ecs = { path = "../bevy_ecs", version = "0.9.0-dev" } | ||
bevy_math = { path = "../bevy_math", version = "0.9.0-dev" } | ||
bevy_reflect = { path = "../bevy_reflect", version = "0.9.0-dev", features = [ | ||
"bevy", | ||
] } | ||
bevy_render = { path = "../bevy_render", version = "0.9.0-dev" } | ||
bevy_sprite = { path = "../bevy_sprite", version = "0.9.0-dev" } | ||
bevy_transform = { path = "../bevy_transform", version = "0.9.0-dev" } | ||
bevy_ui = { path = "../bevy_ui", version = "0.9.0-dev" } | ||
bevy_window = { path = "../bevy_window", version = "0.9.0-dev" } | ||
|
||
[dev-dependencies] | ||
bevy_input = { path = "../bevy_input", version = "0.9.0-dev" } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#import bevy_pbr::mesh_view_bindings | ||
|
||
struct Percentages { | ||
red: vec3<f32>, | ||
green: vec3<f32>, | ||
blue: vec3<f32>, | ||
}; | ||
|
||
@group(1) @binding(0) | ||
var texture: texture_2d<f32>; | ||
|
||
@group(1) @binding(1) | ||
var our_sampler: sampler; | ||
|
||
@group(1) @binding(2) | ||
var<uniform> p: Percentages; | ||
|
||
@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 | ||
); | ||
} | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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?