Hi,
We ran into an issue with the Console/stats UI having a strange offset when we adjust the world to meter scale to a larger value (3600 for example).
This is what it looks like it’s when adjusted to that value:
Adjusting the GetOrthoProjection function in FOculusRiftHMD (OculusRiftHMD.cpp:1195) to the following, makes the values readable and sharp again when looking through the Oculus.
void FOculusRiftHMD::GetOrthoProjection(int32 RTWidth, int32 RTHeight, float /* OrthoDistance */, FMatrix OrthoProjection[2]) const
{
const auto frame = GetFrame();
check(frame);
const FSettings* FrameSettings = frame->GetSettings();
const OVR::Vector2f orthoScale[2] =
{
OVR::Vector2f(1.f) / OVR::Vector2f(FrameSettings->EyeRenderDesc[0].PixelsPerTanAngleAtCenter),
OVR::Vector2f(1.f) / OVR::Vector2f(FrameSettings->EyeRenderDesc[1].PixelsPerTanAngleAtCenter)
};
OVR::Matrix4f SubProjection[2];
SubProjection[0] = ovrMatrix4f_OrthoSubProjection(FrameSettings->PerspectiveProjection[0], orthoScale[0], 1.0f, FrameSettings->EyeRenderDesc[0].HmdToEyeViewOffset.x);
SubProjection[1] = ovrMatrix4f_OrthoSubProjection(FrameSettings->PerspectiveProjection[1], orthoScale[1], 1.0f, FrameSettings->EyeRenderDesc[1].HmdToEyeViewOffset.x);
OrthoProjection[0] = FTranslationMatrix(FVector(SubProjection[0].M[0][3] * RTWidth * .25, 0 , 0));
//Right eye gets translated to right half of screen
OrthoProjection[1] = FTranslationMatrix(FVector(SubProjection[1].M[0][3] * RTWidth * .25 + RTWidth * .5, 0 , 0));
}
This is what it looks like afterwards:
However I have some questions regarding this change. I removed the usage of the OrthoDistance argument. Why is distance involved in an orthographic projection? Orthographic projections usually don’t have a variable distance as far as I know. Also, why is this scaled with the world to meter scale?
I have also removed the texture padding per eye. It would be nice to have more information on why texture padding is involved with the projection calculation.
Thanks in advance!