Hello,
i’m creating around 25 2d targets and linking them with 3d meshes to position them following the 3d coordinates.
I’m using AdvancedDynamicTexture with a Button added to its control and i’ve linked the button to the corresponding mesh using the method “linkWithMesh()”
On chrome it works great, but it drastically lowers the FPS with Safari and Firefox (it drops around 5-10 FPS, while without calling that method it’s over 200 FPS).
Did someone encounter this problem using linkWithMesh method?
Do you know by any chance what could higher the FPS without removing it or using an alternative way?
I tried insert some optimization to the scene →
this.scene.blockMaterialDirtyMechanism = true;
this.scene.autoClear = false;
this.scene.autoClearDepthAndStencil = false;
this.engine.setHardwareScalingLevel(1);
but they don’t affect the performance, only removing linkwithmesh it starts reacting in the correct way.
I need to bring outside of the for cycle (in my original case, a Class) line 180 and 181 (AdvancedDynamicTexture), cause otherwise it will create 23 (number of targets) layers of UI, is that correct?
I misunderstood the functionality of that element and thought it was necessary to associate a new one to every buttons.
If you have any other suggestion or consideration, feel free to share them with me
Haha see? This is exactly why we ask for repro in the PG
YOu are totally right: you only need one ADT (it is responsible for the optimizations and cache)
You’re absolutely right, it does tank performance on Firefox and significantly reduces performance on other browsers.
I’ve recorded a video with the playground you posted, but I’ve modified it (the ADT is outside the for loop). This is the playground I was using for the recording: https://playground.babylonjs.com/#DQKYG5#2
In the video I ran the playground on both Firefox and Chrome. Both with and without linkWithMesh commented. In my current freelance project I’m experiencing the same issue, but due to the complexity of my scene fps on Firefox tanks to 10fps, while Chrome is a stable 40fps.
Because I’m using a gaming laptop (Windows 10) for this recording I’m looking into the absolute FPS in the inspector. The results are as follows:
Firefox_linkToMeshEnabled - 80-83 absolute fps (bottom right corner states 35-45fps)