Visible surface detection algorithms | Back-Face Algorithm
There are many techniques that are used to detect various surfaces that will make to the final picture. These techniques either belong to one of the two categories that we have discussed earlier that are: Object-space method or Image-space method. Various algorithms for visible surface detection are:
- Back-Face detection
- Depth/z- buffer method
- Scan line method
- Depth sorting method
- Area-subdivision method
- Octree method
- A-buffer method
- BSP method
- Ray casting method
Back-Face detection:This is the type of Object-space method. In
Back facedetection method we compute the back face of the polygon and never draw this Back face in the picture saving at least 50% of the computation time. In this algorithm we calculate this thing on the basis of dot product. We know that if two things have a dot product between direction vector and position vector of an object greater than zero than the face is inclined toward the camera or our eye. Similarly, if the dot product is less than zero than it is a back face hence is not included in the final picture. For example: If we take an object on the window (real world object) with a position vector
Ai + Bi + CiAnd we are watching the object directly parallel from the Z-axis then, The direction vector is equal to
A(0, 0, Vz). Now if we calculate the dot product of this, it comes out to be.
dot_product = Vz.CAnd if we take unit normal vector then the result is reduced to
dot_product = CNow in the end we only need to have the sign of the variable dot_product, if it turns out to be positive then it is back face and on the other hand if it comes out to be negative then it is front face.
- Partially visible surfaces cannot be computed properly as all the polygons lying over one another will have a positive dot product, but they not be visible finally but still we need to calculate them as the dot product comes out to be positive. In the final result they will be overlapped.
- Not good for advance methods like ray tracing.
- In the next tutorial we are going to discuss the next methods.
Did you enjoy reading or think it can be improved? Don’t forget to leave your thoughts in the comments section below! If you liked this article, please share it with your friends, and read a few more!