diff --git a/public/js/webgl-book-lab.js b/public/js/webgl-book-lab.js index 71a66ce..5551fe7 100644 --- a/public/js/webgl-book-lab.js +++ b/public/js/webgl-book-lab.js @@ -1051,8 +1051,14 @@ function resize() { renderer.setSize(width, height, false); camera.aspect = width / height; camera.updateProjectionMatrix(); - const reflectionWidth = Math.max(1024, Math.min(4096, Math.floor(width * reflectionPixelRatio * 1.5))); - const reflectionHeight = Math.max(576, Math.min(2304, Math.floor(height * reflectionPixelRatio * 1.5))); + const desiredReflectionScale = reflectionPixelRatio * 1.5; + const reflectionScale = Math.max(1, Math.min( + desiredReflectionScale, + 4096 / width, + 2304 / height + )); + const reflectionWidth = Math.floor(width * reflectionScale); + const reflectionHeight = Math.floor(height * reflectionScale); reflectionTargetSize.set(reflectionWidth, reflectionHeight); tableReflectionTarget.setSize( reflectionTargetSize.x,