Forum

Avoid hiccups when executing other functions

09 November 2015 11:24 #4854
Yes my app has become CPU-greedy at this point
Here you go CPU profile
09 November 2015 18:01 #4858
I've explored the profile and found that there are 3 ponderous factors/places:

1) Having many dynamic objects leads to a massive preparations before rendering: frustum culling tests, sending data to GPU and so on. It affects fps all the time, even without any user input.

2) Outlining on hover is a heavy but practically scene-independent operation. So it doesn't matter how many objects are on the scene. It happens when you perform mouse moving or clicking.

3) Anonymous function from app_logic_fms.js:1204. I cannot see what's in it. But it seems that it's called approximately 1 time per sec. and it takes a big amount of time.




If hiccups occur all the time then the main reason is too many dynamic objects. It also depends on the camera clipping distance, so you can tune up the clip_end value for the camera to maximize frustum culling and minimize rendering cost.

If hiccups occur only after mouse moving/clicking then it rather be the outlining functionality which slows down the app work.
Blend4Web Team
09 November 2015 18:26 #4859
I've tried to reproduce this lag by using many dynamic objects loaded from the separate .json file, each one is outlineable. Nevertheless fps is normal for me: 110 when idle, 70 when moving the mouse.

I've attached an example (it takes about 20-30 sec. to load all the objects).
Blend4Web Team
09 November 2015 18:32 #4860

1) Having many dynamic objects leads to a massive preparations before rendering: frustum culling tests, sending data to GPU and so on. It affects fps all the time, even without any user input.
Yes I saw this on FPS drop. Sadly I can't reduce the number of dyn objects.

If hiccups occur all the time then the main reason is too many dynamic objects. It also depends on the camera clipping distance, so you can tune up the clip_end value for the camera to maximize frustum culling and minimize rendering cost.
Reducing end distance for clipping is not a solution for me as I need to see the entire scene (not all the objects, but the structure at least). I am thinking about hiding/showing distant objects to perform a custom "CPU culling" fix. Is there a way to hide a dynamic object so that it's not updated at each frame when not visible? I mean is there a way to skip all those preparations before rendering for an object? Hiding it via scenes.hide_object() would do the trick?
Thanks, thanks, thanks!
09 November 2015 18:49 #4861

Is there a way to hide a dynamic object so that it's not updated at each frame when not visible? I mean is there a way to skip all those preparations before rendering for an object? Hiding it via scenes.hide_object() would do the trick?
Yes, but it can also be solved through the LOD system by adding an EMPTY object to the end of the stack.
Blend4Web Team
09 November 2015 18:59 #4862
These objects are loaded through multiple data.load calls. I tried to load just one object and then duplicating it but the duplication worked only for the parent, not the children. I didn't find another way to load all these objects in an efficient way.

But you can link them into the main scene in Blender. What are the reasons for having them loaded from another scene? Are they placed randomly or depending on some conditions?
Blend4Web Team
10 November 2015 13:02 #4879

Yes, but it can also be solved through the LOD system by adding an EMPTY object to the end of the stack.
Effectively I didn't think about this solution, will definitely try it!

But you can link them into the main scene in Blender. What are the reasons for having them loaded from another scene? Are they placed randomly or depending on some conditions?
Probably I will refactor the scene to link all possible objects to main scene

Thanks
 
Please register or log in to leave a reply.