Fix the bug of shader effect (#1198)

The normal was not calculated correctly

Remove extra parenthesis
This commit is contained in:
Tianle
2025-04-24 10:06:53 -07:00
committed by GitHub
parent 90f309174d
commit 9456158841
3 changed files with 3 additions and 3 deletions

View File

@@ -28,7 +28,7 @@ void fragment() {
ALBEDO = center.rgb;
ALPHA = center.a;
vec3 normal_tex = texture(normal_map, UV).rgb;
normal_tex = -(normal_tex * 2.0 - 1.0);
normal_tex = normal_tex * 2.0 - 1.0;
NORMAL = normalize(TANGENT * normal_tex.x + BINORMAL * normal_tex.y + NORMAL * normal_tex.z);
}
}

View File

@@ -21,7 +21,7 @@ void fragment() {
outline += step(threshold, texture(texture_albedo, uv - vec2(0.0, outline_thickness)).a);
vec3 normal_tex = texture(normal_map, UV).rgb;
normal_tex = -(normal_tex * 2.0 - 1.0);
normal_tex = normal_tex * 2.0 - 1.0;
NORMAL = normalize(TANGENT * normal_tex.x + BINORMAL * normal_tex.y + NORMAL * normal_tex.z);
if (center.a < threshold && outline > 0.0) {

View File

@@ -33,7 +33,7 @@ void fragment() {
ALBEDO = center.rgb;
ALPHA = center.a;
vec3 normal_tex = texture(normal_map, UV).rgb;
normal_tex = -(normal_tex * 2.0 - 1.0);
normal_tex = normal_tex * 2.0 - 1.0;
NORMAL = normalize(TANGENT * normal_tex.x + BINORMAL * normal_tex.y + NORMAL * normal_tex.z);
}
}