New issue
Advanced search Search tips

Issue 799823 link

Starred by 2 users

Issue metadata

Status: Untriaged
Owner: ----
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Chrome
Pri: 2
Type: Bug



Sign in to add a comment

3D transforms glitching to death

Reported by trusktr@gmail.com, Jan 8 2018

Issue description

UserAgent: Mozilla/5.0 (X11; CrOS x86_64 10032.75.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.116 Safari/537.36
Platform: 10032.75.0 (Official Build) stable-channel caroline

Example URL:
https://codepen.io/anon/pen/XVVXXj

Steps to reproduce the problem:
1. Open the URL
2. Observe heavy flickering.
3. Try resizing the code editor to observe flickering outside of the example.

What is the expected behavior?
There should be no flickering. The drawing should be smooth.

What went wrong?
The drawing flickers not only inside of the iFrame, but it causes the entire Codepen site to flicker. This bug leaks outside of the iframe that contains the drawing and affects rendering of the whole page.

Does it occur on multiple sites: Yes

Is it a problem with a plugin? No 

Did this work before? N/A 

Does this work in other browsers? N/A

Chrome version: 63.0.3239.116  Channel: n/a
OS Version: 10032.75.0
Flash Version: 

Sorry that I can't provide a smaller reproduction. It only happened when I was making precisely this.

It is rendered entirely with CSS 3D transforms, no WebGL, just plain DOM.

To debug this more easily, you can disable line 13 in the JS editor section. This will disable the rotation, so that the image will be a static DOM and you can inspect it.

While rotation is disabled, you can try resizing the example area which will trigger the glitches.

Notice that when you resize the example, and since rotation is disabled to refresh the browser's paint, you can stop resizing and leave the whole codepen page in it's glitched state.

The DOM elements are circles (made with border-radius). The i-scene and i-node elements are for all intents and purposes essentially styled to behave like DIV elements, and they have transform-style:preserve-3d.

Inside i-scene elements is a shadow root that has a DIV element that has overflow:hidden. This is what makes an i-scene element contain it's "scene" (clip it's content).

I am able to reproduce the glitches on both Chrome OS and macOS. There seems to be a higher chance of triggering glitches when the window is maximized.

Here's another pen with the rotation offset of 30 removed (line 13 in the HTML) which shows that the glitching goes away:

https://codepen.io/anon/pen/OzzMxG

The rotation="0 30 0" eventually gets applied to the DOM element as CSS transform:rotateY(30deg) but via transform:matrix3d().

Both i-scene elements have overflow:hidden to contain their scenes. So what's happening when the rotation is enabled is that the outer scene element is supposed to be effectively rotating the inner scene as an image, so the content in the inside of the inner i-scene is effectively like a texture (or so I'd hope, but it's CSS3D, so we are not supposed to know what it's doing :) ).

If I remove the inner scene, I can effectively disable the inner scene from being a "texture", and the problem goes away!!! For example, here's the original scene but with the inner scene removed:

https://codepen.io/anon/pen/KZZVoV

Now there is only a single i-scene with overflow:hidden. I have a feeling the bug has to do with this. Although this version works, the framerate drops considerably on mobile because world transforms are being re-calculated for every element, whereas the version with the nested i-scene results in only a single world transform being re-calculated for the inner "texture". At least, this is what I'm guessing, and it seems like it'd make sense, but I haven't look at Chrome's source regarding this.
 

Comment 1 by trusktr@gmail.com, Jan 8 2018

If I find more clues, I'll post back as I keep playing with more examples.

Comment 2 by tkent@chromium.org, Jan 9 2018

Components: -Blink Blink>Compositing>Transform3D
Components: -Blink>Compositing>Transform3D Internals>GPU
On my linux machine this example has such a low frame rate it is impossible to work with.

On windows I don't see any flickering.

The page has a huge number of graphics layers and mask layers due to the hundreds of border-radius elements at the bottom the hierarchy, every one of which has a transform. I'm honestly surprised we manage to render it at all.

Flickering is probably related to GPU resources. Moving to GPU component to see if there's anything that can be done.

Comment 4 by piman@chromium.org, Jan 19 2018

Cc: ericrk@chromium.org
Components: -Internals>GPU Internals>Compositing
Status: Available (was: Unconfirmed)
Repro on link, but only when full-screen. Reducing resolution seems to reduce the issue.
Uses >550MB of GPU memory. We might be running into limits. Not sure what we can do TBH.

Comment 5 by trusktr@gmail.com, Jan 20 2018

Even if memory is hitting limits, there's still the filesystem.

The graphic is so simple and we've all seen WebGL demos that are much more complex, so it doesn't seem like it has to hit any memory limits.

An obvious optimization for the browser is to generate a single texture from the inner i-scene element because it has overflow:hidden and the whole element is being rotated while everything inside the i-scene is not being animated.

At worst, the frame rate could drop, but there shouldn't be any incorrect visuals.

---

Here's two new pens, where both are optimized with `v-once` on the nested inner i-scene so that any Vue performance problems are out of the way. Vue will only render that part of the DOM once, and the animated rotation will be applied only to the element that contains the inner i-scene. Both demos have the same CSS perspective applied to the inner i-scene, and content inside the inner i-scene of both demos is transformed with the same 3D transforms (Z translation):

The first demo is buttery smooth at 60fps:

https://codepen.io/anon/pen/EorxLx

Here's the second pen where the only difference is on line 10, modified so that the inner i-scene's content is all rotated by 30deg on X and Y, and the problem is triggered:

https://codepen.io/anon/pen/mpvdLw

Both scenes are 3D scenes. Nonetheless, we'd think that the inner i-scene's whole content would be rotated as if it were a single texture and intuitively expect that the second example would be as fast and smooth as the first demo and without glitches.
Project Member

Comment 6 by sheriffbot@chromium.org, Yesterday (46 hours ago)

Labels: Hotlist-Recharge-Cold
Status: Untriaged (was: Available)
This issue has been Available for over a year. If it's no longer important or seems unlikely to be fixed, please consider closing it out. If it is important, please re-triage the issue.

Sorry for the inconvenience if the bug really should have been left as Available.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot

Comment 7 by 2023bber...@s.marshallowls.com, Today (21 hours ago)

This bug still exists to this day. I know because I saw an r/softwaregore post of Discord glitching like crazy, like something out of a Wii BIOS corruptions video. If you aren't aware, like other desktop apps such as Visual Studio Code, Discord for Windows uses Google Chrome's browsing engine (Gecko.) It's litterally just Chrome, but with a few features enabled/disabled and running in a borderless window. That being said, if the latest version of Discord's engine has this glitch, so does Chrome.

Comment 8 by 2023bber...@s.marshallowls.com, Today (21 hours ago)

Edit: Wrong glitch, apologies.

Sign in to add a comment