AB4D Forum

Full Version: Maximum number of items?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
What's the maximum number of items that can go into a viewport3D, I'm getting an out of memory error and this is on a high spec server machine.
 It also really starts slowing down when it goes past about 5000 items.
Any tips on a workaround?

 [attachment=153]
Your question is way to generic to be able to answer it. There is no number that represents the amount of items that can be rendered.

You should investigate the memory usage to see why you got the Out of memory exception. Maybe you were using x86 process and are limited to 2 GB per app. Or you tried to render to many TextBlockVisual3D objects where each TextBlockVisual3D would create its own RenderTargetBitmap and this would eat up all the memory. From your screenshot, it is hard to say what happened. Please provide more information about what you were trying to render.

Anyway, performance-wise, if you want to render a much more complicated 3D scene with many 3D objects, then you should add Ab3d.DXEngine to your application. When you are using only Ab3d.PowerToys, then you are using WPF 3D rendering this is fine for simpler 3D scenes, but cannot render a complex 3D scene. With adding the Ab3d.DXEngine your scene will be rendered with a much faster DirectX 11 rendering engine.
Ok thanks for the tips, The code does this a few thousand times (can be up to 60 000 times) :
 _viewport3D.Children.Add(boxVisual3D)
   _viewport3D.Children.Add(txtVisual3D)
_eventManager3D.RegisterEventSource3D(visualEventSource3D) // for each boxVisual3D

I will try without the textboxes.

Excuse my ignorance, are there any code changes needed to switch to using Ab3d.DXEngine ?
I don't feel like re-writing a year's worth of code!
Ab3d.DXEngine is designed in such a way that you can preserve the existing code that you used for Ab3d.PowerToys and WPF 3D rendering.

You can try it with just a few simple changes. See https://www.ab4d.com/DirectX/3D/QuickStart.aspx


Also, if you have so many objects, do not use EventsManager3D and register each one of them. Instead use standard WPF 3D hit testing (see "EventManager3D / Standard WPF hit testing" sample in the standard Ab3d.PowerToys samples project).

When using Ab3d.DXEngine you can use the hit testing that is build into Ab3d.DXEngine - it is much faster than the one in WPF 3D - see samples in the "Ab3d.DXEngine hit testing" section in the Ab3d.DXEngine samples project.