mmp / pbrt-v4

Source code to pbrt, the ray tracer described in the forthcoming 4th edition of the "Physically Based Rendering: From Theory to Implementation" book.
https://pbrt.org
Apache License 2.0
2.89k stars 457 forks source link

BDPT, lensRadius>0, splats, no expected darkening #458

Closed rainbow-app closed 2 weeks ago

rainbow-app commented 2 weeks ago

Hello!

Using v3, but v4 looks affected too.

Setup diagram, view from above. zlens-diagram

Focusing on black wall. (spotlight location not in scale, it's far away to give uniform illumination on white wall)

Image: zlens2

The pixel to the left of the center on the image (=below the black wall on diagram) focuses on empty space, and gets average radiance from the circle of confusion in the background. However, due to the black wall (see blocked red ray), only half of the radiance is to be received in theory. In other words, there must be some darkening of the bright background closer to the black edge at center. The darkening is not there on the image -- problem.

You do check visibility between splat points and randomly-chosen points on the lens, ok.

The problem (as I see) is that there is no flag (for rays) in the theory that distinguishes two cases:

I didn't think how to fix it properly (and probably won't).

BTW, I didn't read dual photography paper, and adjoint chapter in Veach, but this: return Spectrum(1 / (A * lensArea * cos2Theta * cos2Theta)); (in PerspectiveCamera::We), with two areas in denominator, would look frankenshteiny to me in his chapter 10.


convert zlens.pfm -level 0,70% -quality 97 zlens.jpg

Sampler "random" "integer pixelsamples" [40] Integrator "bdpt" "integer maxdepth" [1]

LookAt 0 0 -0.2 0 0 0 0 1 0 Camera "perspective" "float fov" [28] "float lensradius" [0.1] "float focaldistance" [0.2] Film "image" "integer xresolution" [128] "integer yresolution" [128] "string filename" "zlens.pfm"

WorldBegin

Material "matte" "color Kd" [0 0 0] "float sigma" [0]

Shape "trianglemesh" "point P" [0 -1 0 0 1 0 1 1 0 1 -1 0] "integer indices" [ 0 1 2 2 3 0]

Material "matte" "color Kd" [1 1 1] "float sigma" [0] Shape "trianglemesh" "point P" [-0.2 -0.2 0.2 -0.2 0.2 0.2 0.2 0.2 0.2 0.2 -0.2 0.2] "integer indices" [ 0 1 2 2 3 0]

LightSource "spot" "point from" [-1 0 -2] "point to" [0 0 0.2] "float coneangle" [5] "float conedeltaangle" [0] "color I" [10 10 10]

WorldEnd

rainbow-app commented 2 weeks ago

Oops, there shouldn't be darkening. I thought there's a problem in the algorithm. And this test case shows it, but no, it doesn't.

My apologies.