cognitedata/reveal

Render size is possibly set wrong in Cognite3DViewer resizeIfNecessary

hkot1991 opened this issue ยท 3 comments

I was looking into your resizeIfNecessary method in Cognite3DViewer and I think I found a bug.
According to threejs render documentation the renderers setSize method already handles the device pixel ratio:
image

So the width and height passed to setSize in resizeIfNecessary will be multipled AGAIN with the device ratio inside setSize.
Making the render size way higher than it needs to be for cases where the device ratio is not 1.

Looks to me like a bug, but please let me know if I'm wrong ๐Ÿ™

Thank you for reporting, @hkot1991. We will take a look ๐Ÿ‘

Been looking a little more into this and it seems like you are correct. Oddly enough, this seems NOT to be the case for when setting the size of render targets. So I believe most of the rendering in Reveal will not be affected by this (other than the very last render pass that gets rendered to the canvas). In any case we are tracking the issue internally and should produce a fix for this soon.

EDIT: We are setting the size of render targets based on the size of the WebGlRenderer, so we are actually rendering at too high resolution. I am escalating the issue.

Attempt at fix in: #1874. Just reopen this if you are still experiencing issues. And again, thanks for reporting the issue.