gamma correction

vertex-deduplication
emamaker 2023-03-27 19:19:27 +02:00
parent 44b027c3e2
commit a039ced6cf
2 changed files with 9 additions and 7 deletions

View File

@ -9,9 +9,9 @@ out vec4 FragColor;
vec3 lightColor = vec3(1.0);
vec3 lightDir = -normalize(vec3(0.0, 100.0, 0.0) - vec3(32.0));
float ambientStrength = 0.5;
float diffuseStrength = 0.3;
float specularStrength = 0.2;
float ambientStrength = 0.05;
float diffuseStrength = 0.7;
float specularStrength = 0.25;
uniform vec3 viewPos;
uniform float u_time;
@ -38,5 +38,7 @@ void main()
// Final color
vec3 color = ambient * ambientStrength + diffuse * diffuseStrength + specular * specularStrength;
FragColor = vec4(color, 1.0);
float gamma = 2.2;
FragColor.rgb = pow(color.rgb, vec3(1.0/gamma));
}

View File

@ -312,9 +312,9 @@ void quad(Chunk::Chunk* chunk, glm::vec3 bottomLeft, glm::vec3 topLeft, glm::vec
b = 0.0f;
break;
case Block::DIRT:
r = 0.176f;
g = 0.282f;
b = 0.169f;
r = 0.152f;
g = 0.056f;
b = 0.056f;
break;
default:
r = 0.0f;