A little bit of bloom on indirect shiny reflections in deferred.
This commit is contained in:
@@ -278,6 +278,13 @@ vec3 unpack(vec2 tc)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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()
|
void main()
|
||||||
{
|
{
|
||||||
vec2 tc = vary_fragcoord.xy;
|
vec2 tc = vary_fragcoord.xy;
|
||||||
@@ -316,8 +323,10 @@ void main()
|
|||||||
|
|
||||||
//add environmentmap
|
//add environmentmap
|
||||||
vec3 env_vec = env_mat * refnormpersp;
|
vec3 env_vec = env_mat * refnormpersp;
|
||||||
col = mix(col.rgb, textureCube(environmentMap, env_vec).rgb,
|
vec3 env = textureCube(environmentMap, env_vec).rgb;
|
||||||
max(spec.a-diffuse.a*2.0, 0.0));
|
bloom = (luminance(env) - .45)*.25;
|
||||||
|
col = mix(col.rgb, env,
|
||||||
|
max(spec.a-diffuse.a*2.0, 0.0));
|
||||||
}
|
}
|
||||||
|
|
||||||
col = atmosLighting(col);
|
col = atmosLighting(col);
|
||||||
|
|||||||
@@ -79,6 +79,13 @@ vec3 vary_AmblitColor;
|
|||||||
vec3 vary_AdditiveColor;
|
vec3 vary_AdditiveColor;
|
||||||
vec3 vary_AtmosAttenuation;
|
vec3 vary_AtmosAttenuation;
|
||||||
|
|
||||||
|
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));
|
||||||
|
}
|
||||||
|
|
||||||
vec4 getPosition_d(vec2 pos_screen, float depth)
|
vec4 getPosition_d(vec2 pos_screen, float depth)
|
||||||
{
|
{
|
||||||
vec2 sc = pos_screen.xy*2.0;
|
vec2 sc = pos_screen.xy*2.0;
|
||||||
@@ -324,7 +331,9 @@ void main()
|
|||||||
|
|
||||||
//add environmentmap
|
//add environmentmap
|
||||||
vec3 env_vec = env_mat * refnormpersp;
|
vec3 env_vec = env_mat * refnormpersp;
|
||||||
col = mix(col.rgb, textureCube(environmentMap, env_vec).rgb,
|
vec3 env = textureCube(environmentMap, env_vec).rgb;
|
||||||
|
bloom = (luminance(env) - .45)*.25;
|
||||||
|
col = mix(col.rgb, env,
|
||||||
max(spec.a-diffuse.a*2.0, 0.0));
|
max(spec.a-diffuse.a*2.0, 0.0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user