Jump to content
  • Advertisement
Sign in to follow this  
maxest

Scissor test VS stencil buffer

This topic is 3449 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

At the time I'm trying to optimize my fill-rate. It is quite common to use scissor rectangle to bound lights' shapes. However, wouldn't use of stencil buffer be a better solution? With stencil it is possible to get an accuarte pixel-region for, for example, spot light's frustum. What do you think about that?

Share this post


Link to post
Share on other sites
Advertisement
yes you will be able to do finer rejection testing with the stencilbuffer
but I dont think it will help speed if fillrate is the issue,
since with the stencil buffer u will first need to draw into the buffer the spotlight frustum (burning fillrate)
OTOH the scissor test is essentially free

Share this post


Link to post
Share on other sites
But how much will I "pay" for filling *only* the stencil-buffer? It isn't priceless, but I think it's quite cheap compared to color-buffer. Besides, drawing a light's bound into the stencil and using z-buffer should give some farther optimizations. Consider this situation:
You look at the wall and the light is behind it. If the light is behind that wall you cannot see it lighting the objects behind the wall - and usement of z-buffer will prevent this light's bound to be drawn into the stencil! So the cost of using pixel shader for lighting in this case is actually zero. Am I right? I'm a bit tired and maybe I missed something :)

Share this post


Link to post
Share on other sites
well ... it depends on your hardware platforms. You can implement scissor and stencil buffer tests and see where you end up with. In my tests the scissor test was cheaper for far away lights and the Hi-Stencil / stencil buffer test was faster on closer and bigger lights.
It is quite handy to have both code paths running and being able to switch between them.
I would just go for it and see where you end up with.

Share this post


Link to post
Share on other sites
also perhaps youre unaware of it theres also the ability to reject depending on a fragments depth if its outside a range (similar to the scissortest)
u can uses this coupled with stencil/scissor

in opengl its GL_EXT_depth_bounds_test

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • 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!