Skip to content
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

Retina / HDPI screens #88

Closed
okydk opened this issue Sep 24, 2021 · 4 comments
Closed

Retina / HDPI screens #88

okydk opened this issue Sep 24, 2021 · 4 comments
Assignees
Labels
documentation Improvements or additions to documentation
Milestone

Comments

@okydk
Copy link

okydk commented Sep 24, 2021

Currently scenes looks pixelated on iPhones and Retina macs.
It would be great if the renderer took the window.devicePixelRatio into account when resizing the canvas. 😀

@klevron klevron self-assigned this Sep 24, 2021
@klevron klevron added the enhancement New feature or request label Sep 24, 2021
@klevron klevron added this to the 0.3.3 milestone Sep 24, 2021
@klevron
Copy link
Member

klevron commented Sep 24, 2021

We should may be use this by default : renderer.setPixelRatio( window.devicePixelRatio ); (it is used by default on threejs examples) ?

Or introduce a dpr option like in r3f ?

@SaFrMo
Copy link
Contributor

SaFrMo commented Sep 24, 2021

Adding a dpr option, with a fallback to detecting and using the window's dpr, makes sense to me!

@klevron klevron modified the milestones: 0.3.3, 0.3.4 Oct 30, 2021
klevron added a commit that referenced this issue Feb 16, 2022
@klevron klevron added documentation Improvements or additions to documentation and removed enhancement New feature or request labels Feb 16, 2022
@klevron
Copy link
Member

klevron commented Feb 16, 2022

Sorry I am really late on this one.
Added a pixelRatio prop : 60eee1a
I will release asap 0.3.4

@HerrHansen
Copy link

HerrHansen commented Jun 1, 2022

Hi @klevron,

(Before I come with problems: I am new to troisJS, and I like it very much. It is great! Thank you for that!♥️)

Setting pixelRatio to 2, doubles the width and height of <canvas> in DOM.
Because of that, my orbit control doesn't work right in viewport, I just see one quarter of the Three scene.

Setting :width="computedWindowWidth" (window.innerWidth * 0.5 + 'px') and :height="computedWindowHeight" (docu says it is number, but that has no effect and TS is complaining) as props to renderer, is fixing the one quarter problem. But then the resolution is still pixelated.

How do you make pixelRatio prop working as expected, please?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

4 participants