-
-
Notifications
You must be signed in to change notification settings - Fork 35.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CSS3DRenderer offset for Safari on High DPI displays with odd resolution #19854
Comments
Confirm and reproduced the problem on my iPhoneX too. |
That is very interesting, thanks a lot for pointing it out! I somehow missed that example. Maybe there is a precision problem for handling matrix3d css stacks that is even more apparent for my example (since it is scaled by a factor of 100). I will try to expose the difference that creates the very visible problem in my example. |
I was able to check the example @yomotsu posted with an iPhoneX and the offset also happens there. So I guess it is safe to say that the problem does exist (since I built my example without knowing of the other example) and it is a device specific limitation for iPhone X (and maybe newer, sadly I don't have a newer iOS device at hand). |
I was able to reproduce the problem on an iPhone 11 Pro as well. Could this have something to do with the notch / Rounded corners? I am already using the cover meta tag to avoid such problems, but it's really strange that the problem starts to appear on iOS devices with a notch... |
I've seen similar issues in the past and I think the issue was something like not being able to match CSS's perspective code with the current |
FWIW, on Safari on my iMac, showing the favorites bar causes a similar offset artifact (refresh required). It also occurs with page zoom not equal to 100%. |
Hm, I think that might be a different issue, I built a repro with a orthographic camera, which shows the same problem.
Interesting, thanks for pointing it out. I dug a bit deeper, and I get the same issue when using a MacBook connected to a high DPI monitor with scaling set to the smallest value (might be needed just to get to a higher css resolution). As for zooming, that might be connected to this issue (Repro), which was fixed in every browser except safari. Anyways, I think I might have a lead on how to fix the problem: If that is the case and the fix is to handle the transform values differently in the camera on safari, where would I need to put the user agent read to validate if the browser is safari? Should I put that in the Camera code, or somewhere else? |
On your orhto example, with Safari on iMac, resizing the window vertically only or horizontally only is illustrative. Maybe try _widthHalf = Math.round( _width / 2 );
_heightHalf = Math.round( _height / 2 ); Just a guess. |
Yep, that does it for safari So we will need to implement a check for safari (similar to what is done for ie) and use rounded values there. Update: Nope, for the perspective camera, I will need to dig a bit deeper 😣 |
Okay, so I fixed the orthographic problem, sadly it seems that it does not have too much to do with the perspective problem other than having problems with odd resolutions. I made a playground branch with a perspective and orthographic css scene which show the problem quite well: The problem that still exists now is: CSS rendering for safari with odd width and or height. In that case the css looks like it is pushed away a bit from the camera: When rotating the camera orthogonal to the plane, the plane offsets in interesting ways: https://www.youtube.com/watch?v=5YeipB0ZKGs This is not a translation problem anymore. Has anybody any idea how to tackle that one? Maybe perspective or scaling at some point? |
@mrdoob my PR sadly only fixed the problem for the orthographic camera, but not the perspective camera. Should I open another issue for that, or should we keep that one open? |
I've encountered similar problems on a past product. The "page zoom" controls also affect these transforms. We ended up setting preferred min-zoom/max-zoom in the CSS to mitigate problems.. |
This needs to be fixed in Webkit: https://bugs.webkit.org/show_bug.cgi?id=215590 |
This issue beset me too, I debug a few hours. The result I've come to is this, you need set canvas width/height as even number at first, and set css3DObject's element width/height as even number too. The code maybe like this:
|
Description of the problem
When combining a webgl renderer with a cssrenderer (by punching holes through the webgl renderer to show the css renderer below, there is sometimes a missmatch between the renderers. It looks as if the cssRenderer has a slight offset compared to the webglrenderer. Interestingly enough, this happens on iPhoneX, but not iPhoneSE or iPad Mini4 and also not on android and desktop. Not sure about newer iPhones. The problem is especially present when looking at the css area at a very shallow angle.
The problem is not bound to the css object present (also tried it with a simple
).


There should be no white area around the youtube video:
Video
Three.js version
Browser
OS
Hardware Requirements (graphics card, VR Device, ...)
The text was updated successfully, but these errors were encountered: