11-09-2016, 11:56 PM
Both PolyLineVisual3D and LineVisua3D objects are defined in Ab3d.PowerToys library. There are more samples about the 3D lines with the Ab3d.PowerToys sample project. Also you should check the "Ab3d.PowerToys.chm" help file instead of DXEngine's help file.
You will see that the LineVisua3D is very easy to use - you just set the StartPosition, EndPosition, LineColor and LineThickness and the 3D line will be drawn.
The DXEngine is only used here to hardware accelerate the 3D lines.
To get good performance I would advise you to try to use as little Visual3D objects as possible. Each Visual3D object that draw lines is rendered with one draw call. If you will have a few thousand draw calls this will hurt performance a lot. Therefore it is much better to group 3D lines with the same color and thickness into one PolyLineVisual3D, MultiPolyLineVisual3D (those two are for connected lines) or to use MultiLineVisual3D object. With using the later three objects, you will be able to render mullions of 3D lines very fast (with good GPU).
Therefore I would advice you to group the 3D lines with the same color into one MultiLineVisual3D (or PolyLineVisual3D or MultiPolyLineVisual3D) object. Because you probably do not have thousands different colors, you will be able to use only a few of those objects.
You should also try to minimize the number of changes of Positions collection (defines the line positions). You need to know that each time positions are changed, then need to be transformed into vertex buffer and send to GPU. So if you have one positions collection with 100.000 positions and you change that one each frame, this can hurt performance. In this case it is better to device the positions into multiple collections (for example with 5000 positions each) and then change only those that are changed (and not all).
Based on your use case you will need to find a good balance there.
If you need more help, I would ask you to prepare a simple sample of your application and send it to me as PM or by email (see help). This way I will try to optimize it.
PS: If you have many 3D lines it also helps performance to set PresentationType to DirectXOverlay - this allows GPU to render in the background, but prevent putting other WPF objects over 3D scene.
You will see that the LineVisua3D is very easy to use - you just set the StartPosition, EndPosition, LineColor and LineThickness and the 3D line will be drawn.
The DXEngine is only used here to hardware accelerate the 3D lines.
To get good performance I would advise you to try to use as little Visual3D objects as possible. Each Visual3D object that draw lines is rendered with one draw call. If you will have a few thousand draw calls this will hurt performance a lot. Therefore it is much better to group 3D lines with the same color and thickness into one PolyLineVisual3D, MultiPolyLineVisual3D (those two are for connected lines) or to use MultiLineVisual3D object. With using the later three objects, you will be able to render mullions of 3D lines very fast (with good GPU).
Therefore I would advice you to group the 3D lines with the same color into one MultiLineVisual3D (or PolyLineVisual3D or MultiPolyLineVisual3D) object. Because you probably do not have thousands different colors, you will be able to use only a few of those objects.
You should also try to minimize the number of changes of Positions collection (defines the line positions). You need to know that each time positions are changed, then need to be transformed into vertex buffer and send to GPU. So if you have one positions collection with 100.000 positions and you change that one each frame, this can hurt performance. In this case it is better to device the positions into multiple collections (for example with 5000 positions each) and then change only those that are changed (and not all).
Based on your use case you will need to find a good balance there.
If you need more help, I would ask you to prepare a simple sample of your application and send it to me as PM or by email (see help). This way I will try to optimize it.
PS: If you have many 3D lines it also helps performance to set PresentationType to DirectXOverlay - this allows GPU to render in the background, but prevent putting other WPF objects over 3D scene.
Andrej Benedik

