Showing 3D model in Wpf? - wpf

I need to show a 3D model in WPF. I have my 3D Model created in .3ds, and .fbx extension. Now what i need to do is convert my existing 3D Model which is of .3ds and .fbx extension into XAML so that i can use it in WPF. My basic requirement is to show these 3D Models in WPF and perform animation on them.
Could anyone please help me with it?

You can use this program to convert from .3ds to XAML: http://www.ab4d.com/Viewer3ds.aspx
There are also various XAML exporter plugins, Blender for example:
Blender XAML Export Plugin

Related

Displaying Videos in a WPF window

I need to ask you some questions. I'm new in developing with C# and WPF applications and i don't know what to do.
I have a list of links (videos) that are stocked in a data base and i need to display them in wpf window. I have searched in the internet but I didn't found something interesting
Would you please help me with some tutorials or the steps that I need to follow.
This is an example of what i have to do:
Bind an ItemsControl to a list of your video objects, then apply a template to those objects to render them in a MediaElement, you can then customise how the ItemsControl is layed out by customising the ItemsControl.ItemsPanel
Update for swf:
To play swf files, as long as you are happy that you can't control the playback, you can use a WebBrowser, setting the Source property to the .swf file.
<WebBrowser Source="myvideo.swf" />

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?

How to Export Viewport3D to a 2d Image file?

I'm using 3d in WPF and want to save it to a 2d image file, kind of screen shot.
What's the best way to do that ?
In his 12 days of WPF 3D series, Eric Sink has a nice post about Rendering a WPF 3D scene to a Bitmap. Also of interest might be the post on Printing support.
And for any WPF 3D user, I highly recommend the (open-source) Helix 3D Toolkit, which has several importers and exporters to different formats, and is an essential WPF 3D companion library.

3d Models in WPF

My question is simply
How can I get a file with .3ds or .obj extension loaded in a wpf project?
How can I drag and drop that 3d model with the mouse?
(I'm doing a 3d chess project)
Blend has support for loading an obj file and converting it to xaml. Unfortunately, there is no support for 3DS in the box - getting 3DS files requires 3rd party software such as Reader3ds.
You'll need to write your own hit testing, and handle this yourself.

WPF 3D Model Drawing Tools

Are there any applications out there for 3D modeling that would output the finished product to an array of points (X,Y,Z) that you could then import to a WPF 3D Model?
ie:
<MeshGeometry3D Positions="0,0,0 10,0,0 0,10,0 10,10,0 0,0,10 10,0,10 0,10,10 10,10,10"
TriangleIndices="0,2,1 1,2,3 0,4,2 2,4,6 0,1,4 1,5,4 1,7,5 1,3,7 4,5,6 7,6,5 2,6,3 3,6,7" />
A simple google search for "WPF exporter", an I found:
Viewer3ds - 3ds to xaml converter
Viewer3ds is a WPF application that can read 3ds files and convert them into xaml. It is using the Ab3d.Reader3ds library that imports 3ds files at runtime.
This might be what you need because almost all 3D authoring application are able to export to .3ds format.
Edit:
You could also try Blender and XAML Exporter for Blender to create your 3D assets.
you can use google sketchup, and the exporter I wrote.
http://itaibh.blogspot.com/2009/09/google-sketchup-xaml-exporter.html
Viewer3ds is a converter rather than a modeling tool. If you are looking for free tools, Blender is a very powerful 3D modeling application (albeit with a high learning curve for the UI and workflow) which can export .xaml files with the help of this Blender plugin.
If free is less of a concern to you, then you can use other applications such as Maya or 3ds Max, also with plugins : http://max2xaml.codeplex.com/
All tools mentioned above have the ability to define normals, smoothing groups, materials, etc., everything that WPF supports (and much more, of course).

Resources