From aa50d1e98e97f0a3688825581676df320d130c57 Mon Sep 17 00:00:00 2001 From: Zach Pomerantz Date: Thu, 4 Feb 2016 17:51:23 -0800 Subject: [PATCH] Add factor and shading to overlay/translucent light shaders --- libraries/render-utils/src/model_translucent.slf | 4 ++-- libraries/render-utils/src/overlay3D.slf | 5 +++-- libraries/render-utils/src/overlay3D_translucent.slf | 6 ++++-- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/libraries/render-utils/src/model_translucent.slf b/libraries/render-utils/src/model_translucent.slf index 75a18dec75..c6f745ed0f 100755 --- a/libraries/render-utils/src/model_translucent.slf +++ b/libraries/render-utils/src/model_translucent.slf @@ -35,7 +35,7 @@ vec4 evalGlobalColor(float shadowAttenuation, vec3 position, vec3 normal, vec3 d vec4 shading = evalFragShading(fragNormal, -getLightDirection(light), fragEyeDir, specular, gloss); - color += vec3(opacity * diffuse + shading.rgb) * shading.w * shadowAttenuation * getLightColor(light) * getLightIntensity(light); + color += vec3(diffuse * shading.w * opacity + shading.rgb) * shadowAttenuation * getLightColor(light) * getLightIntensity(light); return vec4(color, opacity); } @@ -58,7 +58,7 @@ void main(void) { vec3 fragNormal = normalize(_normal); vec3 fragDiffuse = getMaterialDiffuse(mat) * diffuse.rgb * _color; vec3 fragSpecular = getMaterialSpecular(mat); - float fragGloss = getMaterialShininess(mat); + float fragGloss = getMaterialShininess(mat) / 128; float fragOpacity = getMaterialOpacity(mat) * diffuse.a * _alpha; _fragColor = evalGlobalColor(1.0, diff --git a/libraries/render-utils/src/overlay3D.slf b/libraries/render-utils/src/overlay3D.slf index 9c37055f55..d859806643 100644 --- a/libraries/render-utils/src/overlay3D.slf +++ b/libraries/render-utils/src/overlay3D.slf @@ -31,7 +31,8 @@ vec4 evalGlobalColor(float shadowAttenuation, vec3 position, vec3 normal, vec3 d vec3 color = opacity * diffuse.rgb * getLightColor(light) * getLightAmbientIntensity(light); vec4 shading = evalFragShading(fragNormal, -getLightDirection(light), fragEyeDir, specular, gloss); - color += vec3(opacity * diffuse + shading.rgb) * shading.w * shadowAttenuation * getLightColor(light) * getLightIntensity(light); + + color += vec3(diffuse * shading.w * opacity + shading.rgb) * shadowAttenuation * getLightColor(light) * getLightIntensity(light); return vec4(color, opacity); } @@ -53,7 +54,7 @@ void main(void) { vec3 fragNormal = normalize(_normal); vec3 fragDiffuse = diffuse.rgb * _color; vec3 fragSpecular = vec3(0.1); - float fragGloss = 10; + float fragGloss = 10.0 / 128.0; float fragOpacity = diffuse.a; if (fragOpacity <= 0.1) { diff --git a/libraries/render-utils/src/overlay3D_translucent.slf b/libraries/render-utils/src/overlay3D_translucent.slf index 96637687c1..9d66b9e57f 100644 --- a/libraries/render-utils/src/overlay3D_translucent.slf +++ b/libraries/render-utils/src/overlay3D_translucent.slf @@ -1,6 +1,7 @@ <@include gpu/Config.slh@> <$VERSION_HEADER$> // Generated on <$_SCRIBE_DATE$> +// // overlay3D_translucent.slf // fragment shader // @@ -31,7 +32,8 @@ vec4 evalGlobalColor(float shadowAttenuation, vec3 position, vec3 normal, vec3 d vec3 color = opacity * diffuse.rgb * getLightColor(light) * getLightAmbientIntensity(light); vec4 shading = evalFragShading(fragNormal, -getLightDirection(light), fragEyeDir, specular, gloss); - color += vec3(opacity * diffuse + shading.rgb) * shading.w * shadowAttenuation * getLightColor(light) * getLightIntensity(light); + + color += vec3(diffuse * shading.w * opacity + shading.rgb) * shadowAttenuation * getLightColor(light) * getLightIntensity(light); return vec4(color, opacity); } @@ -53,7 +55,7 @@ void main(void) { vec3 fragNormal = normalize(_normal); vec3 fragDiffuse = diffuse.rgb * _color; vec3 fragSpecular = vec3(0.1); - float fragGloss = 10; + float fragGloss = 10.0 / 128.0; float fragOpacity = diffuse.a * _alpha; _fragColor = evalGlobalColor(1.0,