2023-12-18 16:15:08 +01:00
|
|
|
#version 430 core
|
|
|
|
|
|
|
|
float AMBIENT = 0.1;
|
|
|
|
|
|
|
|
uniform vec3 lightPos;
|
2024-01-17 21:13:30 +01:00
|
|
|
uniform vec3 lightColor;
|
2023-12-18 16:15:08 +01:00
|
|
|
|
|
|
|
in vec3 vecNormal;
|
|
|
|
in vec3 worldPos;
|
2024-01-14 19:42:19 +01:00
|
|
|
in vec2 vtc;
|
2024-01-17 21:13:30 +01:00
|
|
|
vec4 textureColor;
|
2023-12-18 16:15:08 +01:00
|
|
|
out vec4 outColor;
|
|
|
|
|
2024-01-17 21:13:30 +01:00
|
|
|
vec3 outputColor;
|
2023-12-18 16:15:08 +01:00
|
|
|
uniform sampler2D colorTexture;
|
|
|
|
|
2024-01-17 21:13:30 +01:00
|
|
|
vec3 toneMapping(vec3 color){
|
|
|
|
float exposure = 0.06;
|
|
|
|
vec3 mapped = 1 - exp(-color*exposure);
|
|
|
|
return mapped;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-12-18 16:15:08 +01:00
|
|
|
void main()
|
|
|
|
{
|
2024-01-14 19:42:19 +01:00
|
|
|
vec3 lightDir = normalize(lightPos - worldPos);
|
2023-12-18 16:15:08 +01:00
|
|
|
vec3 normal = normalize(vecNormal);
|
2024-01-17 21:13:30 +01:00
|
|
|
<<<<<<<< HEAD:grk/cw 6/shaders/shader_sun.frag
|
2024-01-14 23:12:02 +01:00
|
|
|
//float diffuse = max(0, dot(normal, lightDir));
|
2023-12-18 16:15:08 +01:00
|
|
|
|
2024-01-14 19:42:19 +01:00
|
|
|
vec4 textureColor = texture2D(colorTexture, vtc);
|
2024-01-14 23:12:02 +01:00
|
|
|
outColor = vec4(vec3(textureColor) * 1.5, 1.0);
|
2024-01-17 21:13:30 +01:00
|
|
|
========
|
|
|
|
float diffuse = max(0, dot(normal, lightDir));
|
|
|
|
textureColor = texture2D(colorTexture, vtc);
|
|
|
|
vec3 distance = lightColor/(lightPos - worldPos)*(lightPos - worldPos);
|
|
|
|
outputColor = vec3(textureColor) * min(1, AMBIENT + diffuse)* distance;
|
|
|
|
//gamma correction
|
|
|
|
//outputColor = pow(outputColor, vec3(1.0/2.2));
|
|
|
|
|
|
|
|
outputColor = toneMapping(outputColor);
|
|
|
|
outColor = vec4(outputColor , 1.0);
|
|
|
|
>>>>>>>> hdr:grk/cw 6/shaders/shader_5_1_tex.frag
|
2023-12-18 16:15:08 +01:00
|
|
|
}
|