Skip to content
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

Upgrade to 0.15 #1

Merged
merged 5 commits into from
Dec 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,17 @@ hdr = []
sdr = []

[dependencies]
bevy = { version = "0.10", default-features = false, features = [
bevy = { version = "0.15", default-features = false, features = [
"bevy_asset",
"bevy_render",
"bevy_core_pipeline",
"png",
"tga",
] }


[dev-dependencies]
bevy = { version = "0.10", features = ["tga"] }
bevy = "0.15"
color-eyre = "0.6"
image = "0.24"
once_cell = "1"
4 changes: 2 additions & 2 deletions assets/shaders/blur.wgsl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#import bevy_core_pipeline::fullscreen_vertex_shader
#import bevy_render::globals
#import bevy_core_pipeline::fullscreen_vertex_shader::FullscreenVertexOutput
#import bevy_render::globals::Globals

@group(0) @binding(0)
var t: texture_2d<f32>;
Expand Down
4 changes: 2 additions & 2 deletions assets/shaders/chromatic-aberration.wgsl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#import bevy_core_pipeline::fullscreen_vertex_shader
#import bevy_render::globals
#import bevy_core_pipeline::fullscreen_vertex_shader::FullscreenVertexOutput
#import bevy_render::globals::Globals

@group(0) @binding(0)
var t: texture_2d<f32>;
Expand Down
4 changes: 2 additions & 2 deletions assets/shaders/flip.wgsl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#import bevy_core_pipeline::fullscreen_vertex_shader
#import bevy_render::globals
#import bevy_core_pipeline::fullscreen_vertex_shader::FullscreenVertexOutput
#import bevy_render::globals::Globals

@group(0) @binding(0)
var t: texture_2d<f32>;
Expand Down
4 changes: 2 additions & 2 deletions assets/shaders/lut.wgsl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#import bevy_core_pipeline::fullscreen_vertex_shader
#import bevy_render::globals
#import bevy_core_pipeline::fullscreen_vertex_shader::FullscreenVertexOutput
#import bevy_render::globals::Globals

@group(0) @binding(0)
var t: texture_2d<f32>;
Expand Down
4 changes: 2 additions & 2 deletions assets/shaders/masks.wgsl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#import bevy_core_pipeline::fullscreen_vertex_shader
#import bevy_render::globals
#import bevy_core_pipeline::fullscreen_vertex_shader::FullscreenVertexOutput
#import bevy_render::globals::Globals

@group(0) @binding(0)
var t: texture_2d<f32>;
Expand Down
4 changes: 2 additions & 2 deletions assets/shaders/pixelate.wgsl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#import bevy_core_pipeline::fullscreen_vertex_shader
#import bevy_render::globals
#import bevy_core_pipeline::fullscreen_vertex_shader::FullscreenVertexOutput
#import bevy_render::globals::Globals

@group(0) @binding(0)
var t: texture_2d<f32>;
Expand Down
51 changes: 51 additions & 0 deletions assets/shaders/post_processing.wgsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
// This shader computes the chromatic aberration effect

// Since post processing is a fullscreen effect, we use the fullscreen vertex shader provided by bevy.
// This will import a vertex shader that renders a single fullscreen triangle.
//
// A fullscreen triangle is a single triangle that covers the entire screen.
// The box in the top left in that diagram is the screen. The 4 x are the corner of the screen
//
// Y axis
// 1 | x-----x......
// 0 | | s | . ´
// -1 | x_____x´
// -2 | : .´
// -3 | :´
// +--------------- X axis
// -1 0 1 2 3
//
// As you can see, the triangle ends up bigger than the screen.
//
// You don't need to worry about this too much since bevy will compute the correct UVs for you.
#import bevy_core_pipeline::fullscreen_vertex_shader::FullscreenVertexOutput
#import bevy_render::globals::Globals

@group(0) @binding(0) var screen_texture: texture_2d<f32>;
@group(0) @binding(1) var texture_sampler: sampler;
struct PostProcessSettings {
intensity: f32,
#ifdef SIXTEEN_BYTE_ALIGNMENT
// WebGL2 structs must be 16 byte aligned.
_webgl2_padding: vec3<f32>
#endif
}

@group(0) @binding(2)
var<uniform> globals: Globals;

@group(1) @binding(0) var<uniform> settings: PostProcessSettings;

@fragment
fn fragment(in: FullscreenVertexOutput) -> @location(0) vec4<f32> {
// Chromatic aberration strength
let offset_strength = settings.intensity;

// Sample each color channel with an arbitrary shift
return vec4<f32>(
textureSample(screen_texture, texture_sampler, in.uv + vec2<f32>(offset_strength, -offset_strength)).r,
textureSample(screen_texture, texture_sampler, in.uv + vec2<f32>(-offset_strength, 0.0)).g,
textureSample(screen_texture, texture_sampler, in.uv + vec2<f32>(0.0, offset_strength)).b,
1.0
);
}
4 changes: 2 additions & 2 deletions assets/shaders/raindrops.wgsl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#import bevy_core_pipeline::fullscreen_vertex_shader
#import bevy_render::globals
#import bevy_core_pipeline::fullscreen_vertex_shader::FullscreenVertexOutput
#import bevy_render::globals::Globals

@group(0) @binding(0)
var t: texture_2d<f32>;
Expand Down
6 changes: 3 additions & 3 deletions assets/shaders/wave.wgsl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#import bevy_core_pipeline::fullscreen_vertex_shader
#import bevy_render::globals
#import bevy_pbr::utils
#import bevy_core_pipeline::fullscreen_vertex_shader::FullscreenVertexOutput
#import bevy_render::globals::Globals
#import bevy_render::maths::PI

@group(0) @binding(0)
var source: texture_2d<f32>;
Expand Down
Loading
Loading