mirror of
https://github.com/bevyengine/bevy
synced 2024-11-23 05:03:47 +00:00
b1aa74d511
# Objective - 2d materials have subtle differences with 3d materials that aren't obvious to beginners ## Solution - Add an example that shows how to make a 2d material
12 lines
568 B
WebGPU Shading Language
12 lines
568 B
WebGPU Shading Language
#import bevy_sprite::mesh2d_vertex_output::VertexOutput
|
|
// we can import items from shader modules in the assets folder with a quoted path
|
|
#import "shaders/custom_material_import.wgsl"::COLOR_MULTIPLIER
|
|
|
|
@group(1) @binding(0) var<uniform> material_color: vec4<f32>;
|
|
@group(1) @binding(1) var base_color_texture: texture_2d<f32>;
|
|
@group(1) @binding(2) var base_color_sampler: sampler;
|
|
|
|
@fragment
|
|
fn fragment(mesh: VertexOutput) -> @location(0) vec4<f32> {
|
|
return material_color * textureSample(base_color_texture, base_color_sampler, mesh.uv) * COLOR_MULTIPLIER;
|
|
}
|