Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

shurcool

stencil buffer - is it worth it?

This topic is 5834 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

i tried using stencil buffer for my 2d top-down shooter game to limit how much you can see, and it worked great. on my system, at least. another person tried it, and it worked fine too. but after the next one tried it, it froze his computer. i am wondering, if the stencil buffer really worth it? is it faster to render a triangle to stencil, or instead render a black triangle where one in stencil was not. so basically instead of marking the zone where to render, cover the zone you dont want to be rendered with black triangles or quads. in my case, i can do both ways, so i'm wondering what should i do. because of stencil being inconsistent on all systems, i don't know what's a better choise. is the stencil buffer a lot faster, if at all? or should i have an option allowing you to choose? is it possible to detect if stencil is a better alternative on a certain system? meanwhile, please try this on your system, and tell me if it works (or crashes/freezes), as well as your video card name. download a newer version in one of my posts below. thanks. --- shurcool my project [edited by - shurcool on June 27, 2002 12:28:40 PM]

Share this post


Link to post
Share on other sites
Advertisement
Works fine for me.

Nice way of doing the player''s line of sight! But the CPU''s too difficult (I think), he kills me before I even see him!

GFX: ATI Rage Xpert 2000 Pro

Share this post


Link to post
Share on other sites
yeah, i made the bot extra tough in this version, because some found him too easy. now he doesn''t shoot aimlessly at walls, instead he waits till you''re in his line of sight, and shoots at you (with high precision) only then. and when (if, very unlikely, since a few bullets kill you very fast) he runs out of ammo, he backs off, until he''s done reloading.

there''s still one exploit, a way to kill him. he will stop whenever he''s really close to you, so if you come close to a corner you know he''ll come out of, he''ll stop, and won''t shoot, since the center of your player is behind a wall. and you, being a smart human and everything, will be able to shoot his "side" or whatever part of him you can see/shoot. a bit more shots are required, but will result in a very safe elimination of the bot.

ps. when finished, this will be a multi-player game, so no bots will be so hard/hacking-thru-walls/dumb/etc.

---
shurcool
my project

Share this post


Link to post
Share on other sites
Scissor testing is perfect for what you are tryng to do, and you can support older cards this way, with Stencil well.., not all cards support it in hardware.

Share this post


Link to post
Share on other sites
nice effect. shame though, you realise how it''s done really quick it doesn''t look anywhere near as convincing (and it doesn''t need stencil buffering at all)..

what would be nice, is after you draw the verticle walls, draw the map again, with reversed depth testing, but make it red. that''d look quite nice, and complete the effect.

Share this post


Link to post
Share on other sites
you totally mis-understood the purpose of what i used stencil buffer for here. but i absolutely undertstand you, because it is an optical illusion and i experienced it as well. it looks like there are vertical walls going up, blocking your view. it really does. however, the whole game is in ortho view, and the purpose of those black "walls going up", making the cross polygon look like some sky scraper, is to block your view, and limit your line of sight only to what you would see if you look from your character's 1st perspetive.

do you see what i'm trying to explain here? so that you wouldn't see through walls, and enemies would only be visible to you if there are no walls between them and you.

now that it causes visual illusions, i don't know what i should do. i want it to be realistic as a 1st person shooter, so you wouldn't see ppl thro walls, and enemies could sneak up to you from behind.

maybe if you knew that, it'd be better (less confuzion)?

so how should i do it? any ideas?

i came up with one possible solution: only clip away enemies behind walls, not the map. what do you think?

---
shurcool
my project

[edited by - shurcool on June 26, 2002 8:58:03 AM]

Share this post


Link to post
Share on other sites
You have to ditch the stencil buffer. A neat effect, but the performance becomes unbearable for the complexity of the game you are doing. I am getting ~0.85 fps.

Pentium II @ 450 MHz
16 MB card with Riva TNT chipset
512 MB RAM

Share this post


Link to post
Share on other sites
5.6fps with softwaregl.
i don^t its too slow or so, i just think people here in don''t know what it requires to run an app with stencil buffer.
i bet you all who have it slow do have 16bit color mode on screen, right?

"take a look around" - limp bizkit
www.google.com

Share this post


Link to post
Share on other sites
quote:
Original post by Bruno
Scissor testing is perfect for what you are tryng to do, and you can support older cards this way, with Stencil well.., not all cards support it in hardware.


actually, i can''t use scissor testing here. and i guess that you''re right about stencil buffer, older card probably don''t support it or something.

please try this newer version, i made some changes to bit depths and hoping it might work better. please try both windowed and full-screen modes. thank you.

download it here.

---
shurcool
my project

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!