ValveSoftware / openvr

OpenVR SDK
http://steamvr.com
BSD 3-Clause "New" or "Revised" License
6.06k stars 1.27k forks source link

Calling TrackedDeviceDisplayTransformUpdated causes culling issues #716

Open AntoineConffx opened 6 years ago

AntoineConffx commented 6 years ago

I am currently working on a custom OpenVR driver with an HMD that has angled displays. The angle for each display is approximately 26 degrees and calling TrackedDeviceDisplayTransformUpdated() fixes the rendering in the HMD but causes culling issue on SteamVR clients. My guess is that the culling is broken because of the extra transformations.
If I don't call the mentioned function then the culling works fine but the rendering in the hmd does not fill the screen (for both eyes) Any help would be appreciated

AntoineConffx commented 6 years ago

I wrote a sample based on the openvr hello_opengl sample, and have modified it to include Frustum Culling. I have two code paths (based on some #define declared at the top of the file), the first uses the Hmd Pose as the view matrix and the second uses the Hmd pose * EyeToHeadTransform. The first version has a very similar culling issue to what I'm seeing on SteamVR Home app The second version works well. If I disable the TrackedDeviceDisplayTransformUpdated function in the custom driver then the first version works well and so does the SteamVR home.

I have attached the sample I wrote (just the source files and .vcxproj) if anyone wants to look at it. frustum_opengl.zip

The code that makes the difference is this image with poseInverse being the HmdPose (forget the variable name) and m_mat4eyePosLeft being the HeadToEye for left eye.

I think the SteamVR Home app needs to be modified to use the EyeToHead transform as part of the frustum culling. So maybe adding a sample (like the one I just attached) would be a good idea so that clients know which matrices need to be used for the view matrix. Unless there is a step I'm forgetting in the driver, such as multiplying the pose by the inverse of the angled display matrix? Any feedback/comment would be great.

TheDeveloperGuy commented 5 years ago

There's definitely something funny going on here. I'm having the same culling issues as you've described here, plus another, if I change the pose yaw quickly in between frames, let's by 30 degrees, I get the same culling issues. In that instance they'll last for a single frame. In the case of using an HMD with rotated displays, they last indefinitely.

TheDeveloperGuy commented 5 years ago

As this problem is solved for Pimax 5K/8K headsets, I'm curious what they have done.