Lambert Cosine Law in VEX: I get a dark result, why?

   552   1   0
User Avatar
Member
1224 posts
Joined: April 2017
Offline
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);

Attachments:
Houdini_Lambert_Cosine_Law_01.jpg (276.0 KB)

User Avatar
Member
1224 posts
Joined: April 2017
Offline
...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:
Edited by olivierth - Oct. 27, 2025 14:35:35

Attachments:
Houdini_Lambert_Cosine_Law_02.jpg (38.1 KB)

  • Quick Links