How to switch to wireframe display mode for a Viewport3D control in WPF?

Is there any way to do this? I am looking for something like this:

viewport3dControl.DisplayMode = DisplayMode.Wireframe; 

Instead of the current shaded one.

Or do I need to set this for each object that I want to display as a wireframe? If so, how?

+4
source share
2 answers

It is not as simple as we would like, but it can be done using some library. Cm:

In particular, in the ModelViewer sample, the "View β†’ Wireframe" checkbox is selected, which does what you want. The sample is small, so you can see how it can be applied to your situation.

+3
source

The same answer is also posted here:

Migrating a wireframe to WPF

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 center 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 option to remove the hidden line.

-1
source

Source: https://habr.com/ru/post/1346982/


All Articles