Applying texture to material in realtime is SLOW

Hi

    MaterialLoader.textureAssets[name].once("load", function () {
        MaterialLoader.materials[name].resource.emissiveMap= MaterialLoader.textureAssets[name].resource;
        MaterialLoader.materials[name].resource.update();
    });

That code increases deltaTime from 0.01s to 0.1s on each entity for 0.3s, so it’s reaaaally noticeable.

Is there a way to do it in another thread or something…?

Just a quick question, is the texture image already preloaded? Do you have a sample project to show this issue?

Yes, there is preloaded 3kb 64x32 image, i change it to 809kb 4096x2048 image.
Created sample for you - https://playcanvas.com/project/473358/overview/360-sample
Open console to see log

Ah, you may ask about texture i change to and not about presence of any.

I change it to unpreloaded 809kb 4096x2048 texture.

Oh I see, you are talking about performance. More of a question for @max. Sorry, I thought you were talking about download speeds :sweat_smile:

No problem, you tried to help :3
That’s good :smile:

You might want to keep an eye on this issue: