Page 1 of 1

How to find the 2D coordinates in different camera views

PostPosted: Wed Sep 15, 2021 3:45 am
by makehuman987
Hi ,
I have an animation imported in Blender. Now I have got 6 cameras in different views in Blender. I want to get 2D coordinates for some body part( for example the eye) in each view during the animation, what should I do? please give some advices on this.

Re: How to find the 2D coordinates in different camera views

PostPosted: Tue Sep 21, 2021 4:27 pm
by punkduck

I am not really sure, you have a vertex somewhere in blender, so a 3d coordinate (x,y,z) and you want to know where it will be presented on your screen / render result?

At least therefore you definitely need to know mathematics and how camera and projection works. And then write an own plugin (I do not know sth out of the box)

  • First you need to find your coordinates of only one vertex, like in the middle of the eye ... So in a mesh you must know the vertex number and then you get the position (be aware blender has local (object) and world space). You need it in world space. Lets call that a(x,y,z)
  • Then you need the position of the camera also in world space c(x,y,z)
  • Then you need the angle or orientation of the camera theta(x,y,z)
  • and then the display surface ... e(x,y,z)

When you get that all, there is a formula for perspective projection

the result would be b(x,y) in the formula.

This is the mathematical correct approach. But the "weak" method is normally sufficient, you can check here:

(it uses a focal length)

And here:


I once tried to calculate the camera distance from the object, so that it is completely visible using a bounding cube. And my CAD math is a bit rusty unfortunately. So I needed some tries to get a result. The problem was similar in a way. But I do not know an easy way.

I am not 100% sure if there are some additional functions in Blender, which can be called, when a plugin is written. The reason is, that the rendering is usually done the other way round. Like starting from a plane (your screen) and tracing where the ray hits ...

Experts somewhere? :mrgreen:

Re: How to find the 2D coordinates in different camera views

PostPosted: Wed Dec 22, 2021 2:57 am
by makehuman987
Sorry for such a long time I haven't seen this post(I have forgotten this post in this block). After such a long time, I have totally solved this problem by doing some mathematics. In blender there's indeed a function 'world_to_camera_view' which can get 2D coordinates.
Thanks a lot.