hello,
does irrlicht use a z-buffer or a w-buffer?
what are their advantages / disadvantages?
as far as i know w-buffers have better resolution in the distance so why don't they get always used instead of a z-buffer?
z-buffer / w-buffer
I haven't seen anything about w-buffers in IrrLicht.
As you've pointed out, a w-buffer ( 1/z ), will have much better resolution in the distance, because 1/z values are essentially linear.....whereas with a z-buffer, you end up with a lot of precision close up and not very much the further away you get.
Why don't people always use w-buffers?
My guess is that with a typical rendering situation, you'll always want more precision close to the viewer where it's really needed, and as you get further away, you can spare to lose some z-precision. And since that's how a z-buffer performs, it's a natural fit.
Here's an article that goes into some detail about how to get z-buffers to be more 'friendly' and avoid or minimize z-fighting problems:
http://www.sjbaker.org/steve/omniv/love ... uffer.html
As you've pointed out, a w-buffer ( 1/z ), will have much better resolution in the distance, because 1/z values are essentially linear.....whereas with a z-buffer, you end up with a lot of precision close up and not very much the further away you get.
Why don't people always use w-buffers?
My guess is that with a typical rendering situation, you'll always want more precision close to the viewer where it's really needed, and as you get further away, you can spare to lose some z-precision. And since that's how a z-buffer performs, it's a natural fit.
Here's an article that goes into some detail about how to get z-buffers to be more 'friendly' and avoid or minimize z-fighting problems:
http://www.sjbaker.org/steve/omniv/love ... uffer.html
"Build a man a fire and he'll be warm for the evening. Set a man on fire and he'll be warm for the rest of his life." -unknown
-
Guest
but from my experience z-buffers have way too much resolution close to the camera. you will never need so much resolution.
how did they avoid z-fighting artifacts in far cry? their levels are huge, their near clipping plane is near, they have lots of overlapping geometry in their levels so how did they avoid z-buffer issues?
with such outdoor levels i wasn't able to reduce massive z-fighting problems (not with irrlicht but with another engine which also uses the standard direct3d z-buffer). the only solution was to move the near clipping plane far away from the camera but this wasn't acceptable either...
how did they avoid z-fighting artifacts in far cry? their levels are huge, their near clipping plane is near, they have lots of overlapping geometry in their levels so how did they avoid z-buffer issues?
with such outdoor levels i wasn't able to reduce massive z-fighting problems (not with irrlicht but with another engine which also uses the standard direct3d z-buffer). the only solution was to move the near clipping plane far away from the camera but this wasn't acceptable either...
Something like a 50/50 blend of a w-buffer and a z-buffer would be perfect, because you are right. z-buffers usually have far too much precision close up .....whereas, a w-buffer usually doesn't have enough close up and too much off in the distance.
Anyway, there's nothing stopping you from modifying IrrLicht to prefer a w-buffer over z-buffer when both are available on a given hardware.
Anyway, there's nothing stopping you from modifying IrrLicht to prefer a w-buffer over z-buffer when both are available on a given hardware.
"Build a man a fire and he'll be warm for the evening. Set a man on fire and he'll be warm for the rest of his life." -unknown
Sorry for reviving this old thread, but...
Does anyone already implemented a w-buffer into irrlicht successfully? I think for space games where you have to look really far, it might be a better solution. Didn't test it myself, but I would like to do.
How could I change irrlicht to use a w-buffer instead of a z-buffer? Do I have to recompile the engine or can I do it using the d3d device from exposedvideodata?
And last but not least:
Niko, do you plan to implement a w-buffer into the engine in the near future? That would be great, because everybody could test their applications with both and decide which fits better in their individual needs.
Ronin
Does anyone already implemented a w-buffer into irrlicht successfully? I think for space games where you have to look really far, it might be a better solution. Didn't test it myself, but I would like to do.
How could I change irrlicht to use a w-buffer instead of a z-buffer? Do I have to recompile the engine or can I do it using the d3d device from exposedvideodata?
And last but not least:
Niko, do you plan to implement a w-buffer into the engine in the near future? That would be great, because everybody could test their applications with both and decide which fits better in their individual needs.
Ronin