TEST #2: Surface S is completely behind the overlapping surface relative to the viewing position.
How to check these conditions?
i) Set the plane equation of S2(Ax + By + Cz + D = 0), such that the surface S2 is towards the viewing position.
ii) Substitute the coordinates of all vertices of Substitute the coordinates of all vertices of S1(x', y',z') into the plane equation of S2 and check for the sign.
iii) If all vertices of S1 are inside S2 then S1 is behind S2. (Fig. 1).
i. e. Ax' + By' + Cz' + D < 0 ,x', y', z' are S1 vertices.
iv) If all vertices of S1 are outside S2 then S1 in front of S2.
My first question is why all vertices of one polygon(S1) substitute in the plane of another(S2) and value is less than 0 then we say S1 is behind S2? I don't understand when value less than 0 by the vertices of one polygon then we say one is behind another?
My second question is when Test #2 is passed (i.e. S1 is completely behind/inside the overlapping surface S2) why we coloring S1 first before S2. There is no necessitates to S1 because S1 is totally obscured by S2. So why we colored S2?