2
$\begingroup$

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) enter image description here

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?) enter image description here

$\endgroup$
1
$\begingroup$

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)

$\endgroup$
  • $\begingroup$ 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) $\endgroup$ – John Aug 31 '18 at 10:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.