1234567891011121314151617181920212223242526272829 |
- #version 430
- layout (binding = 0) uniform sampler2D colorSamp;
- layout (binding = 1) uniform sampler2D ssaoSamp;
- layout (binding = 2) uniform sampler2D shadowSamp;
- layout (binding = 3) uniform sampler2D worldNormalSamp;
- uniform bool ssao;
- uniform bool shadows;
- uniform float bump;
- in vec2 varTex;
- out vec4 color;
- const vec3 light = vec3(-0.280166, -0.573576, -0.769751);
- void main() {
- color = vec4(texture(colorSamp, varTex).xyz, 1.0);
- if(ssao) {
- color = vec4(color.xyz * (texture(ssaoSamp, varTex).r + 0.5), 1.0);
- }
- if(shadows) {
- float f = texture(shadowSamp, varTex).r;
- color *= f * 0.5 + 0.5;
- }
- float diffuseLight = max(dot(texture(worldNormalSamp, varTex).xyz, -light), 0.0) * bump + (1.0 - bump);
- color *= diffuseLight;
- }
|