Hi, we have an issue while scrolling a LazyColumn....
# compose-android
m
Hi, we have an issue while scrolling a LazyColumn. It's reproducible in both debug and release mode. Minimum reproducible sample https://github.com/marcorighini/lazy-column-scroll-artefact. Video and screenshot attached. The issue is the following. With a background like 0xff020209 and items with background 0xff141416 while scrolling there are noticeable artefacts at the top and bottom edges of each cell, depending on the scrolling direction. It doesn't happen if there's more contrast between the background and the items.
plus1 1
👍 1
d
Do you feel the video yeilds the same results as in real life? Because it could be some compression issue on the video and in real life you'll see this on oled screens where it turns off pixels
m
It's way more visible when running on the device
d
Is it on a device with a variant of an OLED screen?
m
yes, they are amoled
d
Try it on a non-OLED display and see if it occurs, chances are that you are trying to debug a hardware limitation with software.
👆 1
OLED screens are poor going from a pixel off to something very dim.
r
In addition, displays sometimes (always these days?) use a form of framebuffer compression which can be tripped up by certain types of contrasts (I remember we were chasing a “jpeg artifact” on a live wallaper until we realized it was the framebuffer compression because of the particular shades of blue that were used)
😂 1
Or when I implemented hardware acceleration of the UI stack for the Motorola Xoom
My code was measuring at 60 fps but on screen it looked like 30… until I plugged in the tablet on a TV via HDMI and everything looked smooth
Turns out the color transitions were so slow (up to 100+ ms) for some colors that it created a kind of motion blur that looked like a low framerate
🤣 2
Anyway I don’t see an artifact in your video? At least when playing it back on my desktop monitor. So that would point to the hardware
Oh one more thing, this could be a perception problem like Mach bands and other fun optical “illusions” from the HVS
👍 1
p
@romainguy what type of panel does your monitor have? I can clearly see the artifacts in mine with an IPS panel 🤔
s
Are the artefacts the few off-colour pixels on the top-right you see in the screenshot? They were hard to spot in the video, but I can see them now (IPS panel)
r
@pepe IPS
@seb the almost empty battery indicator? 😄
s
I was just going to ask what they're referring to 😄
Cause yeah that looks like the battery dying 😄
And the blue bar looks like compression artefacts
m
It's a blurred band, similar to a shadow, that appears on top of each cell when you scroll up and at the bottom of the cell when you scroll down. In the screenshot is way less visible, but in mobile devices is evident.
s
Ok now that you point it out, and that I zoomed in enough, I can see it. It looks like motion blur, which it can't be 😄
I was looking at the screen edges, because I had misinterpreted the original message. It wasn't clear to me you were talking about item edges 🙂
m
You are right, I've edited the description 👍
💯 1
r
Looks like an opposite Mach band to me 🤷
(perception issue like I was referring to above)
s
But why would a perception issue be captured in a screenshot?
r
Because you are looking at the screenshot 😄
Perception issues are caused by specific stimuli, doesn’t matter if it’s from a screenshot or not
Here’s an example of a screenshot showing Mach bands:
Screenshot 2024-07-29 at 10.22.32 AM.png
The bright edge on the left and the dark edge on the right don’t exist in the data. It’s a pure smooth gradient
Another fun example, both sides are the same color (0x7f7f7f):
👀 1
(but a slight gradient in the middle makes you perceive two different colors)
One last one, all the small rectangles are exactly the same:
All this to say that our perception can get really broken by contrast modulation, and knowing how our rendering pipeline works this is the only reasonable explanation for the OP’s original issue
p
🤯 I was today years old when I learnt about this
r
I could go on. There are other fun effects that happen with chromatic colors, not just contrast/grays
(like the fact that brown doesn’t exist 😂)
I gave a talk on all of this to the Compose team, maybe I should give that talk publicly someday
🙏 1
💯 4
p
I was manipulating Marco’s screenshot and found out something I’m not sure how to interpret. This is a screenshot of the screenshot (😅) in which I zoomed in, modified the exposure and used a magnifier, bands are different size inside the magnifier, should they be the same size if it is a visual effect?
r
Did you upscale using nearest neighbor?
p
I used OS X Preview 😅 I’m not a graphics guy…
r
The original screenshot seems resized already anyway
s
Does Slack resize/recompress?
r
I’ll just run the project locally
🙏 1
p
I’m very intrigued, thanks for the extra effort Romain
r
Taking raw screenshots directly from a device shows 0 artifact at the pixel level
🦜 1
💯 1
At rest:
In motion:
Screenshot 2024-07-29 at 10.40.46 AM.png
💯 3
@pepe you might actually be interesting in the “Accessibility Zoom” section of that docs, and specifically “What to look out for”
👍 2
🙏 2
it tells you how you can zoom on anything on screen while preserving the original data
p
all clear, thanks a lot!
m
@romainguy thanks a lot for all these details 🙏 One last curiosity, do you know why in the original issue the effect happens just on the top edges or the bottom ones depending on the scrolling direction?
d
From my experience when it comes to OLED displays it is usually when a pixel goes from off to on, but this is just anecdotal. That means if you scroll down you would see it in the bottom of the container in your scenario.