From: Mikko Rasa Date: Mon, 8 Nov 2021 13:31:07 +0000 (+0200) Subject: Tweak eye position calculation in shaders X-Git-Url: http://git.tdb.fi/?p=libs%2Fgl.git;a=commitdiff_plain;h=caa1348f9478fcd834a1fdcbafed7cccf6b582e2 Tweak eye position calculation in shaders --- diff --git a/shaderlib/common.glsl b/shaderlib/common.glsl index b83ff380..481d86c4 100644 --- a/shaderlib/common.glsl +++ b/shaderlib/common.glsl @@ -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;