diff --git a/shaders/triangle.frag.spv b/shaders/triangle.frag.spv index b312f52..cc27aae 100644 Binary files a/shaders/triangle.frag.spv and b/shaders/triangle.frag.spv differ diff --git a/shaders/triangle.vert b/shaders/triangle.vert index ee77869..afd9fb8 100644 --- a/shaders/triangle.vert +++ b/shaders/triangle.vert @@ -31,21 +31,23 @@ out gl_PerVertex { }; void main() { - // Vertex position + // Vertex position in camera gl_Position = ubo.projection * ubo.view * push.model * vec4(position, 1.0); + + // Vertex position in world position_wld = vec3(push.model * vec4(position, 1.0)); // Just interpolate UV coords, no transformation needed tex_coords = uv; - // This should probably be in object space? idk + // Normal _direction_ in world (not use atm) normal_wld = vec3(mat3(transpose(inverse(push.model))) * normal); // Tangent->object space matrix vec3 tangent3 = vec3(tangent.xy, 1.0); - vec3 bitangent = -cross(tangent3, normal_wld); + vec3 bitangent = -cross(tangent3, normal); vec3 t = normalize(vec3(push.model * vec4(tangent3, 0.0))); vec3 b = normalize(vec3(push.model * vec4(bitangent, 0.0))); - vec3 n = normalize(vec3(push.model * vec4(normal_wld, 0.0))); + vec3 n = normalize(vec3(push.model * vec4(normal, 0.0))); tbn = mat3(t, b, n); } \ No newline at end of file diff --git a/shaders/triangle.vert.spv b/shaders/triangle.vert.spv index 7b505f0..ef450b9 100644 Binary files a/shaders/triangle.vert.spv and b/shaders/triangle.vert.spv differ