[Bf-committers] DOF with skewed z-buffer
ed at halley.cc
Thu May 11 01:00:17 CEST 2006
Reuben Martin wrote:
> What would it take to be able to render a z-buffer image, where the z
> axis for the buffer was not perpendicular to the image plane?
The lens you're talking about is called a "tilt & shift lens." You can
get those for most 35mm camera mounts. The more general case of the
situation you're talking about is called a "technical camera," where the
film plate and the lens are on two independent fixtures, so that you can
adjust perspective and depth of field and other optical attributes. The
two parts are usually cowled with a fabric baffle, the "accordion" that
In a camera, as with our eyes, the film plane catches the wavefront
upside-down, thanks to the rays of light passing through the aperture.
If you modeled the film plane behind the "Camera" object's position, and
fired rays from the film plane through the camera's position (the
aperture), you would get an upside-down image result.
Instead, most computer renderers project rays from an imaginary plane
*ahead* of the camera's location, which coincides with the near clipping
plane. This (1) makes it awkward to model depth of field, unless you
jitter the camera's location by a larger amount, but (2) render the
pixels right-side up.
To be honest, you can get all of the linear perspective effects of a
technical camera through the use of creative projection matrices onto a
projection plane that isn't perpendicular to the camera's direction of
view. (I once wrote a technical camera raytracer.) You don't need
z-buffer tricks here.
In fact, I actually can't think of how the z-buffer would have any
positive benefit in trying to emulate a different projection or an
accurate approximation of depth of field anyway. I'd like to see how, I
honestly might be missing something, but I doubt it would be faster or
more effective than simply using a new projection matrix in the first
[ e d @ h a l l e y . c c ]
More information about the Bf-committers