This is a little tricky question.
I am working on ad add-on in which the user is able to add text objects that is automatically constrained to the camera using “child of” constraint and positioned correctly. Here is an example with a camera that has 35mm focal length:
Now what I want is to keep that “screen” position and text size the same regardless of what would be the focal length of the camera. If I switch the focal length of the camera, the text would occupy different position (screen space wise) and would appear smaller or bigger (depending on focal length).
Here is an example with focal length changed to 28mm
The text appears to be smaller and moved up in the screen space.
All of that is obviously caused by how optics work and is the correct behavior.
So my question is this:
What would be the formula to calculate text object position and text font size, so regardless of the focal length the text would always appear to have similar size and position in screen space (camera frame)?
My thinking here was mostly based on the idea that it is really easy for user to edit Blender Text object, just by switching to edit mode.
I also need this functionality for video reference that animators might want to use and have it attached to their shot cams.
BUT that being said, I definitely would like to find/learn the best way to display any kind of information inside of the camera or 3dview that would just stick and not change size/position.
I don’t have any experience with BGL, what would be the best place to learn about it?
Quick question though…what would be the easy way to attach a text created like this to the camera frame? I looked at the example in the provided link, but can’t quite figure this out.