Get Pixel coordinates from the rendered image

How to get the pixel coordinates of the object location after rendering? An object and I have a glass material in front of it with some refractive index. SO while rendering the position of the object changes due to refraction. I want the position of the object center as seen in the rendered image.

what is rendered is a 2D image only not a blend file !
what do you want to do with this location in an image ?

happy bl

I want to do some calculations using the 3d location of an object center wrt to the pixel coordinates of the same object center from the rendered 2D image.

Right-click over the rendered image will give you pixel coordinates at the bottom line, I have no idea though of how to find the corresponding position in the viewport camera view, perhaps with the help of an add-on (that I know exists) aimed to get precise measures of the render border region.

Hi and welcome on BA !

If you are speaking about Python scripting to go from 3D vertex to 2D, I am currently having the exact same problem, and couldn’t yet find a solution. With no refraction it’s very easy (using World Matrix of object, and vertex coordinate) When there is refration… That is a very good question !

Well, I use renders done with Blender as much more than “only” 2D images ! All the passes, material, obj index, depth, etc can be very usefull in a LOT of cases :slight_smile:

A solution could be to do a first render with a refractive index which equals 1.0 (no displacement of the rays) where the 2D position can be computed. Then do the “normal” render with refraction. And then use an Optical Flow algorithm to track the pixel movement between two renders, and get back the final 2D position.