I'm writing a ray tracer (actually to learn rust).
During this project I'm learning a lot about optics/physics.
Here is a problem for which I have no nice solution:
Take a plane surface and assume it reflects lambertian ("diffuse", AOI independent).
Question: What is the probability distribution function (psd) of the reflected light? How does it integrate?
Example:
Assume that the surface is the x-y-plane and that light incidences from above.
Then light is reflected by the cosine-law, and hence the scattered intensity is given by cos(theta)*sin(theta) (where the cosine is the lambertian reflectance and the sin is due to spherical coordinates).
So a reflected ray is generate as follows:
phi is uniform distributed between 0 and 2pi.
theta is given by asin(sqrt(a)), where a is a uniform random number between 0 and 1
(integrate to get the cfd (cumulative distribution function), then invert)
If I try to do the same thing for an inclined surface - even for easy examples like with normal (1/sqrt(2),0,1/sqrt(2)) - then I fail at integrating the psd to get the cfd.
The psd is given by the inner product between a sample ray and the surface normal (set to 0 if it's negative - the plane reflects only to one side) - of course multiplied with sin(theta) (to correct for spherical coordinates.
Thanks for your help.