Skip to content

How to setSize of renderer #1133

Answered by drcmda
maxwellhankner asked this question in Q&A
Discussion options

You must be logged in to vote

pixelratio is 1 by default, you never have to mess with size, even in plain threejs that would imo be wrong bc you should be calling gl.setPixelRatio instead. in r3f that's super simple:

// so-so
<Canvas pixelRatio={2}>
// better
<Canvas pixelRatio={window.devicePixelRatio}>
// best: no lower than 1, no higher than 2, prefer 2 if window.devicePixelRatio allows
<Canvas pixelRatio={[1, 2]}>

this is because mobile device can have pixelratio as high as 4, maybe higher. you want to cap size at some point or else they face so many pixels their slow chips won't be able to cope.

ps. with v6 you can use a really high pixel density and regress temporarily on movement for improved performance simila…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@maxwellhankner
Comment options

Answer selected by maxwellhankner
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants