POV-Ray : Newsgroups : povray.newusers : Scanline rendering? : Re: Scanline rendering? Server Time
5 Sep 2024 16:22:49 EDT (-0400)
  Re: Scanline rendering?  
From: Warp
Date: 24 Jan 2001 10:24:00
Message: <3a6ef38f@news.povray.org>
Ron Parker <ron### [at] povrayorg> wrote:
: You seem to be using a different definition of "Z-buffering" than is common.
: You need an extra "depth" element for each pixel on the display, not for
: each pixel on each polygon (whatever that means.)

  I didn't express myself correctly.
  What I meant to say is that for each pixel you draw for a polygon, you need
to calculate the depth of that pixel according to the depth of the vertices
of the polygon (in order to use the Z-buffer).

: Also, since the depth 
: information is only used for comparison purposes and not for appearance, I'm
: not convinced by the claim that the polygons appear bent if you don't 
: correct for perspective.

  They appear bent if polygons interset each other or are so close to each
other that one polygon can show through another polygon because that other
polygon is "bent".
  Specially when two polygons intersect each other, the intersection line
is curved if the depths are not perspective correct.

: I'm not even sure how one would go about correcting for perspective

  When you draw one scanline of the polygon the first pixel has a certain
depth as well as the last pixel. When drawing the in-between pixels you need
to calculate their depth as well. If you do it by linearly interpolating
the depths of the border pixels you'll get a non-perspective correct result.
  As said, this results in curved intersection lines and even bad hidden
surface removal (for example if there's a smaller polygon right behind the
current polygon).
  The formula to calculate perspective correct depth is pretty similar to
the one to calculate perspective correct texturing.

: it seems to me that the projection doesn't matter as long
: as you can compute a distance from the 3-space position of the pixel you're 
: rendering

  You are right, "as long as you can compute" them. The question is how do
you compute them. You only have the depth of the vertex points. You have to
somehow calculate the depth of the in-between points from those.
  Linear interpolation is not the answer (for the exact same reason as
linear interpolation of the textures is not the answer).

-- 
char*i="b[7FK@`3NB6>B:b3O6>:B:b3O6><`3:;8:6f733:>::b?7B>:>^B>C73;S1";
main(_,c,m){for(m=32;c=*i++-49;c&m?puts(""):m)for(_=(
c/4)&7;putchar(m),_--?m:(_=(1<<(c&3))-1,(m^=3)&3););}    /*- Warp -*/


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.