#import bevy_pbr::forward_io::VertexOutput @group(2) @binding(0) var textures: binding_array>; @group(2) @binding(1) var nearest_sampler: sampler; // We can also have array of samplers // var samplers: binding_array; @fragment fn fragment( mesh: VertexOutput, ) -> @location(0) vec4 { // Select the texture to sample from using non-uniform uv coordinates let coords = clamp(vec2(mesh.uv * 4.0), vec2(0u), vec2(3u)); let index = coords.y * 4u + coords.x; let inner_uv = fract(mesh.uv * 4.0); return textureSample(textures[index], nearest_sampler, inner_uv); }