Archived

This topic is now archived and is closed to further replies.

moogle33

How to find out if a vertex is visable

Recommended Posts

moogle33    122
Hello everybody Is there a way of testing to see if a 3D point is in front of the camera. I supose I could do some matrix maths but apart from being slow i would not be able to take the perspective into account.

Share this post


Link to post
Share on other sites
OrangyTang    1298
quote:
Original post by moogle33
I supose I could do some matrix maths but apart from being slow i would not be able to take the perspective into account.

Doing the maths properly should only amount to a couple of matrix multiplies and (up to) 6 plane equation tests. All these operations are pretty simple and won''t take long at all. By taking the projection matrix into account you can make sure the affect of perspective is applied as well.

Its only going to be slow if you''re comparing millions of points at a time, which you shouldn''t be doing in the first place because you probably want to test and objects bounds first (and maybe leave it no more detailed than that).

A quick and easy route might be to use gluProject and compare the resulting window coord with your window bounds, then you don''t even have to write the maths yourself

Share this post


Link to post
Share on other sites