Rendering WPF controls on planes in 3D space - wpf

I have the following setup: I can track a surface very accuratly in a 3d space using a tracking system. Now I want to project on this plane with an overhead projector.
I want to develop my interface in WPF/XAML and then render it in real time to the surface that is tracked. But I don't know exactly how to do it...
This is what I think: I need to model the tracked surface in a 3D space, then I want to develop the interface using regular WPF/XAML controls use (maybe) directx to render these controls to model in 3D that represent the tracked surface.
I already found information of using directx in combination with wpf (Sharpdx.WPF) but here they demonstrate how to create 3d scenes with wpf... However, they don't show how to use regular WPF controls and render these to the 3d models.
Do I first need to convert the user control of WPF/XAML to an image and then render it to the 3d model or is there another way to do it?

Related

Stereoscopic 3D on WPF

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?

Is silverlight better or wpf for graphics, 3d?

I learning wpf/silverlight currently. I want to ask which one of them is better for graphics, 3d, ... ?
People say "Silverlight is a subset of WPF" -- what they mean is that the programming model is the same (code + XAML), but Silverlight generally has a smaller API / less features than WPF.
I think a good example would be creating a reflection. In WPF you could use a VisualBrush, but Silverlight doesn't support it. Still you can create the same effect by creating a 2nd transformed element. You can pretty much acomplish the same task in both, although for Silverlight you may have to do some processing tasks on the server.
The choice of platform depends more on whether you want to target web deployment or not and possibly performance.
3D isn't implemented in Silverlight 4 (though there are 3D libraries out there). 3D will be part of Silverlight 5. (Beta coming soon, probably at MIX, and to be released this year.)
i would sugest wpf in WPF you have all the Viewport sutff where you can do real 3d, In Silverlight you have PlaneTransformation but it is not close to real 3d
WPF 3d tutorial
The deal is more deeper as I understand.
We will speak about WPF and Silverlight 5. There are two mechanisms of 3D Graphics. Before WPF it was a single one - so named pipeline graphics. It includes DirectX, OpenGL and multiple derivative and independent realizations (XNA from DirectX, for example). Although WPF is based internally on DirectX it realizes absolutely different conception of smart graphics. What is the difference for a pipeline and smart mechanism? The pipeline mechanism consists of infinity loop of drawing objects - typically primitives like vertex, triangles. It works by initialization of so named infinity loop by calling something like OnDraw/ReDraw method.
WPF does not use ReDraw and does not draw anything until we directly detect it. It is single correct way to use it. Therefore WPF allows to draw UI Elements with internal support of hundreds events, methods and full freedom of management (like usual WPF control - textbox, for example). (Helix 3D is good library for easy way to WPF 3D) And vice versa, Silverlight 5 has some API of XNA graphics - pipeline way without UIElement support for 3D objects.
There is Kit3D library http://kit3d.codeplex.com/ as very good idea for smart graphic realization for Silverlight and there are many other realizations (Balder, Babylon) on pipeline mechanism. If you are interesting to code an application like web 3D Game - choose pipeline Silverlight 3D graphics, if you are interesting about smart 3D applications - choose WPF 3D.
Author of WPF 3D CAE system TIMO Structural.

WPF - Drawing 3D Object

I am newbie to WPF.
I have drawn simple 3D cube and rotate it with mouse
But my question is,
is it possible to draw wireframe object in WPF Without using any third party library(eg.Charles Petzold's libraty etc..)?
Unfortunatly the DirectX that WPF is built upon doesn't allow drawing lines, only rectangles which in turn means no wireframe. Sorry, you´ll have to look around for another solution.

Deep zoom on dynamically generated 3D image cube

I am making a 3D cube using kit3D.this cube is generated at run time.I wanted to know whether i will be able to add deep zoom o this dynamically generated 3D cube.The entire cube is ultimately an image and this is loaded altogather at a time.or is there any other way where in I can get the deep zoom effect???
Thanks
In Silverlight 2 this can't be done as we've not made allowances for a lot of perspective 3D transforms as we have in Silverlight 3.
In Silverlight 3 you should be able to perform this, but do remember that Deep Zoom is somewhat an adjustment to the end users UX, so zooming in and out on image sets whilst in a 3D face can be considered cumbersome if not handled appropriately.
Scott Barnes / Rich Platforms Product Manager / Microsoft.

Pixel level 2D Graphics in Silverlight

I am trying to port a WebForms app to Silverlight, this application is using the GDI Graphics class to draw polygons to a in-memory bitmap, it will then do pixel by pixel comparisons so I need access to the pixel buffer.
Example:
Graphics g = Graphics.FromImage(bmp);
g.FillClosedCurve(brush, points, FillMode.Winding);
I have done some serious googling trying to figure out how to draw polygons and then be able to access the pixel buffer of the canvas surface. My findings indicate that this is not possible with the WPF silverlight graphics, so I need to use a custom graphics library but have only found some 3D libraries. Is there a simple 2D library for silverlight or should I just go a head and write a polygon render algorithm myself?
If you write a polygon rendering algorithm for Silverlight, it would have to be all managed code, I haven't seen any examples of this, but if you write one let me know, I've been looking for something like the for XNA.
Silverlight 3 should be adding some of the things you need to make this a lot easier like rendering to a texture and accessing a bitmap at the pixel level.
Could you grab an image from a server and process that? You could dynamically generate the image and you'd have access to whatever you needed outside of Silverlight.

Resources