Slow redraw with complex assembly (assembly4)

Discussion about the development of the Assembly workbench.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
project4
Posts: 237
Joined: Fri Jul 12, 2013 12:53 pm

Slow redraw with complex assembly (assembly4)

Post by project4 »

Hi guys,

Do you have any ideas how I can debug slow 3D view refreshes with assembly using assembly4?
Moving the view, rotating, zooming... all are very slow and get slower when I add more parts.

Zolko proposed to export the assembly to a STEP file and try loading it separately, but it looks like the STEP export doesn't wan't to work properly (I get error that the STEP can't be loaded, while I try to export it).
The STEP file is created after all (about 200MByte) and when I try to open it I just gave up after 15 minutes of FreeCAD 100% CPU and eating all my system memory.

Is there a known limit of the parts that cause slowness of the 3D view?
Or a complexity of the parts?

The assembly doesn't have much parts, probably around 50-60 , but the parts are pretty complex, many holes, threads and so on.
The parts are imported from STEPs.

I'm with a version built from sources.
Intel® Core™ i7-5820K CPU @ 3.30GHz × 12
16G RAM
GeForce GTX 1060 6GB/PCIe/SSE2

Code: Select all

OS: Ubuntu 18.04.5 LTS (ubuntu:GNOME/ubuntu)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.22292 (Git)
Build type: Unknown
Branch: master
Hash: f09d48d0fe00590997b88b52b610210ac606951c
Python version: 3.6.9
Qt version: 5.9.5
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/UnitedStates (en_US)
Thanks.
User avatar
DeepSOIC
Veteran
Posts: 7896
Joined: Fri Aug 29, 2014 12:45 am
Location: used to be Saint-Petersburg, Russia

Re: Slow redraw with complex assembly (assembly4)

Post by DeepSOIC »

There are quite a few things you can do.
* enable VBO for rendering (Edit->Preferences->Display)
* reduce tessellation accuracy (increase value of Deviation property (View tab) of displayed objects; you will have to force-recompute the project or save and reopen it to see the effect)
* turn off preselection highlight (Edit->Preferences->Display->Colors)
* use any navigation style other than Gesture (Gesture performs a hit-test to see if there is a dragger under cursor before starting a rotation, it can cause a noticable lag)

Playing with other things such as antialiasing and transparency might help too.


project4 wrote: Mon Sep 07, 2020 7:06 pm but the parts are pretty complex, many holes, threads and so on.
Threads can be the killer, they are extremely resource demanding.
User avatar
DeepSOIC
Veteran
Posts: 7896
Joined: Fri Aug 29, 2014 12:45 am
Location: used to be Saint-Petersburg, Russia

Re: Slow redraw with complex assembly (assembly4)

Post by DeepSOIC »

project4 wrote: Mon Sep 07, 2020 7:06 pm Build type: Unknown
If build type is actually "Debug", FreeCAD runs about 10 times slower than "Release" build. Make sure you are using a release build.
User avatar
Zolko
Veteran
Posts: 2213
Joined: Mon Dec 17, 2018 10:02 am

Re: Slow redraw with complex assembly (assembly4)

Post by Zolko »

DeepSOIC wrote: Mon Sep 07, 2020 7:33 pm * turn off preselection highlight (Edit->Preferences->Display->Colors)
ah yes, I remember, this is a huge performance drag. It goes from unusable (10s between movements) to quite fluid. See this thread:

https://forum.freecadweb.org/viewtopic. ... 10#p413062
try the Assembly4 workbench for FreCAD — tutorials here and here
project4
Posts: 237
Joined: Fri Jul 12, 2013 12:53 pm

Re: Slow redraw with complex assembly (assembly4)

Post by project4 »

DeepSOIC wrote: Mon Sep 07, 2020 7:38 pm
project4 wrote: Mon Sep 07, 2020 7:06 pm Build type: Unknown
If build type is actually "Debug", FreeCAD runs about 10 times slower than "Release" build. Make sure you are using a release build.
I prefer to use pre-built images, but had to build from sources to test a fix that wasn't yet available.
I followed default wiki instructions to build, don't remember I saw there any flags for release or debug build (wiki doesn't work now for me to check - bad gateway).
Can you tell what flags should I add to the build?
Thanks.
project4
Posts: 237
Joined: Fri Jul 12, 2013 12:53 pm

Re: Slow redraw with complex assembly (assembly4)

Post by project4 »

Thanks for the detailed answer!
DeepSOIC wrote: Mon Sep 07, 2020 7:33 pm * enable VBO for rendering (Edit->Preferences->Display)
That fixes the situation alot!
Don't know why I didn't enable it when checking the settings. Probably due to a long warning that it might cause bad things.
The 3D update is now much better, but the rotation is jumpy and less intuitive. Will check at home with my GeForce GTX 1060 card.
On current PC there is an old Intel internal graphics card, so I don't expect much. But even with that machine the interface is much more responsive and "workable".

There is still some hope for airbus assembly :lol:

The lags I see now are definitely computational and not related to graphics rendering.
When I click on a part in the tree view, it takes some time to the part appear selected in 3D view.
Hope to find the release compilation option and rebuild or move to pre-built images when the needed fix will be in.
DeepSOIC wrote: Mon Sep 07, 2020 7:33 pm * reduce tessellation accuracy (increase value of Deviation property (View tab) of displayed objects; you will have to force-recompute the project or save and reopen it to see the effect)
Can you give better instructions where I can find that option?
Where is the view tab? Can't find anything related in the preferences...

DeepSOIC wrote: Mon Sep 07, 2020 7:33 pm * turn off preselection highlight (Edit->Preferences->Display->Colors)
That helps a bit.
DeepSOIC wrote: Mon Sep 07, 2020 7:33 pm * use any navigation style other than Gesture (Gesture performs a hit-test to see if there is a dragger under cursor before starting a rotation, it can cause a noticable lag)
I'm with CAD navigation.
DeepSOIC wrote: Mon Sep 07, 2020 7:33 pm
project4 wrote: Mon Sep 07, 2020 7:06 pm but the parts are pretty complex, many holes, threads and so on.
Threads can be the killer, they are extremely resource demanding.
That's what I get from the STEP files.

Enabling VBO helps alot, so thanks for mentioning that!
User avatar
DeepSOIC
Veteran
Posts: 7896
Joined: Fri Aug 29, 2014 12:45 am
Location: used to be Saint-Petersburg, Russia

Re: Slow redraw with complex assembly (assembly4)

Post by DeepSOIC »

project4 wrote: Tue Sep 08, 2020 5:26 am I followed default wiki instructions to build, don't remember I saw there any flags for release or debug build (wiki doesn't work now for me to check - bad gateway).
Can you tell what flags should I add to the build?
Build type is set in cmake configuration. I'm not familiar with build process in linux. On windows, it can be changed in CMakeCache.txt file that is created in the build directory upon first cmake run.

Code: Select all

...
//No help, variable specified on the command line.
CMAKE_BUILD_TYPE:STRING=Debug //  <--  change to Release
...
For me, default is Debug. I don't know how it is for you.
project4
Posts: 237
Joined: Fri Jul 12, 2013 12:53 pm

Re: Slow redraw with complex assembly (assembly4)

Post by project4 »

DeepSOIC wrote: Tue Sep 08, 2020 11:13 am

Code: Select all

...
//No help, variable specified on the command line.
CMAKE_BUILD_TYPE:STRING=Debug //  <--  change to Release
...
For me, default is Debug. I don't know how it is for you.
Thanks. wiki working for me now and I found proper explanation how to compile for release.
Compiling now and will test it later
Post Reply