How to determine which material to use for a picked face?


When using a pick helper on a custom tool, how can I determine if the clicked surface is back or front so I can select material or back_material?

The face’s normal vector points outward from the front side of the face. And the camera’s direction vector points into the view from the camera. So if the picked face’s normal vector points in the same general direction as the camera’s direction (positive dot product), you are looking at the back side of the face. If they point opposite to each other, you are looking at the front side of the face. And, of course, if the dot product is zero (or effectively zero) you are looking at the face edge on.

I recall there being a problem when in perspective view and the face is at or near edge on. I can’t find an example in my code right now, nor a reference in the forum.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.