From: Mikko Rasa Date: Tue, 23 Jun 2020 14:11:54 +0000 (+0300) Subject: Normalize fragment normal X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=47853d7a557bf81131512832a9e531cb04d273ca;p=libs%2Fgl.git 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. --- 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); }