Wireframe wiring in WPF

I need to write wireframe 3D rendering in a large WPF application that does a lot of things. But WPF has no native capabilities.

Some people use Microsoft’s β€œ3D Tools for WPF,” specifically their ScreenSpaceLines3D class. But there are complaints on the Internet about slow performance and various bugs with this class, and the class library does not seem to be supported since 2007.

Others have proposed the LinesVisual3D class from the Helix 3D toolkit, but apparently this is also a buggy ( http://helixtoolkit.codeplex.com/workitem/9957 )

Charles Petzold has a three-dimensional library - does anyone know that he is reliable enough?

Do I have any good options here? For example, is there a good way to make OpenGL3D in a WPF window? Are there other good WPF libraries that can do this reliably?

Thanks in advance.

+7
source share
3 answers

Check out SlimDX. XNA and Managed DirectX, etc. Out of date or out of date. Perhaps also check out SharpDX, I haven't tested it after a while. We use SlimDX for DirectX in .NET, which is good. What you're probably looking for is using SlimDX to render in D3DImage for WPF interoperability. Another possible option is to use a hosted WinForms control and use a handle to it to interact with DirectX with SlimDX, which may be faster, but you will lose a few simpler interactions with the WPF rendering engine, etc. If you use D3DImage, it will become an ImageBrush, which you can set as the background of everything, and you do not need to worry about problems with airspace, etc.

Edit: oh yes, for some reason SlimDX no longer has its samples in the download, but their source code has the samples if you download it.

+3
source

This page seems to contain information on using OpenGL. Microsoft also mentions the use of Direct3d and XNA. XNA is pretty easy to use, and if you already know OpenGL, you probably won't have a problem learning Direct3d. I admit that when I recognized Direct3d, the material on it was not as good as the OpenGL material.

+2
source

I have seen many answers related to third-party solutions for this problem.

For a clean WPF solution, I create a new Model3D from an existing Model3D, where each facet is created with a hole in it. those. split into 6 new faces with the width of each "line" proportional to the original size of the facet.

The reason for this is that it looks better than a fixed line width, but you can use a fixed line width if necessary.

Optionally fill the central hole as a new face in black (separate 3D model in the group), and you have a hidden line removal.

For the three points in facet A0, B0, and C0, calculate the midpoints AB, AC, and BC. the new point A1 is 1/20 along the line to BC. Repeat for the next two points B1 and C1.

6 new faces for the β€œlines” are represented by the following combinations:

A0, B0, B1
A0, B1, A1
A0, C1, C0
A0, A1, C1
B0, C0, C1
B0, C1, B1

Add A1, B1, and C1 to another model for the hidden line removal option.

0
source

All Articles