diff options
author | cosmic-linden <111533034+cosmic-linden@users.noreply.github.com> | 2023-06-07 15:12:49 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-07 15:12:49 -0700 |
commit | 1ebfc1876ec3383067a2399218037a33601b04d5 (patch) | |
tree | 6ce8ea8496881d06669b97aaefd54fab461701f7 /indra | |
parent | 9bc50d066ce078bc95c44cefe9e02d2b52df3c6d (diff) | |
parent | 3c34ad044cb5cef858d9b0d1708417d4f3dba086 (diff) |
Merge pull request #237 from secondlife/SL-19808
SL-19808: Move tangent_space_transform calculation to the very end
Diffstat (limited to 'indra')
-rw-r--r-- | indra/newview/app_settings/shaders/class1/deferred/pbralphaV.glsl | 11 | ||||
-rw-r--r-- | indra/newview/app_settings/shaders/class1/deferred/pbropaqueV.glsl | 11 |
2 files changed, 12 insertions, 10 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/pbralphaV.glsl b/indra/newview/app_settings/shaders/class1/deferred/pbralphaV.glsl index 81482e2954..6b960fae33 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/pbralphaV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/pbralphaV.glsl @@ -95,18 +95,19 @@ void main() metallic_roughness_texcoord = texture_transform(texcoord0, texture_metallic_roughness_transform, texture_matrix0); emissive_texcoord = texture_transform(texcoord0, texture_emissive_transform, texture_matrix0); - vec3 tex_tangent = tangent_space_transform(tangent, normal.xyz, texture_normal_transform, texture_matrix0); #ifdef HAS_SKIN vec3 n = (mat*vec4(normal.xyz+position.xyz,1.0)).xyz-pos.xyz; - vec3 t = (mat*vec4(tex_tangent.xyz+position.xyz,1.0)).xyz-pos.xyz; + vec3 t = (mat*vec4(tangent.xyz+position.xyz,1.0)).xyz-pos.xyz; #else //HAS_SKIN vec3 n = normal_matrix * normal; - vec3 t = normal_matrix * tex_tangent.xyz; + vec3 t = normal_matrix * tangent.xyz; #endif //HAS_SKIN - vary_tangent = normalize(t); + n = normalize(n); + + vary_tangent = normalize(tangent_space_transform(vec4(t, tangent.w), n, texture_normal_transform, texture_matrix0)); vary_sign = tangent.w; - vary_normal = normalize(n); + vary_normal = n; vertex_color = diffuse_color; diff --git a/indra/newview/app_settings/shaders/class1/deferred/pbropaqueV.glsl b/indra/newview/app_settings/shaders/class1/deferred/pbropaqueV.glsl index 2ad2a015fc..160ae7a215 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/pbropaqueV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/pbropaqueV.glsl @@ -84,18 +84,19 @@ void main() metallic_roughness_texcoord = texture_transform(texcoord0, texture_metallic_roughness_transform, texture_matrix0); emissive_texcoord = texture_transform(texcoord0, texture_emissive_transform, texture_matrix0); - vec3 tex_tangent = tangent_space_transform(tangent, normal.xyz, texture_normal_transform, texture_matrix0); #ifdef HAS_SKIN vec3 n = (mat*vec4(normal.xyz+position.xyz,1.0)).xyz-pos.xyz; - vec3 t = (mat*vec4(tex_tangent.xyz+position.xyz,1.0)).xyz-pos.xyz; + vec3 t = (mat*vec4(tangent.xyz+position.xyz,1.0)).xyz-pos.xyz; #else //HAS_SKIN vec3 n = normal_matrix * normal; - vec3 t = normal_matrix * tex_tangent.xyz; + vec3 t = normal_matrix * tangent.xyz; #endif - vary_tangent = normalize(t); + n = normalize(n); + + vary_tangent = normalize(tangent_space_transform(vec4(t, tangent.w), n, texture_normal_transform, texture_matrix0)); vary_sign = tangent.w; - vary_normal = normalize(n); + vary_normal = n; vertex_color = diffuse_color; } |