3d world space coordinates to 2d viewport coordinates

I want to do a function that converts a point3 3d space coordinate to a point2 2d viewport coordinate. The idea behind this function is to do a script than read a vertex coordinate and return true if that vertex is visible within the viewport area.

Any ideas ? thanks in advance.

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
crazyosachou's picture

hi, i don't know if i

hi,
i don't know if i understant u, but this is an idea:
u need to creat a camera at the moment when u excute the scirpt then delete it after to get an exact point3 coordinate, then supose that the position of the camera is the origine [0,0,0], then calculate the point3 coordinate of u'r vertex in our cameras origine.(Mathematique, changing the origine)
Then u'll take only the X and Y value and compare it with the size of camera (length and width) to know yes or no the point is visible.

hope it'll help u, if i didn't understand u,try to explaine more, i'll try to help u if i can !!

Good Luck!

learn more,learn as fast as u can, coz u can be not able to learn more tommorow!!

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.