mirror of
https://github.com/ConjureETS/LOG750-LAB2.git
synced 2026-03-23 19:11:20 +00:00
tweaking lights
This commit is contained in:
parent
3d79976c4e
commit
e557a80336
@ -48,7 +48,7 @@ vec4 calcDirLight(vec4 tex, vec3 fPos, vec3 fNorm, mat3 tbn) {
|
||||
// Compute ambient component
|
||||
float amb = 0.2;
|
||||
|
||||
float mult = 2;
|
||||
float mult = 1;
|
||||
|
||||
float luminance = (diff + amb + spec);
|
||||
|
||||
@ -75,7 +75,7 @@ vec4 calcPointLight(vec4 tex, vec3 fPos, vec3 fNorm, mat3 tbn, int i) {
|
||||
|
||||
// Attenuation
|
||||
float distance = length(nviewDirection - pointLight[i] - fPos) / 3;
|
||||
float attenuation = 0.5 + 1 / max(0.25, distance * distance);
|
||||
float attenuation = 1 / max(0.25, distance * distance);
|
||||
|
||||
// Compute diffuse component
|
||||
float diff = .2 * max(0.0, dot(nfNormal, LightDirection));
|
||||
@ -91,6 +91,7 @@ vec4 calcPointLight(vec4 tex, vec3 fPos, vec3 fNorm, mat3 tbn, int i) {
|
||||
|
||||
if(useToon){
|
||||
luminance = floor(luminance * lightLevels) / lightLevels;
|
||||
attenuation = 1;
|
||||
}
|
||||
return vec4(pointLightCol[i].xyz * luminance * attenuation * tex.xyz, pointLightCol[i].w);
|
||||
}
|
||||
@ -150,10 +151,10 @@ main()
|
||||
vec3 nviewDirection = normalize(fPosition);
|
||||
mat3 tbn = cotangent_frame(fNormal, fPosition, texCoords);
|
||||
|
||||
fColor = calcDirLight(texColor, fPosition, fNormal, tbn)
|
||||
+ calcPointLight(texColor, fPosition, fNormal, tbn, 0)/4
|
||||
+ calcPointLight(texColor, fPosition, fNormal, tbn, 1)/4
|
||||
+ calcPointLight(texColor, fPosition, fNormal, tbn, 2)/4;
|
||||
fColor = calcDirLight(texColor, fPosition, fNormal, tbn) * 2
|
||||
+ calcPointLight(texColor, fPosition, fNormal, tbn, 0)
|
||||
+ calcPointLight(texColor, fPosition, fNormal, tbn, 1)
|
||||
+ calcPointLight(texColor, fPosition, fNormal, tbn, 2);
|
||||
} else {
|
||||
fColor = texColor + ifColor;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user