Antoine 1 Share Posted November 27, 2020 Hi, I am rendering trough the camera of my playerSpectator with a horizontal field of view of 60.0, I am calculating the vertical field with the following code. //FOV double aspectRatio = static_cast<double>(Unigine::App::getWidth()) / static_cast<double>(Unigine::App::getHeight()); double fovhRad = fovh * M_1_PI / 180.0; double fovvRad = 2.0 * Unigine::Math::atan(Unigine::Math::tan(fovhRad*0.5) / aspectRatio); double fovv = fovvRad * 180 / M_1_PI; mpWorldLogic->getVisualizationSupervisor()->GetUnigineCurrentPlayerSpectator()->setFov(static_cast<float>(fovv)); //Offset horizontal Unigine::Math::mat3 rotation_matrixX; Unigine::Math::mat3 rotation_matrixY; Unigine::Math::mat3 rotation_matrixZ; mpWorldLogic->getVisualizationSupervisor()->GetUnigineCurrentPlayerSpectator()->setRotation(Unigine::Math::quat(-90, hoffset, 0)); I am then applying an horizontal rotation (hoffset) to my playerspectator. In brief, I'm rendering my scene with a horizontal fov of 60.0 then i am rotating of +60 degrees still with a field of view of 60 and the rendered images are not matching. In the following images there is a little angle that is not covered by the any of the images. How is it possible, what am I doing wrong ? Link to post

cash-metall 92 Share Posted November 27, 2020 setFov recalculate projection matrix with aspect ratio = 1 try to modificate double aspectRatio = static_cast<double>(Unigine::App::getWidth()) / static_cast<double>(Unigine::App::getHeight()); double fovhRad = fovh * M_1_PI / 180.0; double fovvRad = 2.0 * Unigine::Math::atan(Unigine::Math::tan(fovhRad*0.5) / aspectRatio); double fovv = fovvRad * 180 / M_1_PI; auto player = mpWorldLogic->getVisualizationSupervisor()->GetUnigineCurrentPlayerSpectator(); float znear = player->getZNear(); float zfar = player->getZFar(); Mat4 proj = perspective(fovv, aspectRatio, znear, zfar); // calculate projection matrix with right aspect player->setProjection(proj); //Offset horizontal Unigine::Math::mat3 rotation_matrixX; Unigine::Math::mat3 rotation_matrixY; Unigine::Math::mat3 rotation_matrixZ; mpWorldLogic->getVisualizationSupervisor()->GetUnigineCurrentPlayerSpectator()->setRotation(Unigine::Math::quat(-90, hoffset, 0)); 2 1 Link to post

Antoine 1 Author Share Posted November 27, 2020 God bless you cash-metall !! I've been scratching my head for quiet some time. I also had to set my viewport setAspectCorrection to 0 to make it work. Link to post

## Recommended Posts