I have a doubt regarding shape lights pdfs, specifically various sources point at the fact that the pdf is a constant:

$$lightpdf = 1/A$$

Where $$A$$ is the area of the light surface. Expressed in solid angle terms, this becomes: $$lightpdf(\omega) = \frac{r^2}{cos\theta A}$$

or $$= 0$$ for directions on the hemisphere which do not hit the light.

Where $$r^2$$ is the squared distance from the hit point o the light surface and the point we are sampling from, and $$\theta$$ the angle from the light surface normal and our ray direction (source).

What isn't clear to me is knowing that the pdf should satisfy this condition:

$$\int_0^{2\pi} lightpdf(\omega)d\omega = 1$$

Assuming for example a sphere light source (but a cylinder would also do), if in the second formula above we use the entire sphere area as $$A$$, aren't we using a solid angle for the sphere which is double of what it actually should be? (by including the half surface we cannot see from $$p$$:

• It doesn't have to satisfy $\int_{0}^{2\pi}lightpdf(\omega)\,d\omega$. – lightxbulb Apr 12 at 18:55
• @lightxbulb Why not? Using a BRDF shouldn't it be 1 over our support? $2\pi$ – yggdrasil Apr 13 at 2:45
• 1) Your pdf support is not $[0,2\pi]$, it's the area of the light. 2) The solid angle formulation doesn't result in an integral in [0,2\pi]. 3) including the half surface we cannot see from p: - this is taken care of by the visibility function when sampling lights. – lightxbulb Apr 13 at 5:52
• @lightxbulb Hmm I see, thanks for the clarification! However let's assume for a moment we have a weirdly shaped light which covers the entire BRDF hemisphere (and has a back and front face). In that case by randomly sampling its surface our support in solid angle terms should be $4\pi$ and the pdf $r^2/cos\theta A$ (or in area terms $A$ and $1/A$ respectively) However thanks to the visibility function, samples on the back side ($2\pi$) will be 0. Is my understanding correct? – yggdrasil Apr 13 at 6:36
• No, the solid angle support will be still $2\pi$, since angles are considered and not surface points, those are taken care of by the visibility function. Rewrite it in the area formulation to get a better idea. – lightxbulb Apr 13 at 7:45

Shapes almost always sample uniformly by area on their surface. Therefore, we will provide a default implementation of the Shape::Pdf() method corresponding to this sampling approach that returns the corresponding PDF: 1 over the surface area.

So it is not always 1. This is just the most basic way to sample a light. It is simple, fast and provides a good baseline to check other algorithms for correctness. As for:

Assuming for example a sphere light source (but a cylinder would also do), if in the second formula above we use the entire sphere area as $$A$$, aren't we using a solid angle for the sphere which is double of what it actually should be? (by including the half surface we cannot see from $$p$$:

The half you cannot see will simply be excluded by the visibiliy test. Or because it is back facing, if you choose to emit light only on one side of the object. A better sampling algorithm will take that into consideration and adjust the PDF accordingly. Indeed, if you read a little further on that page, you will find:

The second shape sampling method takes the point from which the surface of the shape is being integrated over as a parameter. This method is particularly useful for lighting, since the caller can pass in the point to be lit and allow shape implementations to ensure that they only sample the portion of the shape that is potentially visible from that point.

Which is exactly what you are asking about. But doing this is not about having correct sampling, it's about having efficient sampling. Any sampling method is correct as long as:

1. It can generate samples everywhere they are potentially needed.
2. Its PDF correctly represents the probability of generating each sample.