Add factor and shading to overlay/translucent light shaders

This commit is contained in:
Zach Pomerantz 2016-02-04 17:51:23 -08:00
parent a4cea0a307
commit aa50d1e98e
3 changed files with 9 additions and 6 deletions

View file

@ -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,

View file

@ -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) {

View file

@ -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,