fix: broken light
This commit is contained in:
parent
163c93666b
commit
984db29300
|
@ -82,10 +82,10 @@ public class Lighting {
|
|||
double Id = light.params[3];
|
||||
|
||||
/* diffuse contribution */
|
||||
double I_diff = Id * kd * Math.cos(normal.dot(l));
|
||||
double I_diff = Id * kd * normal.dot(l) / normal.norm() / l.norm();
|
||||
|
||||
/* specular contribution */
|
||||
double I_spec = Id * ks * Math.pow(Math.cos(h.dot(normal)), s);
|
||||
double I_spec = Id * ks * Math.pow(h.dot(normal) / h.norm() / normal.norm(), s);
|
||||
|
||||
I += I_diff + I_spec;
|
||||
} catch (InstantiationException ex) {
|
||||
|
|
Loading…
Reference in a new issue