Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Model Loading time issue. #400

Closed
AnandDixit27 opened this issue Apr 9, 2019 · 28 comments
Closed

Model Loading time issue. #400

AnandDixit27 opened this issue Apr 9, 2019 · 28 comments

Comments

@AnandDixit27
Copy link

AnandDixit27 commented Apr 9, 2019

I have integrated latest unity GLTF plugin with my project. The plugin seems to load the models really slowly.
With current scenario
model size 66 MB
and it takes approx 30 to 31 sec to load in my android device having configuration
Octa core Max 1.40GHz with 2GB RAM and Android Version 6.0.1.

Please see in screenshot.
Screenshot_2019-04-09-19-16-19-119_com Mobiliya GLTFLoader

As you can see time to load a model is 30 secs.

is there any way by which the load times can be reduced? some help will be much appreciated.

@Rathod1806
Copy link

Does anyone got through this? It takes painfully long to load relatively small models with not much geometry on them.

@kunaldas103
Copy link

Facing a similar kind of issue, kindly help if someone can help with reduction of loading time.

@blgrossMS
Copy link

blgrossMS commented Apr 12, 2019

Hi Rathod!

A couple of things to check:

  1. Are you on latest version?
  2. Is multithreading enabled?
  3. Try setting the BudgetPerFrameInSeconds in AsyncCoroutineHelper for your object to a higher amount, this will make it so it will not skip frames between loading components (this is to prevent hitches in real time loading)

@AnandDixit27
Copy link
Author

Hi,
Thanks for your response.
But unfortunately I already have done these steps and came to optimized it up to 30 sec loading time. But how can we get lower load time than this? Please help me figure this out.

@boblaublaw
Copy link

I'm also in the same boat. Very long model load times.

@AnandDixit27 how long does your model take using Don McCurdy's javascript gltf viewer?

@blgrossMS
Copy link

@AnandDixit27 if you can, can you share a model so that we can analyze it? Those speeds are much slower than expected and what I see in practice with the viewer.

@AnandDixit27
Copy link
Author

I'm also in the same boat. Very long model load times.

@AnandDixit27 how long does your model take using Don McCurdy's javascript gltf viewer?

I have tried to open my model on given link in mobile browser in chrome and also in MI browser but unable to open it.

Screenshot_2019-04-15-13-04-09-315_com android browser
Screenshot_2019-04-15-13-06-25-854_com android chrome

@AnandDixit27
Copy link
Author

@AnandDixit27 if you can, can you share a model so that we can analyze it? Those speeds are much slower than expected and what I see in practice with the viewer.

I am attaching a test model. It takes a second to load it in unity editor. But on device it takes 30 sec to load.

https://drive.google.com/open?id=1zxj0GR92fi2C4AtuAWtqpJVc3W4d_ird

@avpn989
Copy link

avpn989 commented Apr 15, 2019

I am also facing the same issue.

@AnandDixit27
Copy link
Author

@blgrossMS Did you try with the model given to you? We need to optimize it for mobile devices.

@tulika264
Copy link

I am also facing the same loading time issue while loading models.

@icegibbon
Copy link

Have you tried testing with reduced texture sizes. I mean, make them extremely small. Could be the downloading, or the texture upload to the GPU. Those 3000x3000 textures take up 300030004 bytes in memory, and that is is decompressed from the png, put in CPU memory, the uploaded to GPU memory.

@AnandDixit27
Copy link
Author

@blgrossMS Please help me how will i solve this. I already had shared model with you.

#400 (comment)

@blgrossMS
Copy link

blgrossMS commented Apr 18, 2019 via email

@AnandDixit27
Copy link
Author

AnandDixit27 commented Apr 24, 2019

Hi Anand, will try to take a look this weekend. One regression we believe we have found is the new Asyncoroutinehelper is taking one more frame than it should to delay by. Get Outlook for Androidhttps://aka.ms/ghei36

Hi
@blgrossMS Could you worked on this weekend? I am waiting for your response. I need to complete it urgently, so please help me to solve it as soon as possible.

@AdamMitchell-ms
Copy link
Contributor

Hey @AnandDixit27 ,

@rferrese has a proposed performance fix here.
rferrese@9b2e963

I think it's a good fix. I'm testing it now with a few different models. If everything looks good, I'll send out a pull request today or tomorrow. You can use his fork to unblock yourself until then.

@NoobCoder8080
Copy link

Hey @AdamMitchell-ms

I have read all the comments and just used the fix that you have provided. I am trying to load a 72mb model on iPhone 8s. It takes a lot of time to load (45s).

Any suggestions on how can I reduce it?

@AdamMitchell-ms
Copy link
Contributor

@NoobCoder8080

Pull #414 just went in, and it does fix a loading time regression that was introduced a few weeks or months ago. It sounds like there may be an additional issue that is not addressed by that change.

You could try increasing the frame budget to improve the loading time. To do this, attach an AsyncCoroutineHelper component onto the same scene node that has the GLTFComponent attached and set the BudgetPerFrameInSeconds to something higher. For mobile, it's reasonable to set it to 0.03 or even higher values depending on what framerate you want to maintain during loading.

If you're still having problems, you could attach an example file to this thread so we can take a look.

@AnandDixit27
Copy link
Author

Hey @AdamMitchell-ms
Thanks for helping me to reduce the model loading time issue. Sure after making changes in AsyncCoroutineHelper class as mentioned above the loading time is reduced upto half of the time.
But i want to reduce it more upto few seconds.
Because as per the industry needs i want to load the model of size 60 to 70MB in just max to max 6 to 8 sec.

So any suggestion how can i reduce it upto this.

@AnandDixit27
Copy link
Author

Hey @AdamMitchell-ms
Thanks for helping me to reduce the model loading time issue. Sure after making changes in AsyncCoroutineHelper class as mentioned above the loading time is reduced upto half of the time.
But i want to reduce it more upto few seconds.
Because as per the industry needs i want to load the model of size 60 to 70MB in just max to max 6 to 8 sec.

So any suggestion how can i reduce it upto this.

I am waiting for your reply. Please help me to solve it.

@rferrese
Copy link
Contributor

rferrese commented May 7, 2019

Hi @AnandDixit27
I saw that you mentioned that it only takes a second to load in editor, but takes a long time to load on device. Is this correct? How long does it load if you set the BudgetPerFrameInSeconds extremely high, like 1.0?

What is the baseline framerate of your app on mobile when you expect to load the model? (What is the framerate of your app when the model is not loading)

@AnandDixit27
Copy link
Author

Hi @AnandDixit27
I saw that you mentioned that it only takes a second to load in editor, but takes a long time to load on device. Is this correct? How long does it load if you set the BudgetPerFrameInSeconds extremely high, like 1.0?

What is the baseline framerate of your app on mobile when you expect to load the model? (What is the framerate of your app when the model is not loading)

Hey @rferrese
Yes it is correct it takes only 0.5 to 1 sec to load in unity editor. App baseline framerate is 60fps. And i am approximately getting the same framerate while loading just on initial few frames it reduces to 1 or 2 fps otherwise on whole loading it matches to 60fps. But still it takes 20 to 25sec to load the model depend on device configuration.

@AdamMitchell-ms
Copy link
Contributor

Yes, there is definitely still a big loading performance issue here. I've tracked it down to the fact that in AsyncCoroutineHelper, when we waitForEndOfFrame and set the new timeout, sometimes that timeout has already expired by the time YieldOnTimeout has completed its Task.Delay(1).

I have an experimental/hacky fix on my branch here.
https://github.com/KhronosGroup/UnityGLTF/tree/u/adam/loading-perf

On some models on desktop, I'm seeing a ~5x reduction on loading time. This is not a proper fix though. I'm still investigating.

@AnandDixit27 , does my branch give you improved loading times?

@AnandDixit27
Copy link
Author

Yes, there is definitely still a big loading performance issue here. I've tracked it down to the fact that in AsyncCoroutineHelper, when we waitForEndOfFrame and set the new timeout, sometimes that timeout has already expired by the time YieldOnTimeout has completed its Task.Delay(1).

I have an experimental/hacky fix on my branch here.
https://github.com/KhronosGroup/UnityGLTF/tree/u/adam/loading-perf

On some models on desktop, I'm seeing a ~5x reduction on loading time. This is not a proper fix though. I'm still investigating.

@AnandDixit27 , does my branch give you improved loading times?

Hey @AdamMitchell-ms,
I had implemented code change done by you on AsyncCoroutineHelper and come up that loading time reduces to upto 20 to 23 seconds on both android and ios devices see the screenshot. You got time reduction on desktop but still have issue in devices. I want to reduce it to 5 to 7 secs in mobile device according to industry need.

Iphone 6 Loading time is 23sec
IMG_0558

Iphone 8 Loading time is 20sec.
IMG_0306

Android Samsung galaxy Note 5 loading time is 21sec.
Screenshot_20190513-190940

@rferrese
Copy link
Contributor

@AnandDixit27

I tested out Spreader.GLB on an iPhone 8 with the BudgetPerFrameInSeconds set to 0.04. I estimate that the load time was ~1 second (I didn't add a load time counter, just watched it). I loaded the model from the device (so no networking time).

In these tests what are your values for:

  • BudgetPerFrameInSeconds
  • Multithreaded

Also, how are you loading the stream? Is it from disk directly or using the WebServerComponent that is shipped with the GLTF addon?

If you want to post the pictured GLB, I can test it as well.

@AnandDixit27
Copy link
Author

AnandDixit27 commented May 17, 2019

@AnandDixit27

I tested out Spreader.GLB on an iPhone 8 with the BudgetPerFrameInSeconds set to 0.04. I estimate that the load time was ~1 second (I didn't add a load time counter, just watched it). I loaded the model from the device (so no networking time).

In these tests what are your values for:

  • BudgetPerFrameInSeconds
  • Multithreaded

Also, how are you loading the stream? Is it from disk directly or using the WebServerComponent that is shipped with the GLTF addon?

If you want to post the pictured GLB, I can test it as well.

@rferrese
I had tested with .gltf files for loading a model locally from device. But since you are saying let me try with GLB format on devices.

@waseemkhan1989
Copy link

@AnandDixit27 How did you record the loading time? I would like to estimate the loading time in two steps as follows:

  1. To downloading a glb file from remote server to a local location(on hard drive on a local computer)

  2. And the time it takes to import glb file from this local location into the scene

I would like to record these timings on Quest(Android). I would like to know the exact location where I should start and stop the timer. Could you please help?

@pfcDorn
Copy link
Contributor

pfcDorn commented Feb 9, 2024

Please update to the latest version and open a new issue if the problem persists. Thanks!

@pfcDorn pfcDorn closed this as completed Feb 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests