2014-02-12 16:16:10 -05:00
|
|
|
#version 330
|
2014-01-18 19:32:08 -05:00
|
|
|
uniform sampler2D Albedo;
|
|
|
|
uniform sampler2D DiffuseMap;
|
|
|
|
uniform sampler2D SpecularMap;
|
|
|
|
uniform sampler2D SSAO;
|
|
|
|
uniform vec2 screen;
|
|
|
|
uniform vec3 ambient;
|
|
|
|
in vec2 uv;
|
2014-01-19 13:31:00 -05:00
|
|
|
out vec4 FragColor;
|
2014-01-18 19:32:08 -05:00
|
|
|
|
|
|
|
void main(void)
|
|
|
|
{
|
2014-01-19 12:53:35 -05:00
|
|
|
vec4 color = texture(Albedo, uv);
|
2014-01-18 20:13:00 -05:00
|
|
|
if (color.a < 0.5) discard;
|
2014-01-18 19:32:08 -05:00
|
|
|
vec2 tc = gl_FragCoord.xy / screen;
|
2014-01-19 12:53:35 -05:00
|
|
|
vec3 DiffuseComponent = texture(DiffuseMap, tc).xyz;
|
|
|
|
vec3 SpecularComponent = texture(SpecularMap, tc).xyz;
|
|
|
|
float ao = texture(SSAO, tc).x;
|
2014-01-18 20:13:00 -05:00
|
|
|
vec3 LightFactor = ao * ambient + DiffuseComponent + SpecularComponent;
|
2014-01-19 13:31:00 -05:00
|
|
|
FragColor = vec4(color.xyz * LightFactor, 1.);
|
2014-01-18 19:32:08 -05:00
|
|
|
}
|