summaryrefslogtreecommitdiff
path: root/src/renderergl2/glsl
diff options
context:
space:
mode:
authorSmileTheory <SmileTheory@gmail.com>2016-03-15 05:20:25 -0700
committerTim Angus <tim@ngus.net>2016-04-07 11:54:15 +0100
commitb74cc1c42c5bfb2a0a17fc3c083a5a488c159d0d (patch)
treeff9558d5640b86be5040d2efc616aec908a22584 /src/renderergl2/glsl
parentbeefb51f51ab807f89d67f16488240951bb1af68 (diff)
OpenGL2: Fix horribly broken metallic shader.
Diffstat (limited to 'src/renderergl2/glsl')
-rw-r--r--src/renderergl2/glsl/lightall_fp.glsl5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/renderergl2/glsl/lightall_fp.glsl b/src/renderergl2/glsl/lightall_fp.glsl
index f16298a3..64cae3fa 100644
--- a/src/renderergl2/glsl/lightall_fp.glsl
+++ b/src/renderergl2/glsl/lightall_fp.glsl
@@ -333,8 +333,9 @@ void main()
// specular red is gloss
// specular green is metallicness
float gloss = specular.r;
- specular.rgb = specular.g * diffuse.rgb + vec3(0.04 - 0.04 * specular.g);
- diffuse.rgb *= 1.0 - specular.g;
+ float metal = specular.g;
+ specular.rgb = metal * diffuse.rgb + vec3(0.04 - 0.04 * metal);
+ diffuse.rgb *= 1.0 - metal;
#else
// diffuse rgb is diffuse
// specular rgb is specular reflectance at normal incidence