-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Upstream bevy_color_blindness #5606
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
Changes from 4 commits
7bcb661
e329e76
1160186
905f173
465cc97
4b672f9
f82464d
0a8a176
aa0fcb0
278f568
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| 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" } |
| 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 | ||
| ); | ||
| } | ||
|
Comment on lines
+18
to
+34
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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? |
||
Uh oh!
There was an error while loading. Please reload this page.