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

@@ -391,24 +391,23 @@ void main()
float envIntensity = norm.z;
norm.xyz = decode_normal(norm.xy); // unpack norm
float da = dot(norm.xyz, sun_dir.xyz);
float final_da = max(0.0,da);
final_da = min(final_da, 1.0f);
final_da = pow(final_da, 1.0/1.3);
vec4 diffuse = texture2DRect(diffuseRect, tc);
//convert to gamma space
diffuse.rgb = linear_to_srgb(diffuse.rgb);
vec4 spec = texture2DRect(specularRect, vary_fragcoord.xy);
vec3 col;
float bloom = 0.0;
{
vec4 spec = texture2DRect(specularRect, vary_fragcoord.xy);
bloom = spec.r*norm.w;
if (norm.w < 0.5)
{
float da = dot(norm.xyz, sun_dir.xyz);
float final_da = max(0.0,da);
final_da = min(final_da, 1.0f);
final_da = pow(final_da, 1.0/1.3);
calcAtmospherics(pos.xyz, 1.0);
col = atmosAmbient(vec3(0));

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);