Im unsure about how I could describe what im trying to achieve in few words or a title so ill go on to describe it.
So I have voxel, in 3D space, represented solely by its center. The voxel though, is going to be rendered by using a set of pre-rendered images and rotation parameters. E. G.: A function would take an x- & y-rotation and match it with a particular image, which it will display on the screen (Edit: For clarity, the image the function would match with a particular rotation would be an frontal image of the voxel rotated by that rotation)
The problem now is that rotation of the voxel would need to be modified based on the position and fov of the camera:
This cube has a rotation of 0,0. But when using the above described function with the parameters 0,0 it would display a rectangle.
Obviously the position on the screen can be calculated using the projected coordinates of the center and the size can be derived from the Z-coordinate of the center. And In general I have a basic idea of how I would calculate the rotation:
But im unsure if it will work correctly and if there's a more elegant way of calculating the rotation like e. g. with a matrix.
Thanks in advance!