ChristophHaag / SteamVR-OpenHMD

SteamVR plugin for using OpenHMD drivers in SteamVR
Boost Software License 1.0
194 stars 32 forks source link

Question regarding screen distortion #20

Closed BryanChrisBrown closed 3 years ago

BryanChrisBrown commented 5 years ago

I’m looking at using this for leap motion’s project northstar.

My plan is to use a disassembled Samsung odyssey headset. What id like to do is maintain the 6dof tracking for the headset and controllers, but override the screen distortion parameters. Is this something that is possible with this project?

Thanks for your time, I’m still very new to this.

ChristophHaag commented 5 years ago

Not without some work.

OpenHMD supports the WMR headsets only with 3DOF rotation tracking, not positional tracking. Some work has been done to implement SLAM (camera based inside out tracking) but it's not ready yet, perhaps in the not so far future. And I believe the WMR controllers are not supported at all right now. Oh yea and I still have to figure out how to properly support controllers on the SteamVR side.

If it is possible to get just the tracking data from the WMR runtime without all the rest of the VR compositor etc. running, then the tracking data could be put in here, it's just one quaternion for rotation and one vector for position: https://github.com/ChristophHaag/SteamVR-OpenHMD/blob/b4899b268c18d5576e783dd4c8683e29dc2a8709/driver_openhmd.cpp#L708-L721

For distortion, yes it can be easily replaced in the SteamVR-OpenHMD code. SteamVR queries driver plugins for the distortion by calling the ComputeDistortion( EVREye eEye, float fU, float fV ) function repeatedly with different pixel coordinates fU and fV I believe rescaled to [0,1]x[0,1] and the function is supposed to return the coordinates of the pixel after distortion (or the other way around, can't quite remember).

The current code has a C translation of the shader OpenHMD provides for doing distortion correction with their model but it could be easily replaced with other algorithms: https://github.com/ChristophHaag/SteamVR-OpenHMD/blob/b4899b268c18d5576e783dd4c8683e29dc2a8709/driver_openhmd.cpp#L623-L698 But it would also be nice to determine distortion values in the OpenHMD model, which is unfortunately a very manual process right now: https://github.com/OpenHMD/OpenHMD/wiki/Universal-Distortion-Shader