merge bloom
This commit is contained in:
parent
65081de1d9
commit
d94b5cd398
@ -10,7 +10,7 @@ uniform float exposure;
|
|||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
const float gamma = 2.6;
|
const float gamma = 1.5;
|
||||||
vec3 hdrColor = texture(scene, TexCoords).rgb;
|
vec3 hdrColor = texture(scene, TexCoords).rgb;
|
||||||
vec3 bloomColor = texture(bloomBlur, TexCoords).rgb;
|
vec3 bloomColor = texture(bloomBlur, TexCoords).rgb;
|
||||||
if(bloom)
|
if(bloom)
|
||||||
|
@ -218,10 +218,10 @@ void main()
|
|||||||
|
|
||||||
|
|
||||||
float brightness = dot(finalColor, vec3(0.2126, 0.7152, 0.0722));
|
float brightness = dot(finalColor, vec3(0.2126, 0.7152, 0.0722));
|
||||||
if(brightness > 1.5)
|
if(brightness > 0.2)
|
||||||
BrightColor = vec4(finalColor, 1.0);
|
BrightColor = vec4(finalColor, 1.0);
|
||||||
else
|
else
|
||||||
BrightColor = vec4(0.5, 0.5, 0.5, 1.0);
|
BrightColor = vec4(0.0, 0.0, 0.0, 1.0);
|
||||||
|
|
||||||
outColor = vec4(finalColor, 1.0);
|
outColor = vec4(finalColor, 1.0);
|
||||||
}
|
}
|
||||||
|
@ -1,14 +1,26 @@
|
|||||||
#version 430 core
|
#version 430 core
|
||||||
|
layout (location = 0) out vec4 outColor;
|
||||||
|
layout (location = 1) out vec4 BrightColor;
|
||||||
|
|
||||||
uniform samplerCube skybox;
|
uniform samplerCube skybox;
|
||||||
uniform vec3 lightColor;
|
uniform vec3 lightColor;
|
||||||
|
|
||||||
in vec3 texCoord;
|
in vec3 texCoord;
|
||||||
|
|
||||||
out vec4 out_color;
|
//out vec4 out_color;
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
vec4 textureColor = texture(skybox, texCoord);
|
vec4 textureColor = texture(skybox, texCoord);
|
||||||
out_color = vec4(vec3(textureColor) * lightColor * 0.35f, 1.0f);
|
|
||||||
|
vec3 finalColor = vec3(textureColor) * lightColor * 0.35f;
|
||||||
|
|
||||||
|
float brightness = dot(finalColor, vec3(0.2126, 0.7152, 0.0722));
|
||||||
|
|
||||||
|
if(brightness > 0.2)
|
||||||
|
BrightColor = vec4(finalColor, 1.0);
|
||||||
|
else
|
||||||
|
BrightColor = vec4(0.0, 0.0, 0.0, 1.0);
|
||||||
|
|
||||||
|
outColor = vec4(finalColor, 1.0);
|
||||||
}
|
}
|
@ -1,4 +1,6 @@
|
|||||||
#version 430 core
|
#version 430 core
|
||||||
|
layout (location = 0) out vec4 outColor;
|
||||||
|
layout (location = 1) out vec4 BrightColor;
|
||||||
|
|
||||||
uniform vec3 lightPos;
|
uniform vec3 lightPos;
|
||||||
uniform vec3 lightColor;
|
uniform vec3 lightColor;
|
||||||
@ -11,7 +13,7 @@ in vec3 vecNormal;
|
|||||||
in vec3 worldPos;
|
in vec3 worldPos;
|
||||||
in vec2 vtc;
|
in vec2 vtc;
|
||||||
|
|
||||||
out vec4 outColor;
|
//out vec4 outColor;
|
||||||
|
|
||||||
uniform sampler2D colorTexture;
|
uniform sampler2D colorTexture;
|
||||||
|
|
||||||
@ -40,6 +42,14 @@ void main()
|
|||||||
vec3 toneMappedColor = toneMapping(textureColor * distance);
|
vec3 toneMappedColor = toneMapping(textureColor * distance);
|
||||||
//gamma correction
|
//gamma correction
|
||||||
toneMappedColor = pow(toneMappedColor, vec3(1.0/2.2));
|
toneMappedColor = pow(toneMappedColor, vec3(1.0/2.2));
|
||||||
|
vec3 finalColor = toneMappedColor * lightColor * 0.2f;
|
||||||
|
|
||||||
|
float brightness = dot(finalColor, vec3(0.2126, 0.7152, 0.0722));
|
||||||
|
|
||||||
|
if(brightness > 0.2)
|
||||||
|
BrightColor = vec4(finalColor, 1.0);
|
||||||
|
else
|
||||||
|
BrightColor = vec4(0.0, 0.0, 0.0, 1.0);
|
||||||
|
|
||||||
outColor = vec4(toneMappedColor * lightColor * 0.2f, 1.0);
|
outColor = vec4(finalColor, 1.0);
|
||||||
}
|
}
|
@ -1,5 +1,8 @@
|
|||||||
#version 430 core
|
#version 430 core
|
||||||
|
|
||||||
|
layout (location = 0) out vec4 outColor;
|
||||||
|
layout (location = 1) out vec4 BrightColor;
|
||||||
|
|
||||||
float AMBIENT = 0.05;
|
float AMBIENT = 0.05;
|
||||||
float PI = 3.14159;
|
float PI = 3.14159;
|
||||||
|
|
||||||
@ -23,7 +26,7 @@ in vec3 vecNormal;
|
|||||||
in vec3 worldPos;
|
in vec3 worldPos;
|
||||||
in vec2 vtc;
|
in vec2 vtc;
|
||||||
|
|
||||||
out vec4 outColor;
|
//out vec4 outColor;
|
||||||
|
|
||||||
vec3 toneMapping(vec3 color)
|
vec3 toneMapping(vec3 color)
|
||||||
{
|
{
|
||||||
@ -123,6 +126,14 @@ void main()
|
|||||||
vec3 noiseColor = noiseColor() * min(1, 20.0 * max(0.02, dot(normal, lightDir))) * lightColor * cloudBrightness;
|
vec3 noiseColor = noiseColor() * min(1, 20.0 * max(0.02, dot(normal, lightDir))) * lightColor * cloudBrightness;
|
||||||
finalColor = mix(toneMappedColor, noiseColor, noiseColor.r);
|
finalColor = mix(toneMappedColor, noiseColor, noiseColor.r);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float brightness = dot(finalColor, vec3(0.2126, 0.7152, 0.0722));
|
||||||
|
|
||||||
|
if(brightness > 0.2)
|
||||||
|
BrightColor = vec4(finalColor, 1.0);
|
||||||
|
else
|
||||||
|
BrightColor = vec4(0.0, 0.0, 0.0, 1.0);
|
||||||
|
|
||||||
|
|
||||||
outColor = vec4(finalColor, 1.0);
|
outColor = vec4(finalColor, 1.0);
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user