Stencil performance

Started by
9 comments, last by Petru 21 years, 9 months ago
Hello. I just want to know what is the performance when using stencil buffer. In my case: a GForce 2MX, AGP 4x, DX8.1 when I''m enabling the stencil operations the performance drops dramatically. I''m doing stencil shadows and when I''m near a shadow volume of about 1000 polygons the framerate drops big times. If I disable stencil operations ( increment, decrement...), but I leave the ZBuffer created as 24Bit ZBuffer and 8Bit Stencil, and just draw the shadow volume as regular polygons with colors everything is ok. Is the stencil really slow or just my video card? Thanks, Pet.
Advertisement
What do you mean by "when I leave the ZBuffer at 24 bits and the 8 bit stencil buffer everything ...." What do you change when using the Stencil shadows? usually stenciling shouldn''t be though at all, because you don''t need any texture look ups and so on (at leaste if you disabled it, what you''ve probably done while drawing the shadowvolumes).

My 2 cents,

cya,
Phil

Visit Rarebyte!
and no!, there are NO kangaroos in Austria (I got this questions a few times over in the states )
Visit Rarebyte! and no!, there are NO kangaroos in Austria (I got this question a few times over in the states ;) )
What I mean is that at the app startup I create the ZBuffer as 24Bit Z and 8Bit Stencil.
If I draw normally the shadows... everything look fine but the performance is poor.
If I just disable stancil operations everything works fine... but focourse I have no shadows.
So this is a Stencill fillrate problem...probablly.
What I want to know is if Stencil is not so cheap on every system or GForce MX2 is just old.
Thanks,
Pet.
For shadows you should probably be able to get aways with a 1 bit stencil buffer, that may speed things up a little bit. I don''t think stencil operations should be that much slower than the z-buffer though, you could be doing something else wrong.
quote:Original post by Impossible
For shadows you should probably be able to get aways with a 1 bit stencil buffer, that may speed things up a little bit.


I don''t see how a 1-bit stencil buffer suffices, if you think it can could you please explain further.
1 bit stencil should be enough for shadow volumes (unless I''m badly mistaken for some reason.) You may want to try D15S1 as your format instead of D24S8. I don''t think it will make much of a difference though.
None of my cards supports the D15S1 format, and I do have a few. (Radeon 8500, GeForce4Go, Voodoo5, Voodoo2, Voodoo Banshee)
D24S8 seems to be the more-or-less-standard format for combined stencil and Z buffers. And no, stencil operations shouldn't be too much slower than Z - you might want to check the articles on stencil buffering on nVidia's or ATI's developers' sites. They usually give you very low-level information which is ideal for things like speed issues.

One thing though: how many light sources are you casting shadows from? If there are a few, cut down a bit (1? 2?)


JQ
Full Speed Games. Period.


[edited by - JonnyQuest on July 26, 2002 5:20:33 AM]
~phil
He said something about 1000 polys building up a shadow volume (quite some polys), though, unless they take up a lot of screenspace, it should do fine on a GF2 MX.
ah yes, what do you mean by "the performance drops dramatically" ? Are you sure D3D isn't switching into software mode.. I'm used to OpenGL so I can't tell you how to find that out :|

oh well,
cya,
Phil

Visit Rarebyte!
and no!, there are NO kangaroos in Austria (I got this questions a few times over in the states )


[edited by - phueppl1 on July 26, 2002 5:39:45 AM]
Visit Rarebyte! and no!, there are NO kangaroos in Austria (I got this question a few times over in the states ;) )
Thanks!
Well maybe it''s the drivers and/or video card. As I said, it drops (visible, from 100 to 20) when I''m near the shadow volumes.
It''s just one light and an object about 1000 poly that cast shadows.
Any way, I moved to something else for now. I appreciate your help.
The ideea that shadows volumes & stencil is still something not very cheap on today hardware (well, if GF2MX is ''today'' hardware )

Thanks again,
Pet.
quote:Original post by phueppl1
ah yes, what do you mean by "the performance drops dramatically" ? Are you sure D3D isn''t switching into software mode.. I''m used to OpenGL so I can''t tell you how to find that out :|

There is no so-called software mode in Direct3D. If the hardware doesn''t support it, it doesn''t work, just like in OpenGL. The only thing supported in software are vertex transformation and vertex shaders.
What you''re thinking of are some aspects of DirectDraw that revert to software if the hardware doesn''t support it. (like blitting)

- hillip@xenoage.de''>JQ
Full Speed Games. Period.
~phil

This topic is closed to new replies.

Advertisement