I'm now trying to implement Depth of Field effect.
And now I've almost finished except for considering PDF.
But I have a question with respect to PDF of DoF.
For example, in path tracing, a pixel color is computed in the following manner.
- choose the position in a pixel(u, v). If it is uniformly distributed, PDF of this procedure is 1.0 (= 1.0 / (1.0 * 1.0)).
- trace a ray through this position and find a next intersection point.
And if it hits a surface, trace a new ray according to some PDF. Then ray's weight is divided by PDF to achieve Monte Carlo.
f_s (x' -> x -> x'') / p_sigma (x -> x'') * cos(N . x -> x'')
- If we explicitly consider the contribution from a light to the current path, choose a point y'' randomly on the area of the light and compute the contribution as follows.
f_s (x' -> x -> y'') * G (x <-> y'') * L (y'' -> x) / p_A (y'')
I tried this by inserting the procedure that choose a lens point between 1 and 2.
And I divide a weight of path by PDF (= 1.0 / (PI * lensRadius^2)), the result seems too dark, since this PDF has large value.
I attached two image, one is the image without DoF, the other is with DoF(is not divided by PDF).
As far as I see these images, doing nothing seems to produce correct result. Why ?