Forum Discussion

🚨 This forum is archived and read-only. To submit a forum post, please visit our new Developer Forum. 🚨
mmostajab's avatar
mmostajab
Honored Guest
10 years ago

relation between TextureSize and RenderViewport

Is there any relation between texData->Header.TextureSize and texData->Header.RenderViewport when trying to use the SDK's Warping? It seems there is a relation between them. Because the warping will change if the texture size is bigger than the render viewport.

4 Replies

  • RenderViewport should match the actual viewport you used when rendering the view for the corresponding eye this frame. In the simple case the viewport will be the full size of the render target texture but if you are rendering both eye's views to different areas of the same render target or you are dynamically adjusting your viewport on the fly to maintain your target frame rate then they will differ.

    The SDK distortion rendering needs both pieces of information (and needs them to be set correctly) in order to apply the distortion shaders appropriately.
  • So, my problem is I am rendering the scene on two different textures, instead of one. So, the texturesize is equal to the render viewport size. Then, it cause my final output gets like this:



    While when I was using the 0.4.2 API, everything was right as follows:



    So, I think the distortion or warping algorithms inside are changed and they are dependent on the relation of texturesize and renderviewport size because if I make the texture size 1/4 of renderviewport rectangle size, the output gets as it was. That's pretty strange for me.
  • "mmostajab" wrote:
    Is there any relation between texData->Header.TextureSize and texData->Header.RenderViewport when trying to use the SDK's Warping? It seems there is a relation between them. Because the warping will change if the texture size is bigger than the render viewport.


    The relationship between the viewport and the size is used to generate the texture coordinates used in the distortion. If you're using two FBOs for offscreen rendering, then you almost always want the texture size and viewport size to match and the viewport position to be (0,0). If you are using a single FBO, then the texture size would be twice as wide (or tall) and the viewports would be set up to each occupy one half of the texture.
  • So, There should not be any differences between the output of using a texture of 2*w, h and two textures of w, h. But there is :(

    My question is whether is there any changes in distortion computation from the OVR API 0.4.2 to API 0.4.4?

    Because The Texture size and the render viewport were as it is in when I had 0.4.2 api but the output suddenly changed by installing the 0.4.4 API :(.

    And today, I understood if I change the relation between the texture size and render viewport, the distortion is changing :(