<p>So far, I've been able to attach to <code>vrcompositor.exe</code> 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 <code>Present</code> call of the chain I'm interested in.</p>

<p>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.</p>

CC BY-SA 4.0
2024-02-10T22:49:31.587Z
I know this is very old, but I'm facing a similar problem, have you found a good solution for this?
Enrique
CC BY-SA 3.0
2016-12-15T10:48:24.800Z
2016-12-15T10:48:24.800Z
Dan Hulme
<p>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.</p>

<p>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.</p>

<ol>
<li><p>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.</p></li>
<li><p>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.</p></li>
<li><p>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.)</p></li>
</ol>

<p>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.</p>

<virtual-reality><capture><frame-buffer>
How can I intercept and filter all frames coming out of SteamVR?
Dan Hulme
# How can I intercept and filter all frames coming out of SteamVR?

(Asked by: username_0 on 2016-11-24)

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.

**Tags:** virtual-reality, capture, frame-buffer


---

## 1 answers

### Answer by username_0 on 2016-12-15. Score: 5

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.

> **Comments:**
> **username_1**: I know this is very old, but I'm facing a similar problem, have you found a good solution for this?  

---

