I'm trying a simple lighting exercise in VEX. I'm trying to make a dome light (a.k.a. skylight) by scattering a bunch of points on a sphere. I use those points to get the vector/angle of each light and use the Lambert Cosine Law to get their lighting contribution. I'm calculating the result on a simple grid (one single primitive).
All my lights (points) are giving an intensity of one so I was expecting the lighting to be super close to 1 but I get 0.504037.
For comparison, when I do the same exercise in Arnold with a white skydome, my grid looks exactly the same color as the background. Why am I off? Am I not understanding the Lambert Cosine Law? I'm confused...
The vex script:
int npts = npoints(1); // number of points on dome float lighting = 0; for(int i=0; i<npts; i++) { vector ptN = point(1, "P", i); float radians = acos(dot(set(0,1,0), ptN)); lighting += cos(radians); } f@lighting = lighting / float(npts);