RayTracing / raytracing.github.io

Main Web Site (Online Books)
https://raytracing.github.io/
Creative Commons Zero v1.0 Universal
8.68k stars 852 forks source link

TheRestOfYourLife: Light Scattering, Where did you get that equation? #415

Open iaomw opened 4 years ago

iaomw commented 4 years ago

image Hi, Why does the sin using the same theta as cos? What's the physical meaning? I never seen any sphere area integral like. After alot google search, I didn't find this equation from anywhere.

trevordblack commented 4 years ago

Problems with clarity in Light Scattering are well known, see #277

My understanding of your issue is Why is sin and cos both using the same theta?

The integration is over the half-sphere above the plane.

So theta from 0 to pi/2 And phi from 0 to 2pi

It's not entirely clear what's happening in that paragraph, but the point is to normalize the PDF to 1.

We know that for a lambertian, the PDF should scale with cos(theta). So, we integrate over the half-sphere (scaled with cos(theta)), to determine the are over the surface.

Once we find this (pi). We then scale the PDF by this factor (pi).

The cos(theta) * sin(theta) is because integrating over spherical polar coordinates means

dA = sin(theta) dtheta dpi

So

Integral integral cos(theta) dA

Or

Integral integral cos(theta) sin(theta) dtheta dphi

iaomw commented 4 years ago

I checked the previous scatter function for lambertian. It's pointing to somewhere in the unit sphere over the hit point. That's not the full range of cos(theta). If we change to half-sphere, I can imagine it becoming something proportional to cos(theta), but not convinced. Otherwise, maybe it's still not the full rang of cos(theta) due to total reflection when theta become too large.

If cos(theta) is PDF, then the integral of it is the area of PDF. I was thinking about the area of hemisphere, that's why it's misleading for me. Now, it make sense.

if PDF = const * cos(theta) Area of PDF = const * PI = 1.0 then, const = 1.0/PI

trevordblack commented 3 years ago

The third book has been largely rewritten, and changes reside in branch dev-major. I believe that the confusion here has been resolved in changes made, but I'll refer back to this when we do a final validation pass over book 3 on release (see #863)

dimitry-ishenko commented 4 months ago

Hi, Why does the sin using the same theta as cos? What's the physical meaning? I never seen any sphere area integral like. After alot google search, I didn't find this equation from anywhere.

@iaomw in #1537 you can find a brief explanation where the sine of theta came from.