From 90308e4b1b18b9cce7003f4a8a00fb99854b6aad Mon Sep 17 00:00:00 2001 From: Georg Tomitsch Date: Thu, 4 Jun 2026 11:54:59 +0200 Subject: [PATCH] Preserve reflection render target aspect --- public/js/webgl-book-lab.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) 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,