Skip to content
Snippets Groups Projects
Commit c7479098 authored by David Parks's avatar David Parks
Browse files

NORSPEC-261 Better blending of environment map.

parent e88910e9
No related branches found
No related tags found
No related merge requests found
...@@ -327,6 +327,7 @@ void main() ...@@ -327,6 +327,7 @@ void main()
float da = max(dot(norm.xyz, sun_dir.xyz), 0.0); float da = max(dot(norm.xyz, sun_dir.xyz), 0.0);
vec4 diffuse = texture2DRect(diffuseRect, tc); vec4 diffuse = texture2DRect(diffuseRect, tc);
vec4 spec = texture2DRect(specularRect, vary_fragcoord.xy); vec4 spec = texture2DRect(specularRect, vary_fragcoord.xy);
vec3 col; vec3 col;
float bloom = 0.0; float bloom = 0.0;
...@@ -339,9 +340,9 @@ void main() ...@@ -339,9 +340,9 @@ void main()
ambient *= ambient; ambient *= ambient;
ambient = (1.0-ambient); ambient = (1.0-ambient);
col.rgb *= ambient; //col.rgb *= ambient;
col += atmosAffectDirectionalLight(max(min(da, 1.0) * 2.6, 0.0)); col += atmosAffectDirectionalLight(max(min(da, 1.0) * 2.8, 0.0));
col *= diffuse.rgb; col *= diffuse.rgb;
...@@ -362,24 +363,21 @@ void main() ...@@ -362,24 +363,21 @@ void main()
} }
col = mix(col.rgb, pow(diffuse.rgb, vec3(1.0/2.2)), diffuse.a); col = mix(col.rgb, diffuse.rgb, diffuse.a);
if (envIntensity > 0.0) if (envIntensity > 0.0)
{ //add environmentmap { //add environmentmap
vec3 env_vec = env_mat * refnormpersp; vec3 env_vec = env_mat * refnormpersp;
float exponent = mix(2.2, 1.0, diffuse.a);
vec3 refcol = pow(textureCube(environmentMap, env_vec).rgb, vec3(exponent))*exponent;
col = mix(col.rgb, refcol, vec3 refcol = textureCube(environmentMap, env_vec).rgb;
col = mix(pow(col.rgb, vec3(1.0/2.2)), refcol,
envIntensity); envIntensity);
col = pow(col, vec3(2.2));
} }
float exponent = mix(1.0, 2.2, diffuse.a);
col = pow(col, vec3(exponent));
if (norm.w < 0.5) if (norm.w < 0.5)
{ {
col = mix(atmosLighting(col), fullbrightAtmosTransport(col), diffuse.a); col = mix(atmosLighting(col), fullbrightAtmosTransport(col), diffuse.a);
......
...@@ -374,23 +374,21 @@ void main() ...@@ -374,23 +374,21 @@ void main()
} }
col = mix(col.rgb, pow(diffuse.rgb, vec3(1.0/2.2)), diffuse.a); col = mix(col.rgb, diffuse.rgb, diffuse.a);
if (envIntensity > 0.0) if (envIntensity > 0.0)
{ //add environmentmap { //add environmentmap
vec3 env_vec = env_mat * refnormpersp; vec3 env_vec = env_mat * refnormpersp;
float exponent = mix(2.2, 1.0, diffuse.a);
vec3 refcol = pow(textureCube(environmentMap, env_vec).rgb, vec3(exponent))*exponent;
col = mix(col.rgb, refcol, vec3 refcol = textureCube(environmentMap, env_vec).rgb;
col = mix(pow(col.rgb, vec3(1.0/2.2)), refcol,
envIntensity); envIntensity);
} col = pow(col, vec3(2.2));
float exponent = mix(1.0, 2.2, diffuse.a); }
col = pow(col, vec3(exponent));
if (norm.w < 0.5) if (norm.w < 0.5)
{ {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment