From c48837ef9b7cd016577b2f54f3f6b52764c32e17 Mon Sep 17 00:00:00 2001 From: Cosmic Linden Date: Fri, 13 Oct 2023 10:42:07 -0700 Subject: 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 --- .../app_settings/shaders/class1/deferred/pbrterrainUtilF.glsl | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'indra/newview/app_settings/shaders') 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; -- cgit v1.2.3