Scrolling a Texture Instance invalidates lightgrid, causing massive cpu cost on mobile

Hi,
I’m currently heavily benchmarking performance on an iphone 6s.

I was trying to isolate why my lightgrid was getting heavily invalidated every single frame, costing a huge chunk of cpu on this older phone.

There were no moving objects or lights in my (quite large) scene, so I couldn’t figure out why it was invalidating every single frame.

What it turned out to be was I had a few scrolling water surfaces.


You know, this kind of thing. The part is anchored, mostly transparent, and doesn’t cast shadows.

image

And I was scrolling the texture every frame in heartbeat by doing this:

If I disable this, the thrashing goes away.

If you fix this, this would help just about every game ever. Scrolling textures should not invalidate the lighting cache.

Expected behavior

Scrolling a texture shouldn’t invalidate the lighting cache.

14 Likes

Great find @MrChickenRocket ! Would you be able to provide a sample .rbxl we can use to debug this? Thanks!

2 Likes

lightGrid.rbxl (54.0 KB)

2 Likes

The light cache system seems to be very cpu aggressive now, especially for phones.

It seems very easy for phones to get “stuck” doing 4-8ms of lighting updates every single frame, from having moving parts from things like windshake, or pets, or other ambient instances moving around.

An extra 8ms per frame of 100% cpu usage causes my iphone 6s to absolutely cook itself, which is what tipped me off to there being a problem in the first place.

Would it be possible for the light grid system to slow down and be a bit more conservative with cpu? Maybe a few frame cooldown on things?

2 Likes

There were a bunch of lighting changes from V624+, so it makes sense.

Decouples lighting updates from frame time.

(624)

Adds lighting update optimizations.

(627)

Slightly increased throughput of lighting updates per frame

(629)

Just noting that these changes aren’t turned on yet from our end as of today. This behavior as far as I can tell is the long term behavior.

3 Likes

I am glad somebody reported this, I am experiencing the same issue with every single game on my Samsung Galaxy M12 phone. This is taking a lot of frame time and is causing huge fps loss.

microprofile-20240808-211552.html (838.0 KB)

1 Like

Any updates on this one? Would love to get it fixed :slight_smile:

1 Like