Cheapo sun bloom contribution in deferred.
This commit is contained in:
@@ -60,7 +60,7 @@ void main()
|
||||
|
||||
/// Gamma correct for WL (soft clip effect).
|
||||
frag_data[0] = vec4(scaleSoftClip(color.rgb), 1.0);
|
||||
frag_data[1] = vec4(0.0,0.0,0.0,0.0);
|
||||
frag_data[1] = vec4(vary_HazeColor.a,0.0,0.0,0.0);
|
||||
//#define PACK_NORMALS
|
||||
#ifdef PACK_NORMALS
|
||||
frag_data[2] = vec4(0.5,0.5,0.0,0.0);
|
||||
|
||||
@@ -53,6 +53,13 @@ uniform vec4 glow;
|
||||
|
||||
uniform vec4 cloud_color;
|
||||
|
||||
float luminance(vec3 color)
|
||||
{
|
||||
/// CALCULATING LUMINANCE (Using NTSC lum weights)
|
||||
/// http://en.wikipedia.org/wiki/Luma_%28video%29
|
||||
return dot(color, vec3(0.299, 0.587, 0.114));
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
|
||||
@@ -151,6 +158,7 @@ void main()
|
||||
// At horizon, blend high altitude sky color towards the darker color below the clouds
|
||||
vary_HazeColor += (additiveColorBelowCloud - vary_HazeColor) * (1. - sqrt(temp1));
|
||||
|
||||
vary_HazeColor.a = pow(clamp(luminance(vary_HazeColor.rgb)-.5,0,1),2);
|
||||
// won't compile on mac without this being set
|
||||
//vary_AtmosAttenuation = vec3(0.0,0.0,0.0);
|
||||
}
|
||||
|
||||
@@ -332,10 +332,11 @@ void main()
|
||||
col = atmosLighting(col);
|
||||
col = scaleSoftClip(col);
|
||||
|
||||
col = mix(col.rgb, diffuse.rgb, diffuse.a);
|
||||
col = mix(col, diffuse.rgb, diffuse.a);
|
||||
}
|
||||
else
|
||||
{
|
||||
bloom = spec.r;
|
||||
col = diffuse.rgb;
|
||||
}
|
||||
|
||||
|
||||
@@ -297,14 +297,13 @@ void main()
|
||||
float da = max(dot(norm.xyz, sun_dir.xyz), 0.0);
|
||||
|
||||
vec4 diffuse = texture2DRect(diffuseRect, tc);
|
||||
vec4 spec = texture2DRect(specularRect, vary_fragcoord.xy);
|
||||
|
||||
vec3 col;
|
||||
float bloom = 0.0;
|
||||
|
||||
if (diffuse.a < 0.9)
|
||||
{
|
||||
vec4 spec = texture2DRect(specularRect, vary_fragcoord.xy);
|
||||
|
||||
vec2 scol_ambocc = texture2DRect(lightMap, vary_fragcoord.xy).rg;
|
||||
float scol = max(scol_ambocc.r, diffuse.a);
|
||||
float ambocc = scol_ambocc.g;
|
||||
@@ -344,6 +343,7 @@ void main()
|
||||
}
|
||||
else
|
||||
{
|
||||
bloom = spec.r;
|
||||
col = diffuse.rgb;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user