3

I am rendering a large number of meshes loaded as stl and then added to the viewport which is a HelixViewport3D object. All meshes are static in the environment.

// in MainWindow.xaml
 <HelixToolkit:HelixViewport3D x:Name ="viewPort" ZoomExtentsWhenLoaded="True" Margin="250,-15,0,15">

// in MainWindow.cs Constructor
this.viewPort = new HelixViewport3D();
foreach(string path in meshPaths){
    ModelVisual3D meshModel = loadMesh(path);
    viewport.Children.Add(meshModel);
}

Since the number of meshes is high, the rendering performance is quite low (it freezes during rotations, hard to zoom in...). How can I make my scene easier to rotate and manipulate?

Nic
  • 1,262
  • 2
  • 22
  • 42
  • Do you have found any solution about performance with many objects? I have to work with a 70MB 3ds file.. I trying to remove meshes with bound size less than xxx% regarding maximum visible bounds (but I've not found any method to know the maximum visible bounds...) – Mauro Destro Feb 12 '16 at 07:35
  • Hi @MauroDestro, I haven't improved much actually. Your approach seems promising though. Perhaps you can compare it to a percentage of the viewport itself. – Nic Feb 15 '16 at 12:32
  • Yes @Nic, but I wasn't able to find what's the size of the visible part of the space (for example the bounds of an invisible sphere containing the entire model visibile) to do calculation of % – Mauro Destro Feb 15 '16 at 20:37

1 Answers1

1

Regarding ModelVisual3D's remarks, it comes with a big overhead concerning rendering, hit-testing, etc.

Therefore what might help you is reducing the amount of visuals and stick them together:

this.viewPort = new HelixViewport3D();
var meshes = new Model3DGroup();
foreach (string path in meshPaths)
{
    // just take the model of the loaded 3d object
    meshes.Children.Add(loadMesh(path).Content);
}
viewport.Children.Add(new ModelVisual3D() { Content = meshes });

If you do not intend to change the models, you can simply freeze them bevor adding to the HelixViewport3D:

meshes.Freeze();
bbenno
  • 377
  • 4
  • 11