Search - User list
Full Version: Lambert Cosine Law in VEX: I get a dark result, why?
Root » Technical Discussion » Lambert Cosine Law in VEX: I get a dark result, why?
olivierth
Hi,

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);
olivierth
...In an other example, when I have an asset with white color, and I sample the white background sphere, the lighting result is greyish. The brightest point is at 0.485:
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Powered by DjangoBB