@@ -100,7 +100,7 @@ void axis_angle_to_tbn(vec3 axis, float angle, out vec3 tangent, out vec3 binorm
100100layout (location = 0 ) out vec3 vertex_interp;
101101
102102#ifdef NORMAL_USED
103- layout (location = 1 ) out hvec3 normal_interp;
103+ layout (location = 1 ) out vec3 normal_interp;
104104#endif
105105
106106#if defined(COLOR_USED)
@@ -116,8 +116,8 @@ layout(location = 4) out vec2 uv2_interp;
116116#endif
117117
118118#if defined(TANGENT_USED) || defined(NORMAL_MAP_USED) || defined(BENT_NORMAL_MAP_USED) || defined(LIGHT_ANISOTROPY_USED)
119- layout (location = 5 ) out hvec3 tangent_interp;
120- layout (location = 6 ) out hvec3 binormal_interp;
119+ layout (location = 5 ) out vec3 tangent_interp;
120+ layout (location = 6 ) out vec3 binormal_interp;
121121#endif
122122#if ! defined(MODE_RENDER_DEPTH) && ! defined(MODE_UNSHADED) && defined(USE_VERTEX_LIGHTING)
123123layout (location = 7 ) out hvec4 diffuse_light_interp;
@@ -496,16 +496,18 @@ void vertex_shader(in vec3 vertex,
496496 // Normalize TBN vectors before interpolation, per MikkTSpace.
497497 // See: http://www.mikktspace.com/
498498#ifdef NORMAL_USED
499- normal_interp = hvec3( normalize (normal_highp) );
499+ normal_interp = normalize (normal_highp);
500500#endif
501501
502502#if defined(TANGENT_USED) || defined(NORMAL_MAP_USED) || defined(LIGHT_ANISOTROPY_USED) || defined(BENT_NORMAL_MAP_USED)
503- tangent_interp = hvec3( normalize (tangent_highp) );
504- binormal_interp = hvec3( normalize (binormal_highp) );
503+ tangent_interp = normalize (tangent_highp);
504+ binormal_interp = normalize (binormal_highp);
505505#endif
506506
507507// VERTEX LIGHTING
508508#if ! defined(MODE_RENDER_DEPTH) && ! defined(MODE_UNSHADED) && defined(USE_VERTEX_LIGHTING)
509+ hvec3 normal = hvec3(normal_interp);
510+
509511#ifdef USE_MULTIVIEW
510512 hvec3 view = hvec3(- normalize (vertex_interp - eye_offset));
511513#else
@@ -523,7 +525,7 @@ void vertex_shader(in vec3 vertex,
523525 break ;
524526 }
525527
526- light_process_omni_vertex(light_index, vertex, view, normal_interp , roughness, diffuse_light_interp.rgb, specular_light_interp.rgb);
528+ light_process_omni_vertex(light_index, vertex, view, normal , roughness, diffuse_light_interp.rgb, specular_light_interp.rgb);
527529 }
528530
529531 uint spot_light_count = sc_spot_lights(8 );
@@ -534,7 +536,7 @@ void vertex_shader(in vec3 vertex,
534536 break ;
535537 }
536538
537- light_process_spot_vertex(light_index, vertex, view, normal_interp , roughness, diffuse_light_interp.rgb, specular_light_interp.rgb);
539+ light_process_spot_vertex(light_index, vertex, view, normal , roughness, diffuse_light_interp.rgb, specular_light_interp.rgb);
538540 }
539541
540542 uint directional_lights_count = sc_directional_lights(scene_directional_light_count);
@@ -552,13 +554,13 @@ void vertex_shader(in vec3 vertex,
552554 continue ; // Statically baked light and object uses lightmap, skip.
553555 }
554556 if (i == 0 ) {
555- light_compute_vertex(normal_interp , hvec3(directional_lights.data[0 ].direction), view,
557+ light_compute_vertex(normal , hvec3(directional_lights.data[0 ].direction), view,
556558 hvec3(directional_lights.data[0 ].color * directional_lights.data[0 ].energy),
557559 true, roughness,
558560 directional_diffuse,
559561 directional_specular);
560562 } else {
561- light_compute_vertex(normal_interp , hvec3(directional_lights.data[i].direction), view,
563+ light_compute_vertex(normal , hvec3(directional_lights.data[i].direction), view,
562564 hvec3(directional_lights.data[i].color * directional_lights.data[i].energy),
563565 true, roughness,
564566 diffuse_light_interp.rgb,
@@ -788,7 +790,8 @@ void main() {
788790layout (location = 0 ) in vec3 vertex_interp;
789791
790792#ifdef NORMAL_USED
791- layout (location = 1 ) in hvec3 normal_interp;
793+ // Intentionally kept at full precision to avoid visible corruption on Adreno (See #107364).
794+ layout (location = 1 ) in vec3 normal_interp;
792795#endif
793796
794797#if defined(COLOR_USED)
@@ -804,8 +807,9 @@ layout(location = 4) in vec2 uv2_interp;
804807#endif
805808
806809#if defined(TANGENT_USED) || defined(NORMAL_MAP_USED) || defined(BENT_NORMAL_MAP_USED) || defined(LIGHT_ANISOTROPY_USED)
807- layout (location = 5 ) in hvec3 tangent_interp;
808- layout (location = 6 ) in hvec3 binormal_interp;
810+ // Intentionally kept at full precision to avoid visible corruption on Adreno (See #107364).
811+ layout (location = 5 ) in vec3 tangent_interp;
812+ layout (location = 6 ) in vec3 binormal_interp;
809813#endif
810814
811815#if ! defined(MODE_RENDER_DEPTH) && ! defined(MODE_UNSHADED) && defined(USE_VERTEX_LIGHTING)
@@ -1093,15 +1097,15 @@ void main() {
10931097 float alpha_highp = 1.0 ;
10941098
10951099#if defined(TANGENT_USED) || defined(NORMAL_MAP_USED) || defined(LIGHT_ANISOTROPY_USED) || defined(BENT_NORMAL_MAP_USED)
1096- vec3 binormal_highp = vec3 ( binormal_interp) ;
1097- vec3 tangent_highp = vec3 ( tangent_interp) ;
1100+ vec3 binormal_highp = binormal_interp;
1101+ vec3 tangent_highp = tangent_interp;
10981102#else // TANGENT_USED || NORMAL_MAP_USED || LIGHT_ANISOTROPY_USED || BENT_NORMAL_MAP_USED
10991103 vec3 binormal_highp = vec3 (0.0 );
11001104 vec3 tangent_highp = vec3 (0.0 );
11011105#endif
11021106
11031107#ifdef NORMAL_USED
1104- vec3 normal_highp = vec3 ( normal_interp) ;
1108+ vec3 normal_highp = normal_interp;
11051109#if defined(DO_SIDE_CHECK)
11061110 if (! gl_FrontFacing ) {
11071111 normal_highp = - normal_highp;
0 commit comments