Merge branch 'master' of git://github.com/Shyotl/SingularityViewer

This commit is contained in:
Lirusaito
2012-12-20 09:25:21 -05:00
13 changed files with 121 additions and 60 deletions

View File

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

View File

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

View File

@@ -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;
}

View File

@@ -29,6 +29,8 @@ out vec4 frag_data[3];
#define frag_data gl_FragData
#endif
uniform float custom_alpha;
VARYING vec4 vertex_color;
VARYING vec2 vary_texcoord0;
@@ -38,7 +40,7 @@ void main()
{
vec4 col = vertex_color * texture2D(diffuseMap, vary_texcoord0.xy);
frag_data[0] = col;
frag_data[0] = vec4(col.rgb,col.a*custom_alpha);
frag_data[1] = vec4(0,0,0,0);
//#define PACK_NORMALS
#ifdef PACK_NORMALS

View File

@@ -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;
}