summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCosmic Linden <cosmic@lindenlab.com>2023-10-13 10:42:07 -0700
committerCosmic Linden <cosmic@lindenlab.com>2023-10-13 10:42:07 -0700
commitc48837ef9b7cd016577b2f54f3f6b52764c32e17 (patch)
tree2db2c67015aebae1804d2a58dcd55a31d9bfec77
parent823fcddcb508fac6d1f819633f6a91230f06b114 (diff)
DRTVWR-592: (WIP) (has debug) More rigorous definition of usage vector for triplanar that avoids possible case where 1 = 0.9999, which gets rounded down to 0 on int cast
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/pbrterrainUtilF.glsl10
1 files changed, 5 insertions, 5 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/pbrterrainUtilF.glsl b/indra/newview/app_settings/shaders/class1/deferred/pbrterrainUtilF.glsl
index c5de74604f..1ea1ced45b 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/pbrterrainUtilF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/pbrterrainUtilF.glsl
@@ -97,7 +97,7 @@ struct TerrainWeight
int type;
#if TERRAIN_DEBUG
vec3 weight_signed;
- vec3 usage;
+ ivec3 usage;
#endif
};
@@ -109,10 +109,10 @@ TerrainWeight _t_weight(TerrainCoord terrain_coord)
weight_signed -= vec3(threshold);
TerrainWeight tw;
tw.weight = max(vec3(0), weight_signed);
- vec3 usage = max(vec3(0), sign(weight_signed));
- tw.type = (int(usage.x) * SAMPLE_X) |
- (int(usage.y) * SAMPLE_Y) |
- (int(usage.z) * SAMPLE_Z);
+ ivec3 usage = ivec3(round(max(vec3(0), sign(weight_signed))));
+ tw.type = ((usage.x) * SAMPLE_X) |
+ ((usage.y) * SAMPLE_Y) |
+ ((usage.z) * SAMPLE_Z);
#if TERRAIN_DEBUG
tw.weight_signed = weight_signed;
tw.usage = usage;