Prof-Butts / xwa_ddraw_d3d11

Direct3D 11 implementation of DDraw.dll for XWA with VR support and New Shaders
MIT License
6 stars 4 forks source link

Render 2D scenes as a texture fixed in virtual 3D space #10

Closed morallo closed 3 years ago

morallo commented 4 years ago

Currently, the 2D scenes are "sticked to your face", which is disorienting and prevents you use your head movements to look to different places.

The usual model to represent 2D screens in VR is to create a virtual screen, fixed in the virtual world.

Trevor89 commented 4 years ago

Agreed and I beleve this was already in the pipeline - or at least discussed?

morallo commented 4 years ago

I think this can be done with OpenVR overlays. I will give it a go after I finish with the performance/latency.

Prof-Butts commented 4 years ago

There's already a 3D vertex buffer that is used to render the 2D image. All we need to do is enable the inverse of the camera transform matrix so that it "stays in place" while looking around. This is probably easier than using OpenVR overlays.

On Wed, Jul 8, 2020 at 1:02 PM Marcos Orallo notifications@github.com wrote:

I think this can be done with OpenVR overlays. I will give it a go after I finish with the performance/latency.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/Prof-Butts/xwa_ddraw_d3d11/issues/10#issuecomment-655726744, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAK2FAO7VODPTZ76AWRTYJ3R2TGEXANCNFSM4MFYQEDQ .

morallo commented 4 years ago

There's already a 3D vertex buffer that is used to render the 2D image. All we need to do is enable the inverse of the camera transform matrix so that it "stays in place" while looking around. This is probably easier than using OpenVR overlays.

My (lack of) understanding of the view transformations and underlying math made it easier in my head to use overlays. No need to calculate anything, you just define the initial position in the tracked universe and the compositor does the rest.

But you surely know better! If you can give any pointers, I can try it out

Prof-Butts commented 4 years ago

See:

https://github.com/Prof-Butts/xwa_ddraw_d3d11/commit/10eae1aa7b86f342e0825f9b4696e69df753b16d

This exposed an artifact when the menu is pulled up while flying, so that still has to be fixed.

morallo commented 3 years ago

For me this works well enough, I think you should close this one @Prof-Butts

Prof-Butts commented 3 years ago

Alright, sounds good! Now I just need to figure out how to close the issue!