|
![](/i/fill.gif) |
Fredrik Eriksson <fe79}--at--{yahoo}--dot--{com> wrote:
> On Sat, 13 Feb 2010 20:01:51 +0100, Warp <war### [at] tag povray org> wrote:
> > Fredrik Eriksson <fe79}--at--{yahoo}--dot--{com> wrote:
> >> Typically, the perspective transform is defined such that the resulting
> >> z-coordinates fall in a suitable range (e.g. [0,1]). Clipping can then
> >> be performed without knowledge about the original clipping planes.
> >
> > Ah, now that you mention that, yes, that's probably a very common
> > technique. Rather than carrying around the distances of the clipping
> > planes, what is done is to scale the scene so that the clipping planes
> > are at distances 0 (well, almost) and 1 from the camera. This scaling
> > is then undone by the perspective projection.
> No, the scaling is done *by* the perspective transform.
I don't remember now how the trick was applied, exactly. The idea was,
I think, to transform the scene so that the view frustum (which in the
original untransformed scene is a truncated square pyramid) becomes a
unit cube. Then all the polygons are clipped against this unit cube (which,
as you can guess, is a lot simpler than doing it against a free truncated
pyramid). Then a simple orthogonal projection onto the near-plane (basically
dropping the z coordinate) is enough to get the final perspective projection.
Hence the near and far clipping planes could indeed be "encoded" into the
transformation matrix by specifying the depth scaling (which, I suppose,
would prove my original assertion in this thread wrong).
However, I don't remember if something else was involved for this to
work properly.
--
- Warp
Post a reply to this message
|
![](/i/fill.gif) |