Skip to content
Snippets Groups Projects
Unverified Commit 1ebfc187 authored by cosmic-linden's avatar cosmic-linden Committed by GitHub
Browse files

Merge pull request #237 from secondlife/SL-19808

SL-19808: Move tangent_space_transform calculation to the very end
parents 9bc50d06 3c34ad04
No related branches found
No related tags found
2 merge requests!3Update to main branch,!2Rebase onto current main branch
...@@ -95,18 +95,19 @@ void main() ...@@ -95,18 +95,19 @@ void main()
metallic_roughness_texcoord = texture_transform(texcoord0, texture_metallic_roughness_transform, texture_matrix0); metallic_roughness_texcoord = texture_transform(texcoord0, texture_metallic_roughness_transform, texture_matrix0);
emissive_texcoord = texture_transform(texcoord0, texture_emissive_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 #ifdef HAS_SKIN
vec3 n = (mat*vec4(normal.xyz+position.xyz,1.0)).xyz-pos.xyz; 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 #else //HAS_SKIN
vec3 n = normal_matrix * normal; vec3 n = normal_matrix * normal;
vec3 t = normal_matrix * tex_tangent.xyz; vec3 t = normal_matrix * tangent.xyz;
#endif //HAS_SKIN #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_sign = tangent.w;
vary_normal = normalize(n); vary_normal = n;
vertex_color = diffuse_color; vertex_color = diffuse_color;
......
...@@ -84,18 +84,19 @@ void main() ...@@ -84,18 +84,19 @@ void main()
metallic_roughness_texcoord = texture_transform(texcoord0, texture_metallic_roughness_transform, texture_matrix0); metallic_roughness_texcoord = texture_transform(texcoord0, texture_metallic_roughness_transform, texture_matrix0);
emissive_texcoord = texture_transform(texcoord0, texture_emissive_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 #ifdef HAS_SKIN
vec3 n = (mat*vec4(normal.xyz+position.xyz,1.0)).xyz-pos.xyz; 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 #else //HAS_SKIN
vec3 n = normal_matrix * normal; vec3 n = normal_matrix * normal;
vec3 t = normal_matrix * tex_tangent.xyz; vec3 t = normal_matrix * tangent.xyz;
#endif #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_sign = tangent.w;
vary_normal = normalize(n); vary_normal = n;
vertex_color = diffuse_color; vertex_color = diffuse_color;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment