POV-Ray : Newsgroups : povray.off-topic : scanline predator : Re: scanline predator Server Time
3 Sep 2024 23:27:41 EDT (-0400)
  Re: scanline predator  
From: Warp
Date: 15 Oct 2010 10:09:06
Message: <4cb86082@news.povray.org>
Invisible <voi### [at] devnull> wrote:
> (Besides, I don't _actually_ know what the stencil buffer is. I just 
> assume it does approximately what its name says it does.)

  Basically a stencil buffer is a screen-sized buffer in the graphics card's
memory where you can "accumulate" values. For example, you can tell the
GPU "when you draw this triangle, for each pixel of the triangle increment
the equivalent value in the stencil buffer by one". (It's possible to "draw"
triangles to the stencil buffer only, rather than on screen.)

  Sounds simple, and it is. It's, however, incredible what kind of uses
it can have. For example dynamic shadowing using shadow volumes uses the
stencil buffer (basically, each shadow volume polygon facing the camera
increases the equivalent stencil buffer values, and each shadow volume
polygon facing away from the camera decreases it, and thus from these
values you get the places on screen which are inside the shadow volumes).

-- 
                                                          - Warp


Post a reply to this message

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