- Trending Categories
- Data Structure
- Operating System
- C Programming
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Z-Buffer or Depth-Buffer method in C++
45 Lectures 4.5 hours
66 Lectures 5.5 hours
The z-buffer also known as depth-buffer is a method that is used for hidden surface detection.
Hidden surface detection
For any picture that has objects and surfaces that are transparent. In this case, objects that are behind other objects are hidden. For proper visual of the image, we need to remove these hidden surfaces is required. The identification is called hidden surface problem.
In z-buffer, we will compare surfaces in the z-axis as depths.
Step 1: initialize the depth of all pixel max. d(i,j) = infinity Step 2: Initialize color for all pixels. c(i,j) = background-color Step 3: for each pixel in polygon projection do, Step 3.1: find z i.e. depth of projection’s (i,j) pixel. Step 3.2: if z < d(i,j) do Step 3.2.1 : d(i,j) = z and c(i,j) = color of polygon.
Using this method pixel by pixel, we will find the depth of each pixel of the plane. The smallest surface determines the color of the buffer. Generally, all z values are close to the range[0,1].
z=0, back clipping plane and z= 1, front clipping plane.
Some important point of a z-buffer
No initial sorting of polygons(planes) is required to apply the z-buffer method.
Z-buffer provides fast results even if the number of planes is large.
Object comparison is not required in the z-buffer method.
Non-polygonal hidden objects can also be detected using this method.
No extra data-structure for storing and resolving is required.
Hardware implementation is possible to speed up the process and is actively used in solve graphic workstations.
The method is applicable only when the objects under consideration are opaque i.e. transparent objects might give an error.
Drawing of the hidden surface might be a time-consuming process.
- A-Buffer Method in C/C++?
- Buffer Type in C#
- Buffer BlockCopy in C#
- Buffer GetByte Example in C#
- Buffer SetByte Example in C#
- Clearing input buffer in C/C++
- What is a buffer attribute in JSP?
- How to use string buffer in android?
- What does buffer flush means in C++ ?
- How to flush the internal buffer in Python?
- How to calculate String Buffer capacity in Java?
- Buffer Overflow Attack: Definition, Types, How to Avoid
- WebGL: Prevent color buffer from being cleared in HTML5