# using python to find object with the pixel information from the render

I wanted to know if anyone had to find a object by only knowing the pixel (x: 300, y: 300)information in a final render say like (essentially using camera view) Is there a way to find the correct object on that pixel from the scene (retrieve the object ID) by scripting via python in blender. Example scene would be:(essentially this but the other way round from 2d to 3d object How to find image coordinates of the rendered vertex?) This is no complete answer, but I suggest using the 2D to 3D script you linked.

The script and some other simple methods provide the following information:

• Every vertex and its coordinates in 3D (scene) and 2D (rendered image)
• Every face (list of vertices)
• The object to which a vertice belongs

Given a 2D coordinate, we can find the closest vertices by calculating the eulcidean distance.

Now we can find the 3D coordinates of those vertices and get the Objects they belong to.

There might be multiple possible objects so we can either calculate the closest view-intersecting-face or if we have a simple scene just take the vertice that is closest to the camera (3D euclidean distance)

• Would this be efficient ? Wouldn't it require to check for every possible point along that vertices? I am trying to build a system that can respond in real time. Or could this have a more mathematical solution?(I can post this in a math exchange)
– John
Aug 31, 2018 at 10:23