How to optimize performance using DrawingContext to draw 10000 lines?
Hi, our app has a feature to render objects as lines, when add more lines the performance is slow down, is there any way to optimize it? Thanks.
-
sfernandez
Site Admin
- Posts: 2984
- Joined:
Re: How to optimize performance using DrawingContext to draw 10000 lines?
Are you using Noesis 3.1, or is this still with 3.0? In 3.1 we added support for faster DrawLine (and others) in DrawingContext.
Are those lines changing per frame?
Are those lines changing per frame?
Re: How to optimize performance using DrawingContext to draw 10000 lines?
We using Noesis 3.1 with DrawLine. The lines may changing position by interactive with mouse every frame.
-
sfernandez
Site Admin
- Posts: 2984
- Joined:
Re: How to optimize performance using DrawingContext to draw 10000 lines?
And I guess you are already using a precreated Pen for drawing all those lines, not creating new Pens (and Brushes) every frame, right?
Re: How to optimize performance using DrawingContext to draw 10000 lines?
Yes, we are not create pens or brushes every frame.
Re: How to optimize performance using DrawingContext to draw 10000 lines?
Does it improve if you use DrawRectangle instead?
Re: How to optimize performance using DrawingContext to draw 10000 lines?
We combine some lines to a geometry and use drawGeometry for render, drawGeometry is slower than drawLine.
Actually the lines are wireframe of objects project to 2d canvas, we cannot use drawRectangle , but we'll try it.
Actually the lines are wireframe of objects project to 2d canvas, we cannot use drawRectangle , but we'll try it.
Re: How to optimize performance using DrawingContext to draw 10000 lines?
We have a scene with more than 50000 lines, if you have interest the attachment file contains the data we dump from our app. Each line of the file present the start point and end point of one line.
lines test data.
As we can't upload zip file as attachment, we give a link to download it, if you can't download it please tell us, thanks.
lines test data.
As we can't upload zip file as attachment, we give a link to download it, if you can't download it please tell us, thanks.
Re: How to optimize performance using DrawingContext to draw 10000 lines?
In comparison with 3.0, the performance of OnRender in 3.1 is much better (for example, there are no allocations) but there is still a lot of room for improvement and many things we couldn't finish on time. We will be improving this in successive versions. Also make sure, PPAA is disabled on the node to improve performance.
There is still an alternative (also available in 3.0), you can use MeshGeometry and fill the buffers manually. Could you try it?
We also have plans to expose this in form of as part of the interface of DrawingContext.
There is still an alternative (also available in 3.0), you can use MeshGeometry and fill the buffers manually. Could you try it?
We also have plans to expose this in form of
Code: Select all
DrawMesh(const Point* vertices, const uint16_t* indices)
Re: How to optimize performance using DrawingContext to draw 10000 lines?
We tested StreamGeometry, if we did not update geometry every frame the performance is OK, but if update geometry data every frame it slower than drawLines.
We did not make draw MeshGeometry with DrawingContenxt::DrawGeometry work well.
We did not make draw MeshGeometry with DrawingContenxt::DrawGeometry work well.
Who is online
Users browsing this forum: Ahrefs [Bot], Semrush [Bot] and 62 guests