Retain cubemap reflection on shiny faces while in shadowed, but don't bloom the sun reflection.

This commit is contained in:
Shyotl
2013-11-13 01:35:31 -06:00
parent 584e5176a4
commit 3ed249cba5
2 changed files with 14 additions and 15 deletions

View File

@@ -400,12 +400,6 @@ void main()
float envIntensity = norm.z;
norm.xyz = decode_normal(norm.xy); // unpack norm
float da = max(dot(norm.xyz, sun_dir.xyz), 0.0);
float light_gamma = 1.0/1.3;
da = pow(da, light_gamma);
vec4 diffuse = texture2DRect(diffuseRect, tc);
//convert to gamma space
@@ -419,6 +413,12 @@ void main()
if (norm.w < 0.5)
{
float da = max(dot(norm.xyz, sun_dir.xyz), 0.0);
float light_gamma = 1.0/1.3;
da = pow(da, light_gamma);
vec2 scol_ambocc = texture2DRect(lightMap, vary_fragcoord.xy).rg;
scol_ambocc = pow(scol_ambocc, vec2(light_gamma));
@@ -466,8 +466,8 @@ void main()
{ //add environmentmap
vec3 env_vec = env_mat * refnormpersp;
vec3 refcol = textureCube(environmentMap, env_vec).rgb*scol_ambocc.r;
bloom = (luminance(refcol) - .45)*.25;
vec3 refcol = textureCube(environmentMap, env_vec).rgb; //Perhaps mix with a cubemap without sun, in the future.
bloom = (luminance(refcol) - .45)*.25*scol_ambocc.r;
col = mix(col.rgb, refcol,
envIntensity);