CreateLine3D: visualisation very slow
#3
Rendering many 3D lines with Ab3d.PowerToys and WPF 3D is slow (this is also written a few times in the Ab3d.PowerToys samples project). 

The problem is that 3D rendering engine that comes with WPF does not support hardware rendering of 3D lines. So to render the 3D lines, the lines need to be defined as 3D rectangles that have the required size and are always oriented towards the camera. This means that the geometry for each line needs to be generated on the CPU. What is more, on each camera change, the line's geometry needs to be recreated. This works well for a few 3D lines, but when you have a lot of them, then this is very slow.

To solve this problem, please use the Ab3d.DXEngine library. This is a super fast DirectX 11 rendering engine that supports hardware rendering of 3D lines and can render millions of 3D lines on a modern graphics card. The following screenshot shows rendering 80 million 3D lines:

[Image: https://www.ab4d.com/images/DXEngineGall...-lines.png]


But if you will use Ab3d.DXEngine and try to render 50.000 individual 3D lines the performance will still not be great (even though Ab3d.DXEngine uses multi-threading and DirectX commands caching). The problem is that this would still execute 50.000 individual DirectX draw call commands. And this can take some time to process by the DirectX and the driver.

This can be solved by using MultiLineVisual3D that can render many 3D lines with one draw call (when using Ab3d.DXEngine). Also PolyLineVisual3D can render the whole poly-line with one draw call. But those two objects can render many lines with only one color. 

If you only need to use a few different colors for all the lines, then create MultiLineVisual3D for each of the color. But if you need to show many different colors, then you will need to use DXEngine's ScreenSpaceLineNode and PositionColoredLineMaterial objects. This will allow you to specify different colors for each line's start and end position. This way you will be able to render all the lines with one draw call and maximize the graphics card utilization with almost no CPU overhead. See "Improved Visuals / Colored lines" sample in the Ab3d.DXEngine samples project for more info.

Ab3d.DXEngine samples project can be downloaded from: https://github.com/ab4d/Ab3d.DXEngine.Wpf.Samples
Andrej Benedik
  


Messages In This Thread
CreateLine3D: visualisation very slow - by Joerg - 10-07-2021, 06:40 PM
RE: CreateLine3D: visualisation very slow - by abenedik - 10-08-2021, 10:00 AM

Forum Jump:


Users browsing this thread:
1 Guest(s)