summaryrefslogtreecommitdiff
path: root/client/src/shader.wgsl
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/shader.wgsl')
-rw-r--r--client/src/shader.wgsl13
1 files changed, 10 insertions, 3 deletions
diff --git a/client/src/shader.wgsl b/client/src/shader.wgsl
index d037a94..9cf386c 100644
--- a/client/src/shader.wgsl
+++ b/client/src/shader.wgsl
@@ -31,11 +31,19 @@ struct PushConst {
model_basis: mat3x3<f32>,
}
+struct Material {
+ roughness: f32,
+ metallic: f32,
+ albedo_alpha: vec4<f32>,
+ emission: vec3<f32>,
+}
+
@group(0) @binding(0) var tex_albedo: texture_2d<f32>;
@group(0) @binding(1) var tex_albedo_sampler: sampler;
@group(1) @binding(0) var tex_normal: texture_2d<f32>;
@group(1) @binding(1) var tex_normal_sampler: sampler;
var<push_constant> pc: PushConst;
+@group(2) @binding(0) var<uniform> material: Material;
const LIGHT: vec3<f32> = vec3(0.64, 0.64, 0.64);
@@ -59,11 +67,10 @@ fn fs_main(vo: VertexOut) -> @location(0) vec4<f32> {
let tangent_basis = mat3x3(vo.tangent, cross(vo.tangent, vo.normal), vo.normal);
let normal = tangent_basis * (t_normal.rgb * 2. - 1.);
- let lighting = mix(1., saturate(dot(LIGHT, normal)), 0.9);
-
let alpha = t_albedo.a;
+ let lighting = mix(1., saturate(dot(LIGHT, normal)), 1.);
+
let color = t_albedo.rgb * lighting;
- // let color = normal * 0.5 + 0.5;
if fract(dot(sin(vo.clip * 123.) * 1213., vec4(3., 2., 1., 4.))) > alpha {
discard;