0

Performance

Anonymous 5 years ago • updated by Bob Crosby 2 hours ago 6
This discussion was imported from CodePlex

stfx wrote at 2012-03-03 07:44:

Hey there, long time no see ;)

You have been doing some great work here though I didnt check the code in detail yet.

One thing that has always been an issue though, not just with this awesome toolkit but rather WPF 3D in general, is performance (atleast compared to directx). Thats why we really need to optimize the code.

Like in HelixViewport3D.cs you should remove the this.Viewport.Children.Contains check in the Add(), Clear(), Remove() functions as this is something which should be checked by the overlaying code. In fact I would even remove them completely since we already have access to Viewport.Children and can add/remove/clear them just as easy (in windowsforms.listview you also add the items like listview1.items.add(...) and not listview1.add(...)).

Also it might we worth considering in general which code should be in the library and which could be added to the examples. For example the headlight seems like a really seldom used feature which slows the viewer down a bit. Probably not noticable but still why not add an handler for camerachanged and export it to the example code. Although I guess its easy enough for anyone to remove it from the code if they so wish.

There are probably more places where performance could be optimized - maybe its even possible that the models that use the same models could somehow not redundantly save the mesh .

Thanks and keep up the good work

 

EDIT: Just out of curiosity how do you compare the performance of the first revs to the current one? Also is your screen line implementation also quite slow compared to usual DirectX line drawings? This was always bothering me with WPF actually. Btw were there any improvements in .net 4.0 for WPF 3D?

EDIT2: I need to have a scene with many models and emissive simple meshes (sphere, box, plane) which can be seen on a screen here: http://code.google.com/p/freelancermodstudio/ which need to be selected (display a bounding box) and then translated, scaled, rotated. I know for a fact that its possible with this toolkit but Would you say using directX approach might be more suitable as in performance?


objo wrote at 2012-03-10 16:02:

Thanks for the feedback! I think you are right, the Add,Clear and Remove methods are not needed. See changelist a79030ea7c0e.

I have not run a profiler on this library lately, but I don't think the 'headlight' feature has any noticable performance impact. 

Using the HelixViewport3D to calculate the total number of triangles will have a performance impact, so this should be used with care.

The line implementation (LinesVisual3D) in this library is of course slow compared to using DirectX LineList primitive, but it should be faster that the other two WPF3D implementations shown in the PointsAndLinesDemo.

If you need to draw a lot of lines (more than 1000 segments) or more control of the shaders, I think you should go for DirectX. The SlimDX library includes a WPF example! 


stfx wrote at 2012-03-11 00:23:

Thanks for your answer.

Btw before I forget:

  • HelixViewport3D:OnApplyTemplate() ... last assert is incorrectly the same as the previous one
  • Viewport3DHelper:FindNearest() ... the 5 lines after
    // first transform the Model3D hierarchy
    
    seem to break correct detection of clicked visual for me

 

  • Also Resharper notices some small coding issues which might be worth looking into

 

Right now I am struggling to correctly use the LinesVisual3D class (cant seem to find out the correct points). I was delighted when I first noticed the  BoundingBoxVisual3D.cs file thinking that this one would create those screen space lines around an object until I found out that its just some tubes being aranged like a boundingbox :D


objo wrote at 2012-03-11 20:46:

OnApplyTemplate fixed, thanks!

Let me know if you find the bug in Viewport3DHelper:FindNearest!

Yes, I try to keep the Resharper/Stylecop status on 'green'. Viewport3DHelper and HelixViewport3D seems to be ok, but I am sure there are warnings in other classes. Please report if you see some bugs.

Yes, BoundingBoxVisual3D is using cylinders - I made that class before making the LinesVisual3D. Should add a property where you can select between lines or cylinders.


stfx wrote at 2012-03-11 22:23:

Well commenting out the 5 lines after that comment fixed the FindNearest function for me ;)

Hm I would rather replace the functionality in BoundingBoxVisual3D as I think nobody would use cylinders for something like that :P

Other than that I only found some code styling issues which dont affect anything like why are your comments in the functions in MeshBuilder.cs commented out twice? Also in MeshBuilder.AddTriangeStrip() the  wikipedia link exists twice.


objo wrote at 2012-04-05 02:08:

Could the error be in GetTransform(Visual3D, Model3D)? Can you create a small example model where the current implementation fails?

I have tested with the stick figure in ExportDemo (this contains lots of Model3D transforms), and it seems to work ok here (double click on the 'fingers', and you see the target point will be set correctly).

Bounding box with lines - I added this issue http://helixtoolkit.codeplex.com/workitem/9950

Thanks, the MeshBuilder wiki-link comments will be fixed in the next code push. I use "////" when I don't want resharper to reformat comment 'figures'.


peterthesaint wrote at 2014-07-25 12:44:

Hello !!!

It is my first post here. Thanks for your great work !!!

Previously in my model I was using ScreenLinesVisual3d.
Now I noticed new Helix version allows LinesVisual3d and I was wondering whether you have implemented changes suggested in this link:
http://www.ericsink.com/wpf3d/1_ScreenSpaceLines3D_Performance.html

Regard,
Peter

Superbly written article, if only all bloggers offered the same content as you, the internet would be a far better place..  buy essay UK

Thanks for sharing the useful information. I already searched for this type of post to get knowledge about it. It is a piece of interesting information and great services you provide regarding WPF 3D. I appreciate your work. I must recommend this website to others. Please also visit: Financial Outsourcing Solutions

+3

Thanks for the feedback. Personally, I think we need to add lighting to the HelixViewport3D. Without lighting, objects in the viewport scene will not be visible.


Also, try this https://emarketingblogger.com/top-best-game-developers-in-india/ to know more about top game development companies.

+3

The article you have shared here is very awesome. Being a technology freak, I really like and appreciate your work. There are probably more places where performance could be optimized but other than this your work is quite phenomenal. Also, if anyone wants to know about CBD oil for anxiety then come visit us.

+1

Hi,

Nice Post. Thanks for sharing the informative information and great services you provide regarding WPF 3D. I recommend this website to my colleagues. Besides this, we provide backlink services all over the word. Please visit our link building services for more about our services .

The art of bonsai is definitely a wonderful not to mention unique past-time. Viewing not to mention taking care of some bonsai collection is definitely a relaxing not to mention peaceful day to day job. The trees are generally placed anywhere that provides a amazing atmosphere not to mention charm on a room. Bonsai trees available on the market are there to you interest whether you could be an progressed or newbie student. You will truly be run to build up your number of trees after tried this unique fantastic past-time. www.landscapinglockhart.com