question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Weird canvas dimensions cause blurry render.

See original GitHub issue

You can observe this in the examples, find the canvas DOM node and compare the style dimensions with the canvas height and width attributes. Presumably, the ~2x difference visibly causes a blurry image:

image

Compare this with zooming out by 50%, the render is crisp.

image

I first noticed this in a project of mine that I did in both vanilla three.js and react-three-fiber, both using the exact same geometry, but the latter appearing blurry.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
drcmdacommented, Mar 17, 2019

yep, it divides it by two, i saw this in some three js examples and assumed this is the default. either way, i pushed an update that just doesn’t declare any pixelratio, three defaults to 1. you can set one by doing Canvas pixelRatio={…}

0reactions
tstelzercommented, Mar 17, 2019

👍 Works great! Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Weird canvas dimensions cause blurry render. #32 - GitHub
You can observe this in the examples, find the canvas DOM node and compare the style dimensions with the canvas height and width...
Read more >
Render Comes Out Blurry - Adobe Support Community
Dimension comes with V-Ray built in. Please see the post above for instructions on changing Depth of Field which is likely causing the...
Read more >
Fixing HTML5 2d Canvas Blur - Medium
Elements are rendered and painted to the screen with the appropriate styling. The problem lies between the first step and the second. In...
Read more >
Canvas drawings, like lines, are blurry - Stack Overflow
I found that setting the canvas size in CSS caused my images to be displayed in a blurry manner. Try this: <canvas id="preview"...
Read more >
What to look for when fixing blurry images at 2x - Bootcamp
Here is the problem. The image is being rendered with anti-aliasing to smooth the pixelation, but why? Simple, the browser is trying to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found