Load .3ds model with high number of polygons - Helix Toolkit Sharp DX

282 Views Asked by At

I used HelixToolkit a couple of f times before, and I managed to load my model (all were small-sized models), and they all worked properly. Now, I have many models with lots of polygons for a project (some have about 10000 polygons). So, when I ran my program, I got an error: "System.ArgumentOutOfRangeException: 'Non-negative number required.'

So, I googled the problem, and somebody mentioned that he uses Helix Sharp DX for his large models. I tried Helix Sharp DX. My XAML code is something like this:

<helix:Viewport3DX x:Name="Viewport3D" ZoomExtentsWhenLoaded="True">
      <helix:GroupModel3D x:Name ="LoadedModels" />
</helix:Viewport3DX>

And my C# code is something like this:

Viewport3D.Items.Add(new DirectionalLight3D() { Direction = new System.Windows.Media.Media3D.Vector3D(-1, -1, -1) });
var reader = new HelixToolkit.Wpf.SharpDX.StudioReader();
var model = reader.Read(path);
foreach (var modelPart in model)
{
    var sharpModel = new MeshGeometryModel3D()
    {
        Geometry = modelPart.Geometry,
        //Material = modelPart.Material, 
        Name = modelPart.Name,
        //Transform = new MatrixTransform3D(modelPart.Transform.ToMatrix3D())
    };
    LoadedModels.Children.Add(sharpModel);
}

But, I again got the same error. I wonder if there is any problem with my code; or if we should try to reduce the number of polygons. Any help/suggestion regarding this issue is appreciated. I prefer to solve it via coding since the polygon count reduction will take most of the time of the project timeline.

Thanks

0

There are 0 best solutions below