How to know if a triangle is facing the camera?

Blitz3D Forums/Blitz3D Programming/How to know if a triangle is facing the camera?

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

This should work ..

;get cameras direction normal
Tformnormal 0,0,1,Camera, 0
CamNx# = tformedx()
CamNy# = tformedy()
CamNz# = tformedz()

;compute dot product of camera normal and tri normal
CdotN# = CamNx*TriNx + CamNY * TriNy + CamNz * TriNz
If CdotN < 0 then
  {This tri is facing the camera}
Endif


I forget whether the CdotN should be < 0 or greater so bear that in mind if it doesn't work as is.

Stevie