summaryrefslogtreecommitdiff
path: root/indra/newview/app_settings/shaders/class1/deferred/pbrterrainF.glsl
diff options
context:
space:
mode:
authorCosmic Linden <cosmic@lindenlab.com>2023-10-13 10:38:42 -0700
committerCosmic Linden <cosmic@lindenlab.com>2023-10-13 10:38:42 -0700
commitb9ba57fd0004751dfbcbea90264a6e16c5849e5e (patch)
tree49f3da7af8ecc47ec5c1a3505360a0df13203d1f /indra/newview/app_settings/shaders/class1/deferred/pbrterrainF.glsl
parent57433341abffba9382e6899b164af40200f5d6d3 (diff)
DRTVWR-592: (WIP) Fix terrain PBR texture repeat seam. Legacy terrain texture repeats currently broken
Diffstat (limited to 'indra/newview/app_settings/shaders/class1/deferred/pbrterrainF.glsl')
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/pbrterrainF.glsl25
1 files changed, 22 insertions, 3 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/pbrterrainF.glsl b/indra/newview/app_settings/shaders/class1/deferred/pbrterrainF.glsl
index 73d4d9e3bc..5f94855963 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/pbrterrainF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/pbrterrainF.glsl
@@ -70,6 +70,7 @@ vec2 encode_normal(vec3 n);
vec3 linear_to_srgb(vec3 c);
vec3 srgb_to_linear(vec3 c);
+in vec4 debug_pos; // TODO: Remove
// *TODO: This mixing function feels like it can be optimized. The terrain code's use of texcoord1 is dubious. It feels like the same thing can be accomplished with less memory bandwidth by calculating the offsets on-the-fly
float terrain_mix(vec4 samples, float alpha1, float alpha2, float alphaFinal)
{
@@ -148,9 +149,8 @@ vec3 sample_and_mix_vector3_no_scale(float alpha1, float alpha2, float alphaFina
void main()
{
- // Adjust the texture repeats for a more sensible default.
- float texture_density_factor = 2.0;
- vec2 terrain_texcoord = texture_density_factor * vary_texcoord0.xy;
+ vec2 terrain_texcoord = vary_texcoord0.xy;
+ terrain_texcoord -= vec2(21.0);// TODO: Remove
float alpha1 = texture(alpha_ramp, vary_texcoord0.zw).a;
float alpha2 = texture(alpha_ramp,vary_texcoord1.xy).a;
float alphaFinal = texture(alpha_ramp, vary_texcoord1.zw).a;
@@ -162,6 +162,25 @@ void main()
discard;
}
+ // TODO: Remove all of this
+ float debug_pos_x = debug_pos.x;
+ //float debug_pos_x = terrain_texcoord.y;
+ float debug_metric = debug_pos_x;
+ debug_metric = debug_metric - floor(debug_metric);
+ debug_metric *= debug_metric;
+ float debug_metric2 = debug_pos_x / 4.0;
+ debug_metric2 = debug_metric2 - floor(debug_metric2);
+ debug_metric2 *= debug_metric2;
+ debug_metric2 *= debug_metric2;
+ debug_metric2 *= 16.0;
+ float debug_metric3 = debug_pos_x / 16.0;
+ debug_metric3 = debug_metric3 - floor(debug_metric3);
+ debug_metric3 *= debug_metric3;
+ debug_metric3 *= debug_metric3;
+ debug_metric3 *= debug_metric3;
+ debug_metric3 *= 16.0;
+ //col.xyz = vec3(debug_metric3, debug_metric2, debug_metric);// TODO: Remove
+
vec3 normal_texture = sample_and_mix_vector3_no_scale(alpha1, alpha2, alphaFinal, terrain_texcoord, detail_0_normal, detail_1_normal, detail_2_normal, detail_3_normal);
vec3[4] orm_factors;