f3d-app / f3d

Fast and minimalist 3D viewer.
https://f3d.app
BSD 3-Clause "New" or "Revised" License
2.73k stars 197 forks source link

Thumbnails generation on windows uses too much CPU #300

Closed astandarduser closed 1 year ago

astandarduser commented 2 years ago

Have just started using this software and it saves a whole lot of time finding things as an artist, just curious if there is a way to limit the CPU usage to around 70 percent when generating thumbnails?

mwestphal commented 2 years ago

Hi, are you using Windows or Linux ?

astandarduser commented 2 years ago

I am using Windows, there are also 4 instances of it running, although I installed it about 15 minutes ago

astandarduser commented 2 years ago

So even without opening a new folder where it 100 percent CPU usage, it's still using a significant amount of the CPU 13% * 3 instances so 39% when doing nothing. Seems very power hungry when it shouldn't be doing much. It's also been an hour or so of leaving it be

astandarduser commented 2 years ago

Update: after a restart it seems to be acting more like it should where the CPU use goes way down after a folder has thumbnails generated. But as mentioned in the topic it would still be good to put a limit on cpu usage when generating the thumbnails for the first time even though it will make it slower

mwestphal commented 2 years ago

Hum, did you open multiple file manager or only one ? Can you share a archive containing the file you were generating thumbnails from ?

I will try to reproduce.

Thanks,

mwestphal commented 2 years ago

Sounds more like a bug to me.

astandarduser commented 2 years ago

I think you could be right that I opened multiple explorer windows, now it generates them around 20 percent. I guess you can wipe this thread. Looking forward to further developments. Not sure if it's possible but would be amazing for maya ascii support , ztl, and 3dxml

mwestphal commented 2 years ago

I think you could be right that I opened multiple explorer windows, now it generates them around 20 percent. I guess you can wipe this thread.

I still think there is an issue here, I remember seeing some slowdown sometimes, so identifying it more cleanly is nice, and at least maybe we can do something to avoid using too much CPU and slowing down windows.

Not sure if it's possible but would be amazing for maya ascii support , ztl, and 3dxml

There is a dedicated issue for new file formats, coul you comment on it ? https://github.com/f3d-app/f3d/issues/38

Thanks !

astandarduser commented 2 years ago

Not sure how to vote on that but appreciate the link. And there are definitely bugs that need to be ironed out as it's currently using 20 percent CPU with no explorer windows open. Hope at some point they do as it's honestly going to save so much time when organizing and finding assets

mwestphal commented 2 years ago

Not sure how to vote on that but appreciate the link

You can just comment on the issue and I will add them in my top comment.

astandarduser commented 2 years ago

Should add, the software started going crazy in terms of CPU usage opening up constant instances in folders with lots of nrrd and dicom files and didn't open them particularly well anyways. Is there a way to stop f3d from doing this as I already removed these formats from the config but it still does the same thing when opening that folder. Also I have set a different application to be the default for those file types

astandarduser commented 2 years ago

My final thoughts on this, I tried another software called space-thumbnails which generated correct thumbs for everything including glb files which f3d doesn't support and it was much lighter on the system and had no cpu issues however it supports much fewer formats (needs fbx support) and is not a viewer. Will use it for thumbnails and f3d as a viewer for now until the cpu usage is ironed out. I'm not sure if looking at the code of that app will help but might be worth a look.

Keep up the amazing development, it's the fastest viewer I have found, also would be great to open two models at once and have them open in the same scene as some models are exported into parts, and some obj's do not open, or just show up as random tri's in a rough silhouette, but windows 3d viewer opens them fine just much slower. I'm happy to provide an example obj if needed but I assume you will have some that face this issue

mwestphal commented 2 years ago

Thanks for the feedback.

including glb files which f3d doesn't support

F3D does support glb files though :)

I'm happy to provide an example obj if needed but I assume you will have some that face this issue

Please do, in another issue preferentially.

astandarduser commented 2 years ago

Strange, glb's seem to not work completely for me. I will create a thread with 2 samples. And just so I'm not creating too many issue threads since it's still related to thumbnails, I installed space-thumbnails, and then f3d afterwards with the thumbnails option unchecked. However in every folder space-thumbnails didn't process f3d is generating thumbnails again

Meakk commented 2 years ago

Here is an interesting part in space-thumbnails documentation: https://github.com/EYHN/space-thumbnails#speed

Rendering thumbnails for 3D models may not be that fast. To keep your explorer smooth and available, we have made some limits here, if the model file size is larger than 300MB or takes longer than 5 seconds to load and render, it will be cancelled and display this image below.

@mwestphal I think we should have something similar in F3D

EDIT: Related code is here https://github.com/EYHN/space-thumbnails/blob/3b74705f476f1ecb4a5b6e08193dff04de1cfdcb/crates/windows/src/providers/thumbnail.rs#L95

astandarduser commented 2 years ago

I do prefer f3d's thumbnails as space-thumbnails seems to pick up strange colours for my stl files, grey shaded is honestly better and more consistent/readable if all 3d files are like that. Although space-thumbnails did load some of my fairly large model files just fine without any high cpu usage

mwestphal commented 2 years ago

@Meakk : Indeed, I think it was discussed but not implemented. Some investigation needed,

mwestphal commented 2 years ago

So a nice generic way to fix that would be to have a config file for thumbnail and to add a --max-size option in F3D. If size is bigger than max-size, just do not load it.

mwestphal commented 1 year ago

Will be adressed by #401

mwestphal commented 1 year ago

@astandarduser: This has been addressed, file bigger than 100MiB will not get thumbnails, so the experience should be much smoother. If the 100 MiB is too conservative, you can modify it in the new thumbnail specific configuration file.

If you think this is too conservative for all users, let us know, we may consider increasing it in the config file directly if needed.

We will most likely not implement a "max-loading-time" option as it is a bit more complex to do cleanly, will use more CPU than max-size when triggered for a pretty similar result.

I can provide a binary if you want to be able to test before the next release.

I'm closing this, feel free to reopen if needed :)

astandarduser commented 1 year ago

@astandarduser: This has been addressed, file bigger than 100MiB will not get thumbnails, so the experience should be much smoother. If the 100 MiB is too conservative, you can modify it in the new thumbnail specific configuration file.

If you think this is too conservative for all users, let us know, we may consider increasing it in the config file directly if needed.

We will most likely not implement a "max-loading-time" option as it is a bit more complex to do cleanly, will use more CPU than max-size when triggered for a pretty similar result.

I can provide a binary if you want to be able to test before the next release.

I'm closing this, feel free to reopen if needed :)

Awesome, looking forward to testing. And I'll wait for the release as I've been pretty busy lately