ValveSoftware / SteamVR-for-Linux

Issue tracker for the Linux port of SteamVR
921 stars 45 forks source link

Screenshots Don't Work #185

Open Goofybud16 opened 5 years ago

Goofybud16 commented 5 years ago

Your system information

Please describe your issue in as much detail as possible:

When playing a game, pressing the right trigger + right system button or right trigger + left system button does not take a screenshot. I expect that it would take a screenshot, as that is supposed to be how you take a screenshot in SteamVR with the Vive. F12 does work for games with a desktop window, however it only captures the desktop window, and not the VR image.

Steps for reproducing this issue:

  1. Open SteamVR and a VR Game
  2. Press the combo for taking a screenshot on your VR controller (IE right menu + right system)
  3. Observe no screenshots being taken
Zamundaaa commented 5 years ago

can confirm

h1z1 commented 5 years ago

Possibly related log:

==> vrclient_vrcompositor.txt <==
Mon Apr 01 2019 04:16:38.687830 - Adding focus flag SystemBehaviorFlag_SystemButtonDown

==> vrcompositor.txt <==
Mon Apr 01 2019 04:16:38.687925 - Detected screenshot action, telling Dashboard to take a screenshot

==> vrclient_vrdashboard.txt <==
Mon Apr 01 2019 04:16:38.720198 - Screenshot: Screenshot requested, type=2, filename=".//Screenshot_Mon_Apr_01_04-16-38_2019" vrfilename=".//Screenshot_Mon_Apr_01_04-16-38_2019_VR"

==> vrcompositor.txt <==
Mon Apr 01 2019 04:16:38.720526 - Screenshot: Received screenshot request, type=2, dest filename=".//Screenshot_Mon_Apr_01_04-16-38_2019"
Mon Apr 01 2019 04:16:38.721428 - Screenshot: Marked submission of screenshot textures for screenshot type 2, flags 1
Mon Apr 01 2019 04:16:38.721603 - Screenshot: Marked submission of screenshot textures for screenshot type 2, flags 3
Mon Apr 01 2019 04:16:38.725968 - Screenshot: Capturing Stereo2D texture
Mon Apr 01 2019 04:16:38.728283 - ModifyBoundsByProjection Left:
    proj:          fLeft= -1.396 fRight=  1.247 fTop= -1.470 fBottom=  1.467
    minFov=  0.916 uMin=  0.182    uMax=  0.875 vMin=  0.189    vMax=  0.813
Mon Apr 01 2019 04:16:38.728313 - VRScreenshotType_Stereo GetTexture Left returned w=0 h=0
Mon Apr 01 2019 04:16:38.728337 - Screenshot: Failed to get the correct textures.
Goofybud16 commented 5 years ago

Tested in 1.4.1, screenshots still don't work.

Pyrarrows commented 5 years ago

Pressing F12 on the keyboard will take (2d only) screenshots as long as the game window is selected. No screenshots using button combo on Vive wands. SteamVR 1.4.2

JulianGro commented 5 years ago

Screenshots using the combination on the Valve Index also don't work.

Goofybud16 commented 5 years ago

Tested on 1.8.5 + Valve Index using the debug commands options. Didn't work.

evilscientress commented 5 years ago

I have the same issue with my Index. Steam VR 1.8.6 running on Arch Linux

Goofybud16 commented 4 years ago

This still doesn't seem to work on 1.10.30

BadBone2k commented 4 years ago

can confirm, Screenshots won't work using Vive Controllers, SteamVR Beta 1.11.3

yaomtc commented 4 years ago

Pressing F12 on the keyboard will take (2d only) screenshots as long as the game window is selected. No screenshots using button combo on Vive wands. SteamVR 1.4.2

At first I thought you were a talking about a keyboard-only function of SteamVR, then I remembered that's the default keybind for taking a screenshot in any Steam game. Still, it's good to remember. Now if I could just strap this half of my keyboard to my body somehow, so I don't have to awkwardly walk over to the keyboard to push the button while trying to keep the view in the right place...

Patola commented 4 years ago

Do we have any ETA to resolve this issue?

LiamDawe commented 3 years ago

Hi, it's 2021 and just got an Index, seems this hasn't been solved yet? FYI pressing F12 on keyboard does take a shot from the headset so the ability is still there and working, just not from the controllers?

JulianGro commented 3 years ago

F12 actually takes a different kind of screenshot. There is 3d screenshots which you can view in VR (when it decides to work). Also I think F12 takes them in a different form factor and lower resolution.

Patola commented 3 years ago

@JulianGro that is interesting. I also thought that the VR screenshots were just the same as the F12 screenshots. Can you give more technical details on these special screenshots? So the reason the function is not implemented is not because of a simple button binding, but also the graphical routines to allow viewing and managing these 3D assets?

LiamDawe commented 3 years ago

F12 takes standard shots of what you see in the headset, worked fine for me. Be nice if that at the very least can be hooked up.

SetantaLP commented 3 years ago

