You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I found an issue with using textures from external URLs, when you spawn a texture of this type the game fps lower a lot until the texture is loaded, this doesn't happen with normal local textures
I'm only speculating but could this be happening because internally the call to the URL is making other processes of the engine wait?
Here is a simple example to replicate it
letindex=0for(leti=0;i<10;i++){for(letj=0;j<5;j++){constentity=engine.addEntity()Transform.create(entity,{position: Vector3.create(1+i*1.2,0.5+j*1.2,1)})MeshRenderer.setPlane(entity)//Creating a material from an external url causes the game to stop until the image is loadedMaterial.setPbrMaterial(entity,{texture: Material.Texture.Common({src:"https://storage.lowpoly3d.com/avatargarden/RendersChar_"+(index)+".png",}),transparencyMode: MaterialTransparencyMode.MTM_ALPHA_TEST})index++;}}
And here is an example with a 1 second delay between create material calls, you can see the game totally collapsing every 1 second the call to get the external texture is made
import{Vector3}from'@dcl/sdk/math'import{Entity,Material,MaterialTransparencyMode,MeshRenderer,Transform,engine}from'@dcl/sdk/ecs'import*asDclTimersfrom'@dcl-sdk/utils/dist/timer'letindex=0for(leti=0;i<10;i++){for(letj=0;j<5;j++){constentity=engine.addEntity()Transform.create(entity,{position: Vector3.create(1+i*1.2,0.5+j*1.2,1)})MeshRenderer.setPlane(entity)constconstantIndex=indexDclTimers.timers.setTimeout(()=>{//Creating a material from an external url causes the game to stop until the image is loadedcreateMaterial(entity,constantIndex)},1000*index)index++;}}functioncreateMaterial(entity: Entity,index: number){Material.setPbrMaterial(entity,{texture: Material.Texture.Common({src:"https://storage.lowpoly3d.com/avatargarden/RendersChar_"+(index)+".png",}),transparencyMode: MaterialTransparencyMode.MTM_ALPHA_TEST})}
SDK:
SDK6
[ x] SDK7
The text was updated successfully, but these errors were encountered:
Issue Description:
Reported by Picazzo on Discord
Hi, I found an issue with using textures from external URLs, when you spawn a texture of this type the game fps lower a lot until the texture is loaded, this doesn't happen with normal local textures
I'm only speculating but could this be happening because internally the call to the URL is making other processes of the engine wait?
Here is a simple example to replicate it
And here is an example with a 1 second delay between create material calls, you can see the game totally collapsing every 1 second the call to get the external texture is made
SDK:
The text was updated successfully, but these errors were encountered: