Merge pull request #19973 from JFonS/fix_light_vec_rotation

Fix regression of 2D light height
This commit is contained in:
Max Hilbrunner 2018-07-04 23:39:59 +02:00 committed by GitHub
commit d90efacbc9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 1 deletions

View File

@ -520,7 +520,11 @@ FRAGMENT_SHADER_CODE
#ifdef USE_LIGHTING
vec2 light_vec = (inverse(light_matrix)*vec4(normalize(light_uv_interp.zw),0.0,0.0)).xy; //for normal mapping
mat3 inverse_light_matrix = mat3(inverse(light_matrix));
inverse_light_matrix[0] = normalize(inverse_light_matrix[0]);
inverse_light_matrix[1] = normalize(inverse_light_matrix[1]);
inverse_light_matrix[2] = normalize(inverse_light_matrix[2]);
vec2 light_vec = (inverse_light_matrix * vec3(light_uv_interp.zw,0.0)).xy; //for normal mapping
if (normal_used) {
normal.xy = mat2(local_rot.xy,local_rot.zw) * normal.xy;