VOGONS


Example of z-fighting with 16 bit z-buffer

Topic actions

Reply 20 of 22, by Gemini000

User metadata
Rank l33t
Rank
l33t
Scali wrote:

You'll still need to use the zbuffer in case you want to render decals that are partially occluded by closer objects.

Uhh...

Gemini000 wrote:

...since you can just mask out where you need the stencil to go using the current z-buffer state...

...I don't think you read through my response properly...

Scali wrote:

Since the resolution of the zbuffer is not constant, there is no way to ensure that you are 'at least one z-buffer unit closer' in all cases.

Right, which is why I said...

Gemini000 wrote:

...at most visual ranges.

Having decals float above surfaces instead of using the stencil buffer may seem dumb nowadays, but it was common practice for the longest time, even after the stencil buffer became a thing, because it took GPU time and memory to use the stencil buffer which was better spent just guessing where the decal should go so it wouldn't get clipped by the z-buffer, then letting the standard rendering system handle it. :P

--- Kris Asick (Gemini)
--- Pixelmusement Website: www.pixelships.com
--- Ancient DOS Games Webshow: www.pixelships.com/adg

Reply 21 of 22, by Scali

User metadata
Rank l33t
Rank
l33t
Gemini000 wrote:

...since you can just mask out where you need the stencil to go using the current z-buffer state...

Did you think this through though?
Either you need to do multiple passes (eg one per decal/group of decals), in which case the stencilbuffer isn't helping any (you still need to get the z-values right for the stencil at every pass... and why would you do another decal pass anyway? Might as well render the pixel right away, rather than doing stencil first).
Or, you mark all the to-be-pixeled areas in one pass... But then, you're back to the problem that you need to take care of depth-order when applying decals (because what happens when two polys that both need decals are overlapping on screen?).

http://scalibq.wordpress.com/just-keeping-it- … ro-programming/

Reply 22 of 22, by Gemini000

User metadata
Rank l33t
Rank
l33t
Scali wrote:

Did you think this through though?
Either you need to do multiple passes (eg one per decal/group of decals), in which case the stencilbuffer isn't helping any (you still need to get the z-values right for the stencil at every pass... and why would you do another decal pass anyway? Might as well render the pixel right away, rather than doing stencil first).
Or, you mark all the to-be-pixeled areas in one pass... But then, you're back to the problem that you need to take care of depth-order when applying decals (because what happens when two polys that both need decals are overlapping on screen?).

Well, I wasn't trying to get into nitty-gritty details about how to actually render such things, I was just generalizing because yeah, it can get pretty complicated and this is stuff you really only need to worry about when making your own 3D engine.

All I was trying to say at the start was that doing decal rendering with a 16-bit z-buffer can be annoying, since the simpler, easier, less impressive shortcuts to pulling it off without a stencil buffer don't work so well. :P

--- Kris Asick (Gemini)
--- Pixelmusement Website: www.pixelships.com
--- Ancient DOS Games Webshow: www.pixelships.com/adg