# importance sampling rectangular light

I have been struggling very much to wrap my head around this part of Peter Shirley's book. There is no explanation what the angle Alpha represents and to make things worse in the code the cos(Alpha) is calculated is the y component of the direction vector from hit point to a random point on the light source. The whole thing makes no sense and I am struggling to find any resources to help me along.

• It's the factor that pops out when you rewrite the integration over the hemisphere as integration over scene surfaces. See stewart's calculus link here for a proof: math.stackexchange.com/questions/608637/… It can also be shown using differential forms, it's the factor that arises from projecting an arbitrary differential area on the unit sphere (it's the Jacobian of such a map). Apr 15, 2022 at 9:41
• If $Q$ is the point on the light and $P$ is the center of the hemisphere, then alpha is the angle between $P-Q$ and the normal at $Q$ (the normal at the point on the light), as already noted by Nathan Reed. Apr 15, 2022 at 9:59