added models and stuff
This commit is contained in:
@@ -29,6 +29,7 @@ void main() {
|
||||
vec3 norm = normalize(Normal);
|
||||
vec3 lightDir = normalize(-lightDirection);
|
||||
vec3 viewDir = normalize(viewPosition - Position);
|
||||
vec3 halfwayDir = normalize(lightDir + viewDir);
|
||||
|
||||
vec3 ambient = lightAmbient * (diffuseColor * phongAmbient);
|
||||
|
||||
@@ -37,9 +38,11 @@ void main() {
|
||||
|
||||
vec3 reflectDir = reflect(-lightDir, norm);
|
||||
float effectiveShininess = max(phongShininess, 1.0);
|
||||
float spec = pow(max(dot(viewDir, reflectDir), 0.0), effectiveShininess);
|
||||
float spec = pow(max(dot(norm, halfwayDir), 0.0), effectiveShininess);
|
||||
vec3 specular = lightSpecular * (spec * specularColor * phongSpecular);
|
||||
|
||||
vec3 result = ambient + diffuse + specular;
|
||||
FragColor = vec4(result, 1.0);
|
||||
|
||||
float gamma = 2.2;
|
||||
FragColor.rgb = pow(result.rgb, vec3(1.0/gamma));
|
||||
}
|
||||
Reference in New Issue
Block a user