DynamicTexture performance drops over time


I’m trying to implement a “fog of war” feature for my game.
I found I nice playground example: credit for aWeirdo.

Initially it runs fine, but the fps starts to drop after running the example for a couple of minutes.
After around 10 mins it runs only 30 fps.

Do you have an idea what can cause the performance drop?

Here is the playground example: https://playground.babylonjs.com/#S3U25D#3


Hi hi! I’m having mine run in the background to see, but I haven’t gotten a frame drop yet (about 10 min now) Not sure what’s up though I’ll keep running it to see.


I think it has to be in the foreground unfortunately for all those minutes, because if the scene is in the background (or a window covers it) webgl pauses.

Got it! Will test again.

1 Like

Just a shot in the dark. But removing this line seemed to remove the slow down initial.


Initial lag started at about 3 and a half min. It’s gone for the double that without a problem. Can run for longer.

Edit: But ya it’s still dropping after the fact.


Thanks a lot!

I ran it for ~15 mins now and it seems to be good after your fix. (stays at 60 fps).
I looked it up what that save means, and it is really unnecessary here.

1 Like

It was dropping way after I think. (though I’m also running an expensive program on the side which isn’t helping my overall PC at the moment :stuck_out_tongue: )

If you continue to see stuff I think best is to remove unnecessary calls like that… :wink: