What are maximum dimensions of Three.js render canvas?

这一生的挚爱 提交于 2019-12-08 09:06:45

问题


When I set render canvas size to ~4000x4000px it's ok, however starting from around 4000 (tested 5k, 6k, 8k) it seems that scene is "cut off" in some way. See image below:

So up to ~4k content is properly rendered in the center of canvas and for higher canvas sizes it cuts the content.

  1. Is it a Three.js/WebGL limitation?
  2. If yes then what are actual maximum canvas dimensions that don't cause any "deformations"?
  3. Is there anything I can do about it? I need to get canvas snapshot in high resolution (8k).

回答1:


This is not a limitation of three.js but a limitation of the maximum size of the drawing buffer. It's defined by the browser vendor and can't be exceeded by an application. More information in this github issue:

https://github.com/mrdoob/three.js/issues/5194




回答2:


Is there anything I can do about it? I need to get canvas snapshot in high resolution (8k).

You can render portions of the scene using Camera.setViewOffset and then assemble the parts into a large image.

Here's library that does this

https://greggman.github.io/dekapng/

I know there is an answer here I wrote that shows how to do this in three.js since I wrote that library because of my answer. Unfortunately 10 minutes of searching didn't bring up >:(



来源:https://stackoverflow.com/questions/53518155/what-are-maximum-dimensions-of-three-js-render-canvas

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!