7
$\begingroup$

I'm trying to investigate the effect of certain image operations on how VR scenes are perceived. To do this, I'd like to run an off-the-shelf SteamVR application, capture the frames as they come out of the compositor, run a shader or compute kernel on them, and have them displayed as normal on the HMD. I'm aware of the latency penalty for doing this; I have some ways to minimise it, and in this case I can tolerate extra latency, so don't worry about that for now.

I can see three strategies which might let me achieve this, but I don't know enough about the display subsystem to know which will work and how to start.

  1. Make a 'fake' display driver. My display driver would take the place of the HMD's driver, and it would act like a proxy. When the SteamVR compositor tries to swap buffers, my driver would do the processing on the backbuffer before poking the real HMD driver. It seems like the main difficulties in this would be (a) getting Windows to accept my fake driver, (b) getting SteamVR to accept my fake driver, and (c) letting my driver use the real HMD driver.

  2. Use normal video capture software (such as OBS) in display capture mode to capture the frames before they get to the display driver, and then use an overlay technique (like the Steam overlay) to draw over the frame completely with my processed frame. This sounds simple, but I know there's a lot of work in making either of the two halves of the system.

  3. Hook into the SteamVR compositor itself. It supports third-party HMD integrations, and I'd hoped I'd be able to trick it into using my shader as a chromatic aberration correction shader, but it turns out that it doesn't let the HMD integration run a shader directly, it just sets the parameters for the built-in shader. This seems like it should be the easiest way, if I can just find a way to make the compositor run my shader. (I'm not averse to hacking the compositor if there's a way.)

I know some people on the site are also active researchers in this area, so I'm hoping someone has practical experience of what worked and what didn't. Since this is for an experiment, not production software, I'm more interested in an answer I can hack up in a few days to work on one particular PC, than in something that's reliable but takes months to get right.

$\endgroup$

1 Answer 1

5
$\begingroup$

So far, I've been able to attach to vrcompositor.exe with RenderDoc and intercept the D3D calls that do the composition. According to Baldur Karlsson (the author of RenderDoc), it's not that hard to hack RenderDoc to use its hooks to run arbitrary code on each Present call of the chain I'm interested in.

I've not had a chance to try that out yet, so this isn't a final answer! I'll update this post with any further progress.

$\endgroup$
1
  • $\begingroup$ I know this is very old, but I'm facing a similar problem, have you found a good solution for this? $\endgroup$
    – Enrique
    Commented Feb 10 at 22:49

Not the answer you're looking for? Browse other questions tagged or ask your own question.