Skip to main content
gamedev.net
🔒 Locked

Optimization / masking with stencil buffer

Started by Arcamot Jul 10, 2004 at 5:49 AM 4 replies 1.5k views
Original Post
Arcamot
Arcamot
Hi, In my app, I have a set of cubes to draw. The order of cubes is determined by my algorithm. What is important is this: When a cube has been draw to the screen, this part of the screen should not be overdrawn by other cubes. I'm using a stencil buffer for this now and it works great, however the speed gets down when rendering lots of cubes. I believe that a standard stencil buffer is too sophiosticated for that. What I need is just a fast test whether a cube needs to be drawn to screen or not. Any ideas? Sebastian
Arcamot
Arcamot
that's hard to explain quickly, it's basically a complete different way of rendering I do. It's a voxel engine and uses vertical ray coherence, i.e. there is no z buffer necessary because I render the cubes in the correct order anyway.

Seb-
OrangyTang
OrangyTang
Quote:
Original post by Arcamot
In my app, I have a set of cubes to draw. The order of cubes is determined by my algorithm. What is important is this: When a cube has been draw to the screen, this part of the screen should not be overdrawn by other cubes.

Using a z-buffer might get you an increase in speed, as its more optimised for this kind of usage. You don't actually need proper depth values, just set up the depth buffer to pass on less-only (ie. nearer) and draw everything at the same fixed depth, parallel to the view plane.
_DarkWIng_
_DarkWIng_
Z-buffer would probably be the fastest solution for this becouse it's build for this :). Even if you use it just for this trick. And you even get early-z-out speed-up.

Other idea would be to abuse alpha component of color buffer and some blending. But I think that would be even slower than stencil buffer.

edit: OrangyTang beat me to it :)
You should never let your fears become the boundaries of your dreams.
Drazgal
Drazgal
For the stencil buffer stuff, read nVIDIAs latest GPU guide, I believe they have some stuff on the double fast render to z only methods on newer cards.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.