Re: Stencil question

New Message Reply Date view Thread view Subject view Author view

Sharon Clay (src++at++rose.asd.sgi.com)
Fri, 30 May 1997 11:21:57 -0700


+>---- On May 30, 10:52am, Joaquin Casillas Melendez wrote:
> Subject: Re: Stencil question
->
->On Thu, 29 May 1997, Nicolas Gauvin wrote:
->
->> On May 29, 6:30pm, Joaquin Casillas Melendez wrote:
->> > Subject: Stencil question
->> > Hi all!
->> > I am trying to draw an objet over a given plane, and I don't want the
->> > object to be drawn outside the limits of the plane. In opengl this can be
->> > achieved by drawing the plane (floor) and at the same time writing a
->> > certain value to the stencil buffer. Then, in the draw routine, the
->> > object will be drawn only over the pixels with that a certain value.
->> >
->> > I don't know the way to do this in Performer, so any help would be
->> > appreciated.
->> >
->>
->> You can use a pfLayer node for this with mode PFDECAL_BASE_STENCIL.
->> The first child of a pfLayer is drawn first and acts as the base.
->> It sets the stencil based on the depth test result. The other children
->> are drawn right after and appears only where the stencil is 1.
->>
->
-> Hello Performers.
-> I have already used a pfLayer whith stencil mode, and the decal children
->is correctly drawn only over the base children, so all works fine.
->However, every time the viewpoint is moved or the window resized, the
->decal node begins drawing incorrectly outside the base geometry. I am
->using perfly code to try this but I don't know if something is overriding
->the stencil value. Any suggestion about what's going wrong?

Except for on iR where stencil clear can be done for free as part
of zclear iff you have one bit of stencil, we don't clear stencil.
We get away with this becuase we assume that you wont model the
layer to spill outside the base. If you clear stencil you'll be
better off but it still won't be perfect because if there
is overlap on the screen the decal of one will be able to write over
the decal of another since we are only using one bit of stencil and
don't have unique group values.
Possibly you can probably improve this a bit more by
using draw callbacks on the layer childeren to set a zfunction
of EQUAL if the layers are modeled to be exactly coplanar with the bases.
Or, you can use more bits of stencil and use draw callbacks on the base
and layer nodes to set your own group values (in which case you want
to not have us be setting stencil so use DISPLACE or else a group to
structure the children). You'll notice though that framebuffer memory
is finite and sometimes more bits of stencil makes you give up
something else. On non-iRs and non-Extremes, we actually try to get your
4 bits of stencil by default so that if reasonable you'll already
have them.

src.

-- 
-----{-----{---++at++   -----{----{---++at++   -----{----{---++at++   -----{----{---++at++
Sharon Rose Clay (Fischler) - Silicon Graphics, Advanced Systems Dev.
src++at++sgi.com  (415) 933 - 1002  FAX: (415) 965 - 2658  MS 8U-590
-----{-----{---++at++   -----{----{---++at++   -----{----{---++at++   -----{----{---++at++
=======================================================================
List Archives, FAQ, FTP:  http://www.sgi.com/Technology/Performer/
            Submissions:  info-performer++at++sgi.com
        Admin. requests:  info-performer-request++at++sgi.com

New Message Reply Date view Thread view Subject view Author view

This archive was generated by hypermail 2.0b2 on Mon Aug 10 1998 - 17:55:19 PDT

This message has been cleansed for anti-spam protection. Replace '++at++' in any mail addresses with the '@' symbol.