From 47853d7a557bf81131512832a9e531cb04d273ca Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Tue, 23 Jun 2020 17:11:54 +0300 Subject: [PATCH] Normalize fragment normal With some shading models even small deviations, such as result from the quantization to 8-bit texel component values, may cause visible artifacts. --- shaderlib/common.glsl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shaderlib/common.glsl b/shaderlib/common.glsl index 05648e4c..4a816360 100644 --- a/shaderlib/common.glsl +++ b/shaderlib/common.glsl @@ -68,7 +68,7 @@ void main() vec3 get_fragment_normal() { if(use_normal_map) - return texture(normal_map, texcoord.xy).xyz*2.0-1.0; + return normalize(texture(normal_map, texcoord.xy).xyz*2.0-1.0); else return vec3(0.0, 0.0, 1.0); } -- 2.45.2