سؤال

How do I actually define the depth of the field, that is, the range of z-values where my objects would be in focus. That is, I want objects with z-coords in [f-w,f+w] to be in focus (camera coords), where f is the focal length and w is some predefined constant.

The way I do it now is I find a primary ray from lens center to P (point on the focal plane, z=-f), then shoot rays from random points L on the lens to P.

What I am seeing is that the implicit value w is very small, so there is a very visible band where things are in focus, and everything near it and further is blurred. Now, I could play with d (distance from lens to image plane) and aperture values to make a specific scene look OK, but I wanted to see some maths on how to solve this issue properly.

I've looked at several ray tracing books and they all skirt this issue.

هل كانت مفيدة؟

المحلول

In case anyone else will look, a 1995 paper by Kolb, Mitchel, Hanrahan - A Realistic Camera Model for Computer Graphics describes a lens model of thickness t and how to control the depth of the field itself.

Link to paper

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top