Just started with Three.JS about a week ago, and I’m loving it so far! I’ve just learned how to import 3d models, but there’s this issue that persists throughout all my little projects where my window will always have some part of it that’s not part of the three.JS scene, like this:
The white margin that isn’t part of the scene is annoying as it gets in the way of scrolling around with OrbitControls and is just unpleasant to look at. How could I make it so that the scene completely takes up the whole
window?
Also… in a resize handler, there is a 3rd boolean parameter to renderer.setSize on the renderer, that when set = false, prevents the renderer from changing the width/height .style of the canvas, and thus lets you fully control the canvas scaling via CSS.
Otherwise when you .setSize on the renderer it can cause a feedback loop where the canvas style changing, causes the canvas to change size, the margin is then applied by css, which makes the document overflow which can trigger another resize.