I was reading Deriving radiance from irradiance and intensity and the last comment said that by dividing $r^2$ we convert radiant intensity to irradiance. What confuses me then is the fact that for point lights in pbrt it seems the SampleLi() function returns the irradiance not the radiance. What am I missing? Is it that in this case the irradiance equals the radiance because from the receiver's point of view all the irradiance is coming from one (delta) direction therefore R=E?
1 Answers
I think, first, you should know what SampleLi() does in the code. In both UDPT and BDPT, SampleLi() is used in next event estimation (sample a point on the light source and evaluate direct illumination). That is to say, the return value of SampleLi() is directly propagated to the illuminated point and we want to estimate the reflected radiance.
According to pbr-book: surface-reflection, we should be evaluating:
$$
\int_{S^2}f(p,\omega_o, \omega_i)\underbrace{L_i(p, \omega_i)|\cos\theta_i|d\omega_i}_{\text{differential irradiance}}
$$
As mentioned by Nathan, point source is infinitesimal and subtends zero solid angle, therefore we can't define the radiance term $L_i$ simply. However, it simple for area sources, since SampleLi() will sample a point (actually, a differential area) via area measure and the differential area sampled will subtend a valid solid angle. Therefore, for the differential irradiance at illuminated point p:
SampleLi()will return radiance (and PDF, important). Radiance will be converted to irradiance through the PDF, which includes geometry term for this conversion (including inverse sqr distance). I am taking the code of pbrt-v3 as an example since I think it is simpler to follow:
// SampleLi for diffuse area emitter: src/lights/diffuse.cpp
Spectrum DiffuseAreaLight::Sample_Li(const Interaction &ref, const Point2f &u,
Vector3f *wi, Float *pdf,
VisibilityTester *vis) const {
ProfilePhase _(Prof::LightSample);
Interaction pShape = shape->Sample(ref, u, pdf);
pShape.mediumInterface = mediumInterface;
if (*pdf == 0 || (pShape.p - ref.p).LengthSquared() == 0) {
*pdf = 0;
return 0.f;
}
*wi = Normalize(pShape.p - ref.p);
*vis = VisibilityTester(ref, pShape);
return L(pShape, -*wi);
}
// the Sampling PDF calculated in SampleLi: src/core/shape.cpp
Interaction Shape::Sample(const Interaction &ref, const Point2f &u,
Float *pdf) const {
Interaction intr = Sample(u, pdf);
Vector3f wi = intr.p - ref.p;
if (wi.LengthSquared() == 0)
*pdf = 0;
else {
wi = Normalize(wi);
// Convert from area measure, as returned by the Sample() call
// above, to solid angle measure.
*pdf *= DistanceSquared(ref.p, intr.p) / AbsDot(intr.n, -wi);
if (std::isinf(*pdf)) *pdf = 0.f;
}
return intr;
}
// How the Sample_Li gets called: src/core/integrator.cpp
...
Spectrum Li = light.Sample_Li(it, uLight, &wi, &lightPdf, &visibility);
...
Ld += f * Li / lightPdf; // Let's ignore MIS for a sec
lightPdf actually accounts for the distance attenuation, just as what Nathan said (quoted here):
with area lights, the distance attenuation comes naturally as a result of the light subtending less solid angle from the receiver's point of view, when the receiver is farther away
- SampleLi() will directly return irradiance for point sources. This is actually the differential irradiance we need to evaluated the local reflection equation (with BRDF).
So in my opinion, the goal of SampleLi(), since it is used in next event estimation, is to somehow get the differential irradiance at p. For point sources, this differential irradiance is deterministic --- it is the irradiance of the point source at 3D position p. While for area sources, we should get this irradiance from the conversion of radiance from a certain differential area. As the goal is actually (differential) irradiance, SampleLi() of point source directly return the irradiance at p.
I drew a figure and hope this would help you understand. Feel free to point out any mistake I made in this post.
- 797
- 2
- 12
-
Hi! Thanks for answering! So when we evaluate the integral you mentioned for Li with monte-carlo follows like this. According to this, $dE = L_i|cos\theta_i| / pdf$ (approximating $L_i|cos\theta_i|d\omega_i$). In case of area light, because of uniform sampling the shape, the pdf = 1.0/area wrt area, but you have to convert it wrt solid angle to get the right quantity for the diff irradiance (dE). So basically in this case the pdf has to have the unit of 1/sr as well. – Balu Mar 21 '24 at 15:12
-
https://www.pbr-book.org/3ed-2018/Light_Transport_I_Surface_Reflection/Sampling_Light_Sources#SamplingShapes – Balu Mar 21 '24 at 15:19
-
Am I right @Enigmatisms? – Balu Mar 25 '24 at 12:36
-
Yes, because in this case you are integrating over the hemisphere. – Enigmatisms Mar 26 '24 at 01:49
-
thanks very much! – Balu Mar 26 '24 at 12:29
