I am currently working on a project where I need to get the orientation of a camera in a Minecraft world using only a screenshot. The purpose of this project is to make seedcracking (the process of reverse-engineering the world seed used to generate a Minecraft world) easier and more efficient.
This would help getting the exact in-game coordinates of really far away blocks, like Minecraft trees, that can then be used to reverse-engineer the world seed, and eventually, might help in automatically reconstruct a world and its blocks from a screenshot.
Minecraft uses X, Y, and Z coordinates as well as pitch, yaw and FOV. The Y coordinate corresponds to the vertical position in the world. The pitch relates to how much a game camera is looking up or down. When a camera is looking down its pitch is 90, when it's looking up its pitch is -90 (0 is looking straight ahead). The yaw relates to the vertical axis rotation, South is 0, West is +90, East is -90, North is 180 or -180. The FOV is the field of view, it can go from 30 to 110 (integers only) and it's 70 by default.
So far, I have been thinking various strategies to get the camera orientation (but I'm no mathematician), including using edge detection techniques to identify the edges of blocks in the screenshot, and then estimating the pitch and yaw angles of the camera based on the orientation of the planes defined by these edges. We don't even need to use edge detection, we could simply leave the highlighting of lines aligned to a certain axis up to the user.
Another way might involve extending the edges of a cube adjacent to its central vertex to create a 3D vector, then take the difference between that and another block's 3D vector and somehow get an estimate of yaw and pitch by using the difference in their positions.
Ideally, having the 3D position (relative to the camera's) of certain blocks in the world shouldn't be required to get the camera orientation, but I kinda know that's going to be a requirement. We can hence assume that we know the positions of a couple of blocks near to the camera and the general direction the camera is facing as well.
Maybe this could overlap somehow with the Perspective-n-Point problem?
In any case, I am still struggling to come up with a working method for determining the camera orientation. I hope to get some suggestions on how to tackle this problem, and what other approaches or techniques I could try.
Any help would be greatly appreciated. Thank you for reading through this :)