I'm working on a ray-tracer and have come up with something that I think could be quite novel, but I'm struggling with the mapping of a Vector3 to it's corresponding 2D screen coordinate. I've searched and found a couple of different takes on the subject but they always end up giving me the wrong results.
Given:
A perspective Camera (consisting of a vectors for position, up, right and left) A vector representing the 3D point in space I want to map back to the screen
Have:
I have a function that will take an (x,y) coordinate and a Camera object and it gives me back a Vector (x,y,z)
Want: A function to do the reverse - i.e. take a 3D world coordinate and the camera and give me back the (x,y) coordinate in return...
I've tried several methods to do this and all of them return incorrect data.
Thank you!