add ambient lightning
This commit is contained in:
parent
17eefb3324
commit
94a77b45b4
@ -11,6 +11,7 @@ void main()
|
||||
vec2 modifiedTexCoord = vec2(interpTexCoord.x, 1.0 - interpTexCoord.y); // Poprawka dla tekstur Ziemi, ktore bez tego wyswietlaja sie 'do gory nogami'
|
||||
vec3 color = texture2D(textureSampler, modifiedTexCoord).rgb;
|
||||
vec3 normal = normalize(interpNormal);
|
||||
float ambient = 0.2;
|
||||
float diffuse = max(dot(normal, -lightDir), 0.0);
|
||||
gl_FragColor = vec4(color * diffuse, 1.0);
|
||||
gl_FragColor = vec4(color * (ambient + (1-ambient) * diffuse), 1.0);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user