-
-
Notifications
You must be signed in to change notification settings - Fork 35.4k
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
CSS objects get pixelated when using CSS3DRenderer with PerspectiveCamera #17641
Comments
On macOS Chrome, this improves the quality a lot: const svgSize = {
x: 16,
y: 16
}; However, on macOS Safari, both renderings are blurry. It would be nice to know if this issue is svg-specific. @mrdoob Was |
FYI: Once you apply CSS-Transform3D, the element will be rasterized at the initial size, and not a vector image anymore, because of GPU-acceleration. |
What @yomotsu said. I don't think there is much we can do here. |
Except this is not true, at least not for every CSS-Transform3D: "Once you apply CSS-Transform3D, the element will be rasterized at the initial size" In fact it seems that it will be rasterized only because of the perspective component. I can scale, translate and rotate it, and it stays razor sharp (see the orthogonal version). Anyway, I also think there's not much we can do here. I'm also aware of this workaround: "prepare a bigger element, then apply 3D, and then scale it down.", but if I use a too big initial scale, safari on ios devices crashes. I'll have to find the balance and make compromises, it seems. |
Closing then. After all there is a workaround to mitigate this issue 👍 |
Wow, I've just tried it, and it does make a significant difference on windows-chrome, too! I'm wondering why..? It doesn't really make any sense, does it..? Smaller size should give us an even blurrier result..? |
Description of the problem
I've made a demo to demonstrate the problem, I tried to remove all the code that's unnecessary.
Use your mouse wheel to zoom in / out. You can probably see, that on the right, the SVG becomes pixelated, as if it was a low-resolution jpeg, or something. Given the fact that SVG uses vector graphics, it should remain crystal clear and razor sharp, no matter how far I zoom in (like it does with OrthographicCamera - on the left).
What I've tried:
zoom
property. Well, it doesn't really matter if I change the perspective camera's position, or itszoom
property, the effect seems to be the same.What I can think of..:
transform
attributes well, but they can handle others very well..? I've noticed that the camera's div (generated by the CSS3DRenderer) hastranslateZ
when I use PerspectiveCamera, but it hasscale
when I use OrthographicCamera. Although I've tried manually changing it and it didn't improve anything, so I'm not sure..Any ideas, anyone?
https://jsfiddle.net/soadzoor/jkn2eugs/6/
UPDATE: After some digging, I've figured out that if I remove the
perspective: XXXpx;
attribute, then it becomes sharp, and also: if I add theperspective: XXXpx;
attribute to the one with the orthographic camera, it becomes blurry. So the question: can we replace this attribute to something else (like a transform matrix), to get the same perspective effect minus the blurriness?UPDATE2: I've tried replacing
perspective
withtransform: perspective
(the former needs to be added to the parent, the latter needs to be added to the child), and also recreated the effect with matrix3d, based on this: https://stackoverflow.com/questions/8029605/what-is-the-math-behind-webkit-perspective/8029819#8029819All of these approaches get me to the same blurry image.. I'm starting to give up on this, it's probably a browser limitation that can't be solved as of now..
Three.js version
Browser
OS
The text was updated successfully, but these errors were encountered: