tags:

views:

178

answers:

2

I want to provide a virtual webcam via DirectShow that will use the video feed from an existing camera running some tracking software against it to find the users face and then overlay a 3d model oriented just that it appears to move the users face. I am using a third party api to do the face tracking and thats working great. I get position and rotation data from that api.

My question is whats the best way to render the 3d model and get into the video feed and out to direct show?

I am using c++ on windows xp.

A: 

If you are using DirectShow then using DirectX for rendering seems reasonable.

big-z
Can I render to the directshow virtual camera feed with DirectX instead of directly to the monitor?
Mr Bell
+1  A: 

you can overlay your graphics by using a VMR filter -- a video renderer with multiple input pins. The VMR-9 filter is based on Direct3D, so you can use Direct3D rendering for your model and feed the output to a secondary pin on the VMR, to be overlaid or alpha-blended with the camera output which is fed to the primary pin of the VMR.

Geraint Davies
How do I output from Direct3D to the secondary pin?
Mr Bell
You need a filter that connects to the VMR. When you get an IMediaSample buffer to fill, query for the IVMRSurface9 interface. That will give you access to the underlying D3D surface that you can play with before delivering the IMediaSample object back to the renderer.
Geraint Davies