Hello everyone!
I have a question about working with a camera and applying parameters to it from a third-party python with pyrender library. From a library created in python, the following camera parameters are passed, used in pyrender:
shift_x, shift_y, transl, focal_length_in_mm, focal_length_in_pc, center, sensor_width
In pyrender, they are used to adjust the model of the character to his photo in the background. How do I correctly apply them to the camera in three.js? The model is transmitted in STL format. I am currently using code like this:
const fov_rad = 2 * Math.atan(params.sensor_width[0]/(2 * params.focal_length_in_mm[0]));
const fov_degree = fov_rad / (Math.PI / 180);
camera.fov = fov_degree;
camera.setFocalLength(params.focal_length_in_mm[0]);
camera.translateX = - params.transl[0][0];
camera.translateY = - params.transl[0][1];
camera.translateZ = - params.transl[0][2];
camera.updateProjectionMatrix();
But how can I apply the x-offset, y-offset parameter? And is it possible to move the model image along the existing x, y coordinates relative to the center of the screen?
Can anybody help me with this?