diff options
author | Tomasz Kramkowski <tk@the-tk.com> | 2018-10-19 23:34:16 +0300 |
---|---|---|
committer | Tomasz Kramkowski <tk@the-tk.com> | 2018-10-19 23:34:16 +0300 |
commit | 63a4ed57bae7a7ff8c497380cd3353badea15806 (patch) | |
tree | 89a587c9835f91593524b1bb349a81f6a2e078dd | |
parent | 7c1edef3ac501d40e3de495b9434df71f535e9bc (diff) | |
download | faqe-63a4ed57bae7a7ff8c497380cd3353badea15806.tar.gz faqe-63a4ed57bae7a7ff8c497380cd3353badea15806.tar.xz faqe-63a4ed57bae7a7ff8c497380cd3353badea15806.zip |
Fix fragment shader lighting calculation
-rw-r--r-- | shaders/main/frag.glsl | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/shaders/main/frag.glsl b/shaders/main/frag.glsl index c57598c..6d7a53e 100644 --- a/shaders/main/frag.glsl +++ b/shaders/main/frag.glsl @@ -12,11 +12,11 @@ void main() vec3 objco = vec3(texture(tex, fuv)); vec3 lico = vec3(1.0, 1.0, 1.0); - float amb = 0.1; + vec3 amb = vec3(0.1, 0.1, 0.1); vec3 norm = normalize(fnorm); vec3 lidir = normalize(lipos - fpos); - float dif = max(dot(norm, lidir), 0.0); + vec3 dif = max(dot(norm, lidir), 0.0) * objco; float speen = max(sign(dot(lidir, norm)), 0.0); vec3 vwdir = normalize(-fpos); @@ -24,5 +24,5 @@ void main() float spe = pow(max(dot(norm, mid), 0.0), 256) * speen; - color = vec4((amb + dif + spe) * lico * objco, 1.0); + color = vec4((amb + dif + spe) * lico, 1.0); } |