Advertisement

stencil buffer - is it worth it?

Started by June 25, 2002 07:32 PM
42 comments, last by shurcool 22 years, 8 months ago
>>ave a 32 bit z-buffer (depth buffer) w/ 8 bit stencil buffer. in eX0_4, i allocated 0 bits to z-buffer (since i don''t need depth - it''s 2d), and 1 bit to the stencil buffer<<

u cant do that, ie ask for 0 bits z + 1bit stencil, well u can but it wont get it
with a 32bit colour window (with most of todays cards) u will get 24bits depth + 8bits stencil.
the problem sounds like when the display goes fullscreen it changes to a 16bit fullscreen window (try creating your window with sdl)

http://uk.geocities.com/sloppyturds/gotterdammerung.html
ok, this executable is requesting 32 bit color, 24 bits for z-buffer, and 8 bits for stencil (the other fix was 32/32/8). if this doesn''t work, i give up! well, not really...

but anyways, if you try it, please post about it here (what exactly have you tried? did you try both full-screen and windowed modes? did it help - and in which mode? etc.).

get it here (let''s refer to it as the "2nd fix" executable).

thanks a lot!

ps. right now i''m working on eX0 networking (as well as the above dilemma), so expect a mutliplayer test soon!

---
shurcool
my project
Advertisement
Ya! Finally got it running at an acceptable level on my computer (I was the last AP to post... couldn''t post under my username for some reason). I still get <1 FPS in windowed mode (I probably have a 16 bit color desktop), but I get ~30 FPS in fullscreen. That is at least acceptable.

But is there another way to get that effect? I know that nowadays, "everyone" has great video cards and can afford to do some of the more card intensive procedures. But there are still those people (like me) with lackluster chipsets who do not get the best performance. If I can get 20-30 FPS in a 3d game (Return to Castle Wolfenstein), I find it unacceptable to only be getting the same framerate in a 2d game.

Just my thoughts...
Erunama,
you got it working with the latest FIX #2, right? and what video card do you have? please tell me!

and yes, in future, i will have an option whether to have stencil buffer enabled, or not. and i will have many more options to optimize performance. right now it''s just a demo, and i only care about it working (at more than 5 fps) and working properly!

---
shurcool
my project
Yes, FIX #2 did it for me. I have a Diamond Viper v550 video card (16MB card with a Riva TNT chipset), 300 MHz Celeron processor overclocked to 450 MHz, and 512MB of RAM.

What benefits does the stencil buffer offer for this application? Seems like overkill to me.
ok, thanks.

well, the fov zone, which is brighter than the rest of the map, is only possible thanks to the stencil buffer.

---
shurcool
my project
Advertisement
ok, it would be very easy to do without stencil...

heres how:

first, it does need the depth buffer...


ok,

first,
draw the verticle walls and the opposite of the fov, without drawing to the colour buffer (eg, glColorMask(0,0,0,0)), then, with depth testing, draw the map normally (bright)... So the area you can see will be drawn. draw the enimies too.
Then, in a darker colour (similar to what you did, although I think red would look really nice) draw the map again, but reverse the depth test, ie. glDepthFunc(GL_GREATER).
RipTorn, i see what you're saying.
the problem with that is that you would have to draw it two times, unlike what i did with the stencil buffer (first, i render the map dark, then to make it brighter i enabled stencilling and drew a white, transparent quad covering the whole screen). it theory, that should be very fast. prooves not to be in practice, though.

so i guess this will be the alternate option, if stencilling doesn't work out for someone. i still have to fix some things, because there's no way it would work fast in windowed mode, and slow in fullscreen. that's just weird. :-
thanks for the idea!

---
shurcool
my project

[edited by - shurcool on June 28, 2002 9:30:49 AM]
Who has it working fast in windowed mode and slow in fullscreen? They were probably using an older version that was not 32 bit in fullscreen.
i sure hope so!

in the next version, i''ll make it possible to choose whether to use stencil buffer, or not (in that case it will use the depth buffer). therefore, for those whose stencil buffer is hardware supported, it will be a faster choise, but for the rest of you, depth buffer will offer the same features and visual results, at a high framerate.

---
shurcool
my project

This topic is closed to new replies.

Advertisement