POV-Ray : Newsgroups : povray.programming : Depth sort renderer question : Re: Depth sort renderer question Server Time
29 Jul 2024 04:23:52 EDT (-0400)
  Re: Depth sort renderer question  
From: Nieminen Mika
Date: 23 Sep 1998 16:55:32
Message: <36095234.0@news.povray.org>
Diego Krota <Xdk### [at] geocitiescom> wrote:
: I'm developing for my software D-form a depth sort renderer.
: For the first draft I did a raw bubblesort and it worked OK.

: A last question. I confronted the average Z coordinates of each poly to
: determine the nearer. Are there better methods?

  With that method you will get errors, since it's very difficult, if not
impossible (I don't know which one) to sort all polygons perfectly.
Imagine the following case:

     \
      \
    A/ \
    /   \B
         \
          \
           \
            \

     V <- eye

  There are two polygons here, A and B. If you sort them with that average Z
method, you will get that A is behind B, which isn't true.
  What you need is to maintain a Z-buffer. When you draw a polygon, you
store the z value of each pixel in the buffer, unless there is a value
which is smaller.
  This allows also making space cutting of polygons.

-- 
                                                           - Warp. -


Post a reply to this message

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