cancel
Showing results for 
Search instead for 
Did you mean: 

VR Mirror without distortion

MafiyCGD
Honored Guest
Hi,
Help me please. How can I show picture on the PC output to fullscreen without distortion?
When I use sample "r. Mirror Variants" from oculus SDK and set mirrorMode to 4 or 5, I get distortion of picture:
http://s12.postimg.org/ie67657zh/Untitled.jpg
As I understand texture one eye is re-sized on all screen and it is reason of distortion.
I suppose it happen within ovr_CreateMirrorTextureD3D11 function but I can not see implementation of this function.

This demo works correctly and I want the same result:
https://share.oculus.com/app/i-expect-you-to-die
1 REPLY 1

jherico
Adventurer
I can't really speak to the sample code, but I have worked on this issue.

The window size and aspect ratio are de-coupled from the size and aspect ratio of the rendered image, so when transferring the image to the window, you need to either crop or letterbox the image appropriately.

You should know the size of the texture you're using and you should be able to determine the size of the renderable surface on the window. Compare the two aspect ratios... if the ratio of window aspect to texture aspect is greater than 1, then the window is wider than the image. If it's less than 1 the window is narrower than the image. Use this information to set your destination viewport in the window before transferring the image and you'll get letterboxing. Alternatively, you can can use it to set the source viewport in the texture in order to do cropping.

My application does this in the internalPresent method of our HMD plugin, as seen here: https://github.com/highfidelity/hifi/bl ... n.cpp#L111