MarkSim
Topic Author
Posts: 30
Joined: 20 Apr 2021, 18:59

Problem rendering large paths

02 Sep 2021, 14:45

I am drawing a Path sometimes with up to 15,000 nodes, progressively drawing more of the path over time (for example, over 20 seconds).

I am using an Animation to do this, and a Converter which converts Points from my ViewModel to a StreamGeometry, which I then use as the Path Data. The converter takes a percentage, and that is how much of the Points Collection is converted.

This works fine in C# + WPF and seems performant, but I'm finding it very slow when using Noesis for some reason (it could be that what we are integrating with is using some cycles per frame too). I've narrowed the problem down to literally just the rendering phase. Drawing a path with that many nodes just isn't working out at all - so I'm thinking of changing my approach.

I tried using noesis:TrimEnd to animate the gradual drawing of the path, but I found the performance was the same, if not worse.

I have come up with a few ideas:

1) Split the path up into many paths, each handling maybe 50 to 100 nodes - that way during the animation, only one small path needs to be re-rendered rather than one big one .. though I imagine it'll be a problem if the view is invalidated and everything must be redrawn? When I resize the window it does see to re-render everything I think?

2) Progressively draw onto a backing Bitmap somehow.

3) Override OnRender and draw directly, though not sure if I'll just end up with the same problem, and not sure the path will look as good.

4) Try upgrading to Noesis 3.1

I am also pruning nodes where possible.

Just wondering if there's anything else I should consider?

Many thanks.
 
User avatar
jsantos
Site Admin
Posts: 3906
Joined: 20 Jan 2012, 17:18
Contact:

Re: Problem rendering large paths

03 Sep 2021, 13:11

Every time you change the Path, the tessellator is invoked on the render thread. This has been improved by a huge factor in 3.1, but I am not sure if it will be enough for your scenario. We should definitely be faster than WPF, so I am not sure if you are hitting an inefficient path on our algorithm we should fix.

Trimming is fast but is also invoking the tessellator, so probably not a good idea for a 15k+ nodes path.

You can also try with MeshGeometry. If you use it, you must manually build the geometry yourself and pass the vertex buffer. That buffer goes almost directly to the GPU, it is the most efficient way but probably too low-level.
 
User avatar
jsantos
Site Admin
Posts: 3906
Joined: 20 Jan 2012, 17:18
Contact:

Re: Problem rendering large paths

03 Sep 2021, 13:19

Who is online

Users browsing this forum: No registered users and 52 guests