# Back face detection

Suppose I have one convex polyhedron, I need to detect back face. And $$N=(A, B, C)$$ is normal vector of polygon surface and vector $$V$$ in viewing direction. According to books formula and internet content if $$V. N>0$$ then polygon is back face otherwise front face.

We know that $$V. N=|V|.|N|cos\theta$$ from this when we consider $$\pi/2<\theta<=\pi$$ then $$V. N<0$$ $$\implies$$ front face. And when we consider $$0°<=\theta<=\pi/2$$ then $$V. N>0$$ $$\implies$$ back face.

Case:1 Now suppose in this case for front face where $$V$$ and $$N$$ are parallel to each then they makes angle 0°.Then we get $$V. N>0$$ but according to books formula when $$V. N<0$$ then we will get front face.

:

Case:2 Again I consider the case for back face where $$V$$ along with $$N$$ then they makes angle 180°.Then we get $$V. N<0$$ but according to books formula when $$V. N>0$$ then we will get back face.

My question is where I mistaken to understand the detect the back face and front face for the above cases with formula $$V. N >0 or <0?$$

Now suppose in this case for front face where V and N are parallel to each then they makes angle 0°.

In your example, V and N are pointing in opposite directions. The angle between them is 180 degrees, so the cosine is -1. Similarly:

Again I consider the case for back face where V along with N then they makes angle 180°.

If V and N are pointing in the same direction, then the angle between them is 0 degrees, so the cosine is 1.

You have these backwards; that's why you're getting the wrong value.

• if I consider N for front face with the same direction of V that means if I consider N is opposite side of front face, then V and N has 0° angle, then above formula flipped for front face and back face? Jan 27, 2022 at 20:48
• @Sagorika The formula is sensitive to the way you calculate N from the points of the face. If N = (A,B,C), then also -N = (C,B,A). So when checking each face, you must be careful to order the points correctly and consistently. Jan 27, 2022 at 23:35
• @luser droog if I consider N for front face with the same direction of V that means if I consider N is opposite side of front face, then V and N has 0° angle, then above formula flipped for front face and back face, that means front face formula and angles becomes back face formula and angle and vice versa? Am I correct? Jan 28, 2022 at 6:32
• @Sagorika: Your comment didn't make any more sense the second time you repeated it than the first. N cannot be both the front face and the opposite side of the front face at the same time. So your question is gibberish. Jan 28, 2022 at 7:03
• @Nicol Bolas I am saying instead of N pointing towards me, it pointing opposite side of the front face then front face formula and angle flipped with back face formula and angle? Jan 28, 2022 at 7:22