WPF - Drawing 3D Object - wpf

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.

Related

How to write custom shader for 3D meshes in WPF with custom vertex and texture properties?

I am pretty new to WPF and want to use the 3D rendering options in WPF. For this I need to write custom shaders for my 3D meshes. I searched a lot, but haven't found anything related to 3D. I only found the ShaderEffect, that can be used for 2D graphics. So is there any way to do this? Maybe by looking on how the DiffuseMaterial or other Material work?

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?

Rendering WPF controls on planes in 3D space

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?

Silverlight - Perspective 3D

I am considering using Silverlight for a project I am working on. This project will need to show a 3-Dimensional cube. Is this possible in Silverlight?
I see a lot of examples that a basically 2-sides of one item. Kind of like a sheet of paper. Is this what "perspective" 3D is? How is perspective 3D different than normal 3D?
Thank you!
You should look at Kit3D for Silverlight. Someone also created a silverlight3d.com site, but it current just has three reference articles and a link to Kit3D.
It is also possible to emulate 3D as demonstrated by this MSDN article.
The feature that was added in Silverlight 3 is referred to as "perspective 3D" to avoid confusion that might arise with someone expecting it be some kind of full scale 3d rendering API (like DirectX or OpenGl etc.) or something like WPFs UIElement3D.
The "perspective 3D" feature in Silverlight allows you to take any regular 2D UIElement and rotate it in 3D dimensions; you can think of it like a more powerful RenderTransform. There are two ways of setting a "Projection" on a UIElement, with a PlaneProjection (simple) or with a Matrix3DProjection (more complex).
You could certainly use this feature to create a 3D cube, where each face of the cube is a UIElement with a Projection applied to it. However you would not use this feature to create something that required complex 3d models such as a 3D game.

Double buffering in WPF?

I'm developing a graph control in WPF. I have previously developed it using GDI and C#.
i've used double buffering in previous control to avoid some issues related to redrawing of the graph control.
Now when i've developed the Graph Control in WPF i have a problem, when i use my Graph Control as a user control in a windows form,anchoring it to the form,and when running it and resizing it i can clearly see two black lines horizontal one and a vertical one in the right and bottom corners of the graph control... i think when i am resizing the graph, to occupy the resized area graph control is taking time and in the mean time the area not filled by the control is seen black...
is there any solution to this problem in WPF? like double buffering?
how can i avoid this issue??
regards,
rangana.
WPF uses DirectX for rendering, so you don't need to doubleBuffer. Perhaps the problem is in your layout code.

Resources