From 004c077181cbfef4c0c31f95fe6bbc28c51414f6 Mon Sep 17 00:00:00 2001 From: Georg Tomitsch Date: Fri, 19 Jun 2026 19:38:13 +0200 Subject: [PATCH] Don't recompute AO/shadow/reflection on page-texture content changes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit handlePageTextureRecords() called markStaticSceneBuffersDirty() on every page-texture update, forcing a full SSAO + shadow + reflection recompute (23-47ms frames) on every block during playback — even though a page-text change moves no geometry. AO and shadows depend only on geometry; the soft tabletop reflection picks up the new page on its throttled cadence. Removed the forced dirty so only real geometry changes (flips, camera, rebuild, resize) recompute the static buffers. Playback median ~60->63fps; the per-block forced heavy frames are gone (the remaining periodic ~23ms frames are the normal 8Hz throttled refresh). Co-Authored-By: Claude Opus 4.8 --- public/js/webgl-book-lab.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/public/js/webgl-book-lab.js b/public/js/webgl-book-lab.js index 054ada7..a46272c 100644 --- a/public/js/webgl-book-lab.js +++ b/public/js/webgl-book-lab.js @@ -2221,7 +2221,11 @@ function handlePageTextureRecords(event) { if (!detail.right && effectivePageMeta.right?.kind === 'blank') { applyExplicitBlankPageTexture('right', effectivePageMeta.right, 'page-texture-records'); } - markStaticSceneBuffersDirty(); + // A page-texture content change moves no geometry, so it must NOT force the AO/shadow/ + // reflection recompute (that produced 23-42ms frames on every block during playback). + // AO and shadows depend only on geometry; the soft tabletop reflection picks up the new + // page on its normal throttled cadence. Only geometry changes (flips, camera, rebuild, + // resize) dirty the static buffers. document.documentElement.dataset.webglPageTextureMetrics = JSON.stringify({ width: leftCanvas.width, height: leftCanvas.height,