Tig, I checked, but AdamB is right ...
@adamb said:
@tig said:
In code you can ensure a face's normal is towards the camera [get angles between the view direction and the face.normal], if >180 you are looking at the front !
TIG, strictly this is only true for a parallel projection. Its broadly correct for perspective projection, but not for all cases.
The search for the "internal" and "external" of the object, this is the only way to evaluate the order of the vertices of the faces.
Instead, this code seems to be a solution.
It is a raw code ... it investigates only the skin of a compact object, devoid of undercuts ... but I will write the recursive routine. the ray must to come and to go in the solid, each IN must find his OUT in the space, and to end this way in the open space, switching the on - off ... otherwise the beam was started by a face looking at the inside of the object, and the normal of that face watch inside (what I have to correct) ...
PS: at this moment in the code the point is one random of the face vertexes, it would be better to define an interior point on the plane of the face, which is not disturbed by any adjacent faces at 90 degrees that can confuse