Changing how the intensity is calculated.
This commit is contained in:
parent
7683f4f521
commit
d18cf76cea
@ -40,7 +40,7 @@ void main()
|
|||||||
// only take lights into account with meaningful contribution
|
// only take lights into account with meaningful contribution
|
||||||
if (distance > 0.001f) {
|
if (distance > 0.001f) {
|
||||||
vec3 lightVector = normalize(lightSources[i]-vec3(fragPosition));
|
vec3 lightVector = normalize(lightSources[i]-vec3(fragPosition));
|
||||||
float intensity = (lightIntensities[i])/(distance);
|
float intensity = clamp(pow(2.718,(-(1/lightIntensities[i])*distance)), 0.0, 1.0);
|
||||||
diffuseColor += clamp(dot(normalize(vNormal), lightVector)
|
diffuseColor += clamp(dot(normalize(vNormal), lightVector)
|
||||||
*diffuseFactor*intensity*lightColors[i], 0.0, 1.0);
|
*diffuseFactor*intensity*lightColors[i], 0.0, 1.0);
|
||||||
vec3 cameraVector = normalize(camera - vec3(fragPosition));
|
vec3 cameraVector = normalize(camera - vec3(fragPosition));
|
||||||
|
Loading…
Reference in New Issue
Block a user