I have to show stereoscopic 3D graphics on a WPF control.
I already have the code which create two DirectX-9 textures to show, one texture for each eye.
I want to use 3D Vision (not anaglyph).
I considered the following ways to show the two pictures as 3D stereo:
- Using OpenGL or DirectX 11.1 Stereo API.
- Using NvAPI_Stereo_SetActiveEye as described here: http://www.nvidia.com/docs/IO/40505/WP-05482-001_v01-final.pdf
- Using NVidia stereo signature as described here: NV_STEREO_IMAGE_SIGNATURE and DirectX 10/11 (nVidia 3D Vision)
- Trying rendering the two picture one-after-one, hoping that CompositionTarget.Rendering not loosing too much VSyncs, and synchronizing if single VSyncs are lost. In addition turning on the 3D Vision emitter by some invisible control rendering a fictive stereoscopic image.
- Rendering 3D scene and letting NVidia driver to make it stereoscopic automatically.
- Rendering to some real Windows control (such as Winform control), and using WPF host (such as WinFormHost) to show the content.
The problems with the above methods are:
1-3: One of the first three ways seem to be the straight-forward solution, but are not possible in WPF since I cannot create the Device/Context and control the way that the picture is rendered.
4: With CompositionTarget.Rendering I get only about ~60Hz instead of 120Hz. I guess the problem is that EndScene() is called twice - one in my rendered scene and the other in WPF rendering mechanism, but am not sure. Anyway even if will work - that solution seems to be unstable.
5: Rendering 3D scene is not possible in my case for some technical reasons which forces me to render the two images for the two eyes by myself.
6: The problem with WinFormHost and its friends is that it is not a WPF control and it has unexpected behavior in terms of WPF controls. For example the WinForm control will hide WPF controls which are higher on the logical tree, it cannot be rotated using RotateTransform and more.
For now I chose the last solution - using WinFormHost. Does anyone know a solution for that unbreakable wall with making stereoscopic 3D within real WPF control?