diff options
author | Cosmic Linden <cosmic@lindenlab.com> | 2023-02-24 13:53:55 -0800 |
---|---|---|
committer | Cosmic Linden <cosmic@lindenlab.com> | 2023-02-24 13:53:55 -0800 |
commit | 33085b9d830ac1db280d678760b3972798aa1129 (patch) | |
tree | 201019101a92305f22980537b8c5ab4390c9611c /indra/newview/app_settings/shaders/class1/deferred/pbropaqueV.glsl | |
parent | a7ecfc9b1907d6ecd5fe50aeb1c41e38540b2665 (diff) |
SL-19265: Fix precision issue with texture transforms by moving transform matrix calculation into the shader
Diffstat (limited to 'indra/newview/app_settings/shaders/class1/deferred/pbropaqueV.glsl')
-rw-r--r-- | indra/newview/app_settings/shaders/class1/deferred/pbropaqueV.glsl | 52 |
1 files changed, 34 insertions, 18 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/pbropaqueV.glsl b/indra/newview/app_settings/shaders/class1/deferred/pbropaqueV.glsl index f0e3d4f034..6f50aefdab 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/pbropaqueV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/pbropaqueV.glsl @@ -38,10 +38,18 @@ uniform mat4 modelview_projection_matrix; #endif uniform mat4 texture_matrix0; -uniform mat3 texture_basecolor_matrix; -uniform mat3 texture_normal_matrix; -uniform mat3 texture_metallic_roughness_matrix; -uniform mat3 texture_emissive_matrix; +uniform vec2 texture_base_color_scale; +uniform float texture_base_color_rotation; +uniform vec2 texture_base_color_offset; +uniform vec2 texture_normal_scale; +uniform float texture_normal_rotation; +uniform vec2 texture_normal_offset; +uniform vec2 texture_metallic_roughness_scale; +uniform float texture_metallic_roughness_rotation; +uniform vec2 texture_metallic_roughness_offset; +uniform vec2 texture_emissive_scale; +uniform float texture_emissive_rotation; +uniform vec2 texture_emissive_offset; in vec3 position; in vec4 diffuse_color; @@ -49,7 +57,7 @@ in vec3 normal; in vec4 tangent; in vec2 texcoord0; -out vec2 basecolor_texcoord; +out vec2 base_color_texcoord; out vec2 normal_texcoord; out vec2 metallic_roughness_texcoord; out vec2 emissive_texcoord; @@ -60,7 +68,7 @@ out vec3 vary_tangent; flat out float vary_sign; out vec3 vary_normal; -vec2 texture_transform(vec2 vertex_texcoord, mat3 khr_gltf_transform, mat4 sl_animation_transform); +vec2 texture_transform(vec2 vertex_texcoord, vec2 khr_gltf_scale, float khr_gltf_rotation, vec2 khr_gltf_offset, mat4 sl_animation_transform); void main() { @@ -78,10 +86,10 @@ void main() gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0); #endif - basecolor_texcoord = texture_transform(texcoord0, texture_basecolor_matrix, texture_matrix0); - normal_texcoord = texture_transform(texcoord0, texture_normal_matrix, texture_matrix0); - metallic_roughness_texcoord = texture_transform(texcoord0, texture_metallic_roughness_matrix, texture_matrix0); - emissive_texcoord = texture_transform(texcoord0, texture_emissive_matrix, texture_matrix0); + base_color_texcoord = texture_transform(texcoord0, texture_base_color_scale, texture_base_color_rotation, texture_base_color_offset, texture_matrix0); + normal_texcoord = texture_transform(texcoord0, texture_normal_scale, texture_normal_rotation, texture_normal_offset, texture_matrix0); + metallic_roughness_texcoord = texture_transform(texcoord0, texture_metallic_roughness_scale, texture_metallic_roughness_rotation, texture_metallic_roughness_offset, texture_matrix0); + emissive_texcoord = texture_transform(texcoord0, texture_emissive_scale, texture_emissive_rotation, texture_emissive_offset, texture_matrix0); #ifdef HAS_SKIN vec3 n = (mat*vec4(normal.xyz+position.xyz,1.0)).xyz-pos.xyz; @@ -106,29 +114,37 @@ uniform mat4 modelview_projection_matrix; uniform mat4 texture_matrix0; -uniform mat3 texture_basecolor_matrix; -uniform mat3 texture_normal_matrix; -uniform mat3 texture_metallic_roughness_matrix; -uniform mat3 texture_emissive_matrix; +uniform vec2 texture_base_color_scale; +uniform float texture_base_color_rotation; +uniform vec2 texture_base_color_offset; +uniform vec2 texture_normal_scale; +uniform float texture_normal_rotation; +uniform vec2 texture_normal_offset; +uniform vec2 texture_metallic_roughness_scale; +uniform float texture_metallic_roughness_rotation; +uniform vec2 texture_metallic_roughness_offset; +uniform vec2 texture_emissive_scale; +uniform float texture_emissive_rotation; +uniform vec2 texture_emissive_offset; in vec3 position; in vec4 diffuse_color; in vec2 texcoord0; -out vec2 basecolor_texcoord; +out vec2 base_color_texcoord; out vec2 emissive_texcoord; out vec4 vertex_color; -vec2 texture_transform(vec2 vertex_texcoord, mat3 khr_gltf_transform, mat4 sl_animation_transform); +vec2 texture_transform(vec2 vertex_texcoord, vec2 khr_gltf_scale, float khr_gltf_rotation, vec2 khr_gltf_offset, mat4 sl_animation_transform); void main() { //transform vertex gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0); - basecolor_texcoord = texture_transform(texcoord0, texture_basecolor_matrix, texture_matrix0); - emissive_texcoord = texture_transform(texcoord0, texture_emissive_matrix, texture_matrix0); + base_color_texcoord = texture_transform(texcoord0, texture_base_color_scale, texture_base_color_rotation, texture_base_color_offset, texture_matrix0); + emissive_texcoord = texture_transform(texcoord0, texture_emissive_scale, texture_emissive_rotation, texture_emissive_offset, texture_matrix0); vertex_color = diffuse_color; } |