Closed Jacowaco closed 6 years ago
This is for Starling 2.0, i didn't have that lag in 1.8.x
Hm ... that this will become slow is not surprising: a glow filter requires several passes, and having it on so many objects will be very expensive.
However, the number of draw calls of this scene is the same in Starling 1.8 and 2.0 (both need 200). So performance should be roughly the same. Are you sure that the equal scene is becoming so much slower in Starling 2? Have you tried the sample from above in both versions, on the same hardware + release mode?
The same example with Starling 1.8.x changing only the GlowFilter line for: img.filter = BlurFilter.createGlow(0x0000ff, 1, 1, 1); Doesn't lag at all, runs at 60 fps
Starling 1.8: 102 draw calls, 60fps Starling 2.0: 96 draw calls, 50fps
This is a example i made to ilustrate the lag, but in my game i only have 9 items with glow (not 50), and the moving animation lags too, maybe because they are larger images than the one i tried in this example.
That's interesting! Definitely something I want to analyze. I'm starting a vacation soon, so it might take a little longer; but I'll get back to you as soon as I know more.
BTW, which device did you test on? And, the usual question: are you sure you used release mode? It would also help to look at a Scout analysis of both versions; does anything interesting pop up?
I tested on PC Desktop. In release mode the fps don't drop but the animation looks more lagged than in 1.8, even though the fps are mantained.
Okay, thanks! I'll have a look at what Scout says when I'm back from my vacation.
I had the same problem and I use filter.cache() as a workaround. Note that cache() has many special traits and might not work in your particular case.
Since this issue was opened, I made numerous optimizations on the FragmentFilter class, so it's about as fast as I can manage to get it. Thus, I'm closing this issue now.
I was experiencing lag with the GlowFilter in my game's menu so i tried to made an example to reproduce it. In this case i apply a glow filter to many images, when they dont move, everything works fine, but when they move, the fps drop and the draw count increases a lot.