Path: blob/main/assets/shaders/custom_material_screenspace_texture.wgsl
9413 views
#import bevy_pbr::{
mesh_view_bindings::view,
forward_io::VertexOutput,
utils::coords_to_viewport_uv,
}
@group(#{MATERIAL_BIND_GROUP}) @binding(0) var texture: texture_2d<f32>;
@group(#{MATERIAL_BIND_GROUP}) @binding(1) var texture_sampler: sampler;
@fragment
fn fragment(
mesh: VertexOutput,
) -> @location(0) vec4<f32> {
let viewport_uv = coords_to_viewport_uv(mesh.position.xy, view.viewport);
let color = textureSample(texture, texture_sampler, viewport_uv);
return color;
}