summaryrefslogtreecommitdiff
path: root/client/src/render/shaders/fragment_pbr.wgsl
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/render/shaders/fragment_pbr.wgsl')
-rw-r--r--client/src/render/shaders/fragment_pbr.wgsl7
1 files changed, 4 insertions, 3 deletions
diff --git a/client/src/render/shaders/fragment_pbr.wgsl b/client/src/render/shaders/fragment_pbr.wgsl
index c8fb857..80d3802 100644
--- a/client/src/render/shaders/fragment_pbr.wgsl
+++ b/client/src/render/shaders/fragment_pbr.wgsl
@@ -17,8 +17,9 @@ struct VertexOut {
@builtin(position) clip: vec4<f32>,
@location(0) normal: vec3<f32>,
@location(1) tangent: vec3<f32>,
- @location(2) texcoord: vec2<f32>,
- @location(3) position: vec3<f32>,
+ @location(2) tangent_binormal_sign: f32,
+ @location(3) texcoord: vec2<f32>,
+ @location(4) position: vec3<f32>,
}
struct Material {
@@ -39,7 +40,7 @@ fn main(vo: VertexOut) -> @location(0) vec4<f32> {
let t_albedo = textureSample(tex_albedo, tex_albedo_sampler, vo.texcoord);
let t_normal = textureSample(tex_normal, tex_normal_sampler, vo.texcoord);
- let tangent_basis = mat3x3(vo.tangent, cross(vo.tangent, vo.normal), vo.normal);
+ let tangent_basis = mat3x3(vo.tangent, vo.tangent_binormal_sign * cross(vo.tangent, vo.normal), vo.normal);
let normal = tangent_basis * (t_normal.rgb * 2. - 1.);
let light = vec3(0.64, 0.64, 0.64);