From 0886fb091624b11fe3b7c5fb928058e638e9d993 Mon Sep 17 00:00:00 2001 From: NULL511 Date: Sun, 16 Jun 2024 23:35:13 -0400 Subject: [PATCH] floodfill offset geo-normal check --- shaders/dimensions/all_translucent.fsh | 5 ++++- shaders/dimensions/composite1.fsh | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/shaders/dimensions/all_translucent.fsh b/shaders/dimensions/all_translucent.fsh index 5323c2c..c7ec37f 100644 --- a/shaders/dimensions/all_translucent.fsh +++ b/shaders/dimensions/all_translucent.fsh @@ -722,7 +722,10 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 ) #endif #ifdef IS_LPV_ENABLED - vec3 normalOffset = 0.5*worldSpaceNormal; + vec3 normalOffset = vec3(0.0); + + if (any(greaterThan(abs(worldSpaceNormal), vec3(1.0e-6)))) + normalOffset = 0.5*worldSpaceNormal; #if LPV_NORMAL_STRENGTH > 0 if (any(greaterThan(abs(normal), vec3(1.0e-6)))) { diff --git a/shaders/dimensions/composite1.fsh b/shaders/dimensions/composite1.fsh index e376105..6917bae 100644 --- a/shaders/dimensions/composite1.fsh +++ b/shaders/dimensions/composite1.fsh @@ -1057,7 +1057,10 @@ void main() { #endif #ifdef IS_LPV_ENABLED - vec3 normalOffset = 0.5*viewToWorld(FlatNormals); + vec3 normalOffset = vec3(0.0); + + if (any(greaterThan(abs(FlatNormals), vec3(1.0e-6)))) + normalOffset = 0.5*viewToWorld(FlatNormals); #if LPV_NORMAL_STRENGTH > 0 vec3 texNormalOffset = -normalOffset + slopednormal;