# \[Suggestion/Bugfix\] Orthographic projection Oculus Rift canvas rendering

**URL:** <https://forums.unrealengine.com/t/suggestion-bugfix-orthographic-projection-oculus-rift-canvas-rendering/341526>\
**Category:** XR Development\
**Tags:** orthographic, unreal-engine, Oculus-Rift, CPP, question\
**Created:** [December 15, 2015, 3:25pm UTC](https://forums.unrealengine.com/t/suggestion-bugfix-orthographic-projection-oculus-rift-canvas-rendering/341526 "2015-12-15T15:25:40Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![sparkie](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@sparkie](https://forums.unrealengine.com/u/sparkie)\
**Post date:** [December 15, 2015, 3:25pm UTC](https://forums.unrealengine.com/t/suggestion-bugfix-orthographic-projection-oculus-rift-canvas-rendering/341526/1 "2015-12-15T15:25:40Z")

</div>

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:

 ![70695-incorrect+per+eye+view.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/1/6/216d7538499c775d3c01ba2ab7e5107cc6be78bf.jpeg)

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:

 ![70696-correct+per+eye+view.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/0/7/d/07db510b49d43f06bde5bc8c31b9653466717866.jpeg)

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!

---

<div class="post-metadata">

**Author:** ![san](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@san](https://forums.unrealengine.com/u/san)\
**Post date:** [December 24, 2015, 2:58pm UTC](https://forums.unrealengine.com/t/suggestion-bugfix-orthographic-projection-oculus-rift-canvas-rendering/341526/2 "2015-12-24T14:58:05Z")

</div>

I noticed this behavior as well and the suggested solution seems to work pretty well.

@EpicGames, can acknowledge the issue and add it to the bugtracker?  
Or should I make a pull request although I agree that I’m not sure if this is the way you want to have this issue addressed?

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_e729f54e](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_e729f54e](https://forums.unrealengine.com/u/anonymous_user_e729f54e)\
**Post date:** [January 4, 2016, 6:03pm UTC](https://forums.unrealengine.com/t/suggestion-bugfix-orthographic-projection-oculus-rift-canvas-rendering/341526/3 "2016-01-04T18:03:12Z")

</div>

Hello sparkie,

I was able to reproduce this issue on our end. I have written up a report ( UE-24880) and I have submitted it to the developers for further consideration. I will provide updates with any pertinent information as it becomes available. Thank you for your time and information.

Make it a great day

---

<div class="post-metadata">

**Author:** ![Kavan](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/kavan/32/1194623_2.png) [@Kavan](https://forums.unrealengine.com/u/Kavan)\
**Post date:** [November 6, 2021, 6:20pm UTC](https://forums.unrealengine.com/t/suggestion-bugfix-orthographic-projection-oculus-rift-canvas-rendering/341526/4 "2021-11-06T18:20:37Z")

</div>

Still an issue, 4.27.1  
Print String also offset, I use 1200 as my W2M scale.

> **[World to Meters + PrintString in VR](https://forums.unrealengine.com/questions/1051791/view.html)**
>
> When changing the World to Meters (I’m using 1200) and using Print Strings for debug. When playing from editor, the print string text is rendered in different places on each HMD Lens (Quest) causing a cross-eyed and slightly buggy debug experience. ...
