bevy/assets/shaders/custom_material_screenspace_texture.wgsl

18 lines
450 B
WebGPU Shading Language
Raw Normal View History

2022-05-31 23:23:25 +00:00
#import bevy_pbr::mesh_view_bindings
#import bevy_pbr::utils
@group(1) @binding(0)
var texture: texture_2d<f32>;
@group(1) @binding(1)
var texture_sampler: sampler;
@fragment
fn fragment(
@builtin(position) position: vec4<f32>,
#import bevy_pbr::mesh_vertex_output
) -> @location(0) vec4<f32> {
let uv = coords_to_viewport_uv(position.xy, view.viewport);
let color = textureSample(texture, texture_sampler, uv);
return color;
}