Implementation
We do not implement exit pupil calculation because it's just an approximation to the real exit pupil. In the real camera, the exil pupil of each pixel is different. We also assume this the sensor is square, which is not true.
For sampling on the lens, we adopt ConcentricSampleDisk provided in pbrt. For calculating the refraction ray, we use Heckber's method, and the ratio of index is precalculated.
Result
The results are shown with the reference ones below. The visible region is smaller because we do not calculate exit pupil. Instead we check if each intersection is inside each lens stop. It is interesting that in most results, our sampling method is more efficient than the reference, and thus the noise is smaller.
Dgauss.50mm

Our result 
Reference 
4 


512 


Fisheye.10mm

Our result 
Reference 
4 


512 


Telephoto.250mm

Our result 
Reference 
4 


512 


Wide.22mm

Our result 
Reference 
4 


512 


Downloads
Source code: realistic.cpp (Put in src/camera)
MS .NET project: realistic.vcproj (Put in src/win32/Projects)
References
 Kolb, C., Mitchell, D., and Hanrahan, P. 1995. A realistic camera model for computer graphics. In Proceedings of the 22nd Annual Conference on Computer Graphics and interactive Techniques S. G. Mair and R. Cook, Eds. SIGGRAPH '95. ACM Press, New York, NY, 317324.