F12 is actually the normal Steam screenshot function, and by that only takes a screenshot of what you see in the game window (which is pretty often not the full view of one or even both eyes but one eye cropped to 16:9 (or whatever aspect ratio the window has)) and can only be used if the game you play is a Steam game and if it has a game window (which is not always the case like for SteamVR Home, which is part of SteamVR and by that a Steam game but has no game window).

What the screenshot controller binding in SteamVR does is basically telling the compositor (the component a vr-game uses to tell the headset what it should display by passing two framebuffers (one for each eye) once it has finished rendering a frame) to create two image files in the screenshot folder: one has the content of one framebuffer and is named like a normal screenshot (<timestamp>_<1, unless you take multiple screenshots in the same second>.jpg) and the other one includes both framebuffers side by side and has vr in its name (<timestamp>_<usually 1, see above>_vr.jpg). So for a screenshot taken in my time zone around the time I posted this, that would be 20210504151530_1.jpg and 20210504151530_1_vr.jpg.

And because of that, the screenshot controller binding works for everything you do in SteamVR including SteamVR Home and any non-Steam game you play (e.g. when you do a VR test for something you currently develop in Unity or Unreal Engine).

Patola commented 3 years ago

@SetantaLP Thank you for the detailed explanation. Do you know what would be the technical difficulties of implementing that on Linux? Maybe accessing the VR compositor?

Maybe it is related to something that I experience in No Man's Sky? Game runs great on proton in VR, and in its menus you can select a screenshot function. When you do that, it hangs for about a minute, but then it shows the screenshot notification and it dumps a 2016x2240 file named _1.jpg on the screenshots folder (no _vr.jpg file -- maybe because that would take even more time?). It's not from the on-screen mirror because this mirror shows a downscaled view of the two eyes. I would infer that it does access the VR compositor to do that, but it takes a long time and maybe that's why the binding is not implemented on Linux -- is that inferrence right?

SetantaLP commented 3 years ago

Sadly I don't know anything about the implementation, since I don't work for Valve and by that don't have access to the source code. So everything I write is based on information from the log files (like the one mentioned by someone else earlier in this issue), tests, general observations of the behaviour and stuff I know from playing around with the OpenVR API.

In general making screenshots seems to be implemented on Linux (there is an interface in the OpenVR API called IVRScreenshots, which is most likely used by the controller binding) but according to the log taking the screenshot fails because it doesn't find the correct textures/framebuffers.

No Man's Sky most likely also uses the IVRScreenshots interface, but since the game needs some time to finish the screenshot and only creates a 2D screenshot, I think they try to take a stereo screenshot (which also includes a 2D screenshot) like the controller binding does, and if that fails they fall back to either just taking a 2D screenshot (which is also possible by using the Interface and might work in contrast to the stereo screenshot) or they fall back to the normal steam screenshot feature (which you probably can access via the Steamworks SDK) and submit one of the eye-textures/framebuffers there.

Lelandzw commented 3 years ago

This is still broken! Valve plz fix.

TheDrawingCoder-Gamer commented 2 years ago

Still broken for me :frown:

mittorn commented 1 year ago

bump

mittorn commented 1 year ago

@SetantaLP No, it is not really implemented. CGraphicsDevice::GetTexture called, no matter if stereo or mono selected, but it is is just "xor eax,eax;retn"

Thread 15 "RenderThread" hit Breakpoint 1, 0x00005555555cbc10 in CGraphicsDevice::GetTexture(CGraphicsDevice::SGetTexture&, CGraphicsDevice::ETextureType_t, vr::VRTextureBounds_t const&, int, unsigned int, unsigned int) ()
(gdb) disassemble
Dump of assembler code for function _ZN15CGraphicsDevice10GetTextureERNS_11SGetTextureENS_14ETextureType_tERKN2vr17VRTextureBounds_tEijj:
=> 0x00005555555cbc10 <+0>:     xor    %eax,%eax
   0x00005555555cbc12 <+2>:     ret
End of assembler dump.
(gdb) bt
#0  0x00005555555cbc10 in CGraphicsDevice::GetTexture(CGraphicsDevice::SGetTexture&, CGraphicsDevice::ETextureType_t, vr::VRTextureBounds_t const&, int, unsigned int, unsigned int) ()
#1  0x00005555555c1251 in vr::CHmdDistort::GetScreenshotTexture(vr::EVREye, CGraphicsDevice::SGetTexture&) ()
#2  0x00005555555c1980 in vr::CHmdDistort::CheckScreenShotStatus() ()
#3  0x00005555555c2298 in vr::CHmdDistort::Present(bool, vr::EVSync, CGraphicsDevice::PresentResults_t*) ()
#4  0x0000555555655fa6 in CRenderThread::Update() ()
#5  0x0000555555657b38 in CRenderThread::Run() ()
#6  0x000055555568c3a9 in SteamThreadTools::CThread::ThreadProc(void*) ()
#7  0x00007ffff7319653 in start_thread (arg=<optimized out>) at pthread_create.c:442
#8  0x00007ffff7398bcc in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81

It seems, windows version contains some d3d11 code in it and valve just too lazy to port it vrcompositor on linux is awful.

Goofybud16 commented 3 days ago

Been a year+ since the last activity here, so retesting the issue, and as far as I can tell, the screenshot button combo still doesn't work properly.