]> git.tdb.fi Git - libs/gl.git/commitdiff
Tweak eye position calculation in shaders
authorMikko Rasa <tdb@tdb.fi>
Mon, 8 Nov 2021 13:31:07 +0000 (15:31 +0200)
committerMikko Rasa <tdb@tdb.fi>
Mon, 8 Nov 2021 13:31:07 +0000 (15:31 +0200)
shaderlib/common.glsl

index b83ff3804200fef4acfa270d378cc681c64d280d..481d86c48a604bfe2b1622836a72aaee3a94ffe5 100644 (file)
@@ -47,7 +47,7 @@ void standard_transform()
        vec3 world_binormal = cross(world_normal, world_tangent);
        out mat3 world_tbn_matrix = mat3(world_tangent, world_binormal, world_normal);
 
-       vec3 eye_pos = (inverse(eye_world_matrix)*vec4(0.0, 0.0, 0.0, 1.0)).xyz;
+       vec3 eye_pos = world_eye_matrix[3].xyz;
        out vec3 world_look_dir = normalize(world_vertex.xyz-eye_pos);
 
        out float fog_coord = eye_vertex.z;