feat: improved shader contrast by clamping min and max values of dot product
This commit is contained in:
parent
a0be00407f
commit
bfa75d1744
|
@ -13,7 +13,7 @@ uniform vec4 ambient;
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
vec4 texelColor = texture(texture0, fragTexCoord);
|
vec4 texelColor = texture(texture0, fragTexCoord);
|
||||||
vec3 light_dot = vec3(pow(dot(fragNormal, lightDirection)-0.2, 3.0));
|
vec3 light_dot = vec3(pow(clamp(dot(fragNormal, lightDirection), 0.0, 1.0), 2.0));
|
||||||
finalColor = texelColor * colDiffuse * vec4(light_dot, 1.0);
|
finalColor = texelColor * colDiffuse * vec4(light_dot, 1.0);
|
||||||
finalColor += texelColor * (ambient/10.0) * colDiffuse;
|
finalColor += texelColor * (ambient/10.0) * colDiffuse;
|
||||||
finalColor = pow(finalColor, vec4(vec3(0.6), 1.0));
|
finalColor = pow(finalColor, vec4(vec3(0.6), 1.0));
|
||||||
|
|
Loading…
Reference in a new issue