what is a Z buffer?

yea, what IS a Z buffer?


Comments

  • : yea, what IS a Z buffer?


    Z-buffer makes your life easier, but it is needed only in 3D graphics.


    Imagine that you have two objects, first one - object A - is close to you, second object (B) is far from you. You look them in 3D-space, only part of object B is visible cause it is behind of object A.

    So when you draw these objects on screen, you'll have to count which object is further away from you - in this example it is B - and draw it on srceen and after that you draw the other object - A. Then picture looks fine. If you drawed object A first and object B after that you'll see somewhat odd version of 3D...

    So far z-buffer is'n needed. But if you have many objects you'll have to count wich one to draw first and wich last and every one in the betveen. It takes too much processor-time. That's where z-buffer comes on.

    Z-buffer is an array, wich is just same size as video screen. (If you use mode 320*200 you'll have z-buffer wich is 320*200). There is stored every pixels depth coordinate. Initially all of them should be set to infinity. When you draw a pixel on screen you also record it's z-coordinate (distance from eye) to z-buffer. Or actyally you first check if this coordinate is closer than the previous, then you can draw this pixel. If pixel that you are trying to draw is farther away than the old one you'll have to skip it.

    I'll now get back on the example... If you draw object A first and you are using z-buffer then you can draw object B last, because "z-buffer drawing system (tm)" :D doesn't allow you to draw above object A. And the picture will look pervert...oops I ment perfect.


    I hope that this explained something


    -Sepi




  • : yea, what IS a Z buffer?


    Z-buffer makes your life easier, but it is needed only in 3D graphics.


    Imagine that you have two objects, first one - object A - is close to you, second object (B) is far from you. You look them in 3D-space, only part of object B is visible cause it is behind of object A.

    So when you draw these objects on screen, you'll have to count which object is further away from you - in this example it is B - and draw it on srceen and after that you draw the other object - A. Then picture looks fine. If you drawed object A first and object B after that you'll see somewhat odd version of 3D...

    So far z-buffer is'n needed. But if you have many objects you'll have to count wich one to draw first and wich last and every one in the betveen. It takes too much processor-time. That's where z-buffer comes on.

    Z-buffer is an array, wich is just same size as video screen. (If you use mode 320*200 you'll have z-buffer wich is 320*200). There is stored every pixels depth coordinate. Initially all of them should be set to infinity. When you draw a pixel on screen you also record it's z-coordinate (distance from eye) to z-buffer. Or actyally you first check if this coordinate is closer than the previous, then you can draw this pixel. If pixel that you are trying to draw is farther away than the old one you'll have to skip it.

    I'll now get back on the example... If you draw object A first and you are using z-buffer then you can draw object B last, because "z-buffer drawing system (tm)" :D doesn't allow you to draw above object A. And the picture will look pervert...oops I ment perfect.


    I hope that this explained something.


    -Sepi




  • Like I said...


  • I have similar question. I have one 3D object and I meshed it. The outside boundaries has triangular mesh. I need to find which triangle can be seen from other triangle. Can I use Z buffer algorithm. I am using MATLAB.
    Thanks
    serap
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion