I need a way to find the underlying 3D coordinates for each pixel of the camera in Python.

I to create a function like:

GetCoordinatesForPixel(xPixel, yPixel)

which returns a (X, Y, Z) vector.

I found the following threads:

How to get world coordinates of pixels? which is supposed to be a duplicate of this one: How to render world position pass

The latter solution works in that it procudes a render. However, I do not see a way to access those values in Python.

  • $\begingroup$ Did you look at this post blender.stackexchange.com/questions/7106/…? You will have to play around with it a little, but this might be headed in the right direction. $\endgroup$ Commented Nov 5, 2014 at 14:29
  • $\begingroup$ Why would you need to render multiple times? $\endgroup$
    – gandalf3
    Commented Nov 5, 2014 at 20:48
  • $\begingroup$ Once for the actual image I want to estimate on and once to get the ground truth values. @BlendingJake I tried to work with bpy_extras.view3d_utils but so far I am not really sure how to handle the arguments. But I may be able to figure it out:) $\endgroup$ Commented Nov 6, 2014 at 14:09
  • $\begingroup$ @user1033657 I wasn't able to find much info on it, but just keep playing and you'll probably get it. $\endgroup$ Commented Nov 6, 2014 at 14:12
  • $\begingroup$ re-opening, @user1033657 would like to edit the question (to make it not a duplicate) $\endgroup$
    – ideasman42
    Commented Dec 15, 2014 at 17:53

1 Answer 1


Blender's Python API currently doesn't expose access to the pixel value of render passes.

(You can access image pixels but renders's are a more complex structure).

However since you mention you need to store the values in a file, just save the OpenEXR file, this will store the values in a file.

  • $\begingroup$ Exactly how would you read these coordinates in .exr image tho? I just loaded an .exr image created from world position pass in Blender gofile.io/d/sN7OWF using python OpenEXR, and all the (r,g,b) values are integers, wouldn't they all be float if they represent global coordinates? $\endgroup$
    – June Wang
    Commented Nov 29, 2021 at 12:51

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .