sensics / OSVR-RenderManager

Apache License 2.0
64 stars 45 forks source link

Unity-OSVR plugin renders everything flipped in direct mode #311

Open raunaqbn opened 7 years ago

raunaqbn commented 7 years ago

-When I try and run the OSVR-Unity plugin based Game example with the the OSVR render manager configured to render in direct mode all the rendering appears flipped on the x-axis. -Examples like the OpenGL 3D cube and the Direct X render correctly.

DuFF14 commented 7 years ago

What display are you using? Display rotation is defined in the RenderManager config: For HDK2 it should be:

"display": {
    "rotation": 180,
    "bitsPerColor": 8
},

from: https://github.com/OSVR/OSVR-Core/blob/master/apps/sample-configs/osvr_server_config.renderManager.HDKv2.0.direct.json

raunaqbn commented 7 years ago

I am using a custom display where the native mode is potrait so I had to set the rotation to 270 to get direct mode working. Importantly the RenderManagerPresentD3DExample and SteamVR seems to be working fine. It's only unity that appears flipped.

LoSealL commented 7 years ago

The Unity creates texture different from native d3d example. The unity texture is upside-down compare to native d3d. You could manually revert it in rendermanager config file.

russell-taylor commented 7 years ago

There is a flag parameter to PresentRenderBuffersInternal() called flipInY that the OSVR Unity plugin uses to invert this. If you are using the OSVR Unity plugin, this should be happening automatically. If you are writing your own plug-in, you will need to set this flag. It sounds like you are using an example program that is not behaving properly. Please post a link to that so we can see which one is not working and fix it.

raunaqatmeta commented 7 years ago

@LoSealL Can you point me to the config parameter? In any case wont setting up the render manager config also effect the native application and flip everything there? Is there a way this can be handled in the plugin or Unity scripts?

raunaqatmeta commented 7 years ago

@russell-taylor I am using the OSVR Unity plugin available in the asset store and not writing my own plugin. Is there a native plugin src code where I can modify the flipInY parameter you mentioned? I could not find it here..

All the samples have the same issue I mentioned and it;s not just a single sample.

russell-taylor commented 7 years ago

If you're seeing it in the stock plug-in, I'm going to have to bump you to @DuFF14 for further help. I work on RenderManager but he has done the plug-in.

DuFF14 commented 7 years ago

@raunaqatmeta the flipy parameter is here: https://github.com/OSVR/OSVR-Unity-Rendering/blob/master/OsvrRenderingPlugin.cpp#L838

What display config are you using? Which version of Unity?

LoSealL commented 7 years ago

@raunaqatmeta the contributors taylor and duff14 has mentioned the parameters in either config files and the codes. If you just change the settings of Unity Plugin, that won't affect other apps, if you change the setting of rendermanager, however that would affect all the apps

raunaqbn commented 7 years ago

@DuFF14 : I modified the flipInY parameter and set it to false and that fixed the distortion issue. However that caused an issue with the head position rotation data being inverted.

What display config are you using?

I am using the custom display config.

Which version of Unity?

5.4