How to get a coordinate from a 3d scene?

Hi, I came from the world of 2D Image processing and just coming into the world of 3D

So, I have play the example in 3d folder and I have a doubt,

In 2D image it easy to get a coordinate from something like cvmat or IplImage in opencv and then use that coordinate to calculate and processing go on.

My question,
If I want to get the cordinate X, Y, Z from the screen, How can I do that?
Please suggest and give me some clue.

thank you.

This is actually a big topic in computer graphics. You can search for ray-plane intersection or ray-triangle intersection.
It actually depends on what scene you have and what method do you want to use to get the coordinate… if your geometry is very complex it could get a little heavy to process.

But if what you have is a simple scene then i suggest you start here:


Also look for worldToScreen and screenToWord in this forum if what you want is to translate scene to screen coordinates and vice-versa.

Hope that helps :slight_smile:

There’s also an example in the examples 3d folder, pointPickerExample that does something like this. it’s limited to find the nearest vertex on a geometry but it would be a first step to finding the triangle where that vertex lies and then the intersection of the ray from the camera passing through the mouse with that triangle which would give you the exact 3d coordinate.

I will try and start from your advice.

Thank you so much for your help @Jordi !!

I wil try from your suggestion @arturo , Thank you so much :smile: