perf: render pipeline optimizations — sample scaling, USD logging, persistent BVH

Task 1: Resolution-aware sample count
- Auto-scale samples for resolutions <= 1024: max(32, samples * max_dim / 2048)
- 512x512 thumbnails: 256 → 64 samples (75% GPU savings)
- Thumbnail tasks capped at 64 samples via context manager
- 2048x2048 HQ renders unchanged

Task 2: USD path preference audit + logging
- Verified USD master path is correctly preferred over GLB tessellation
- Added clear emit() messages: "Using USD master" vs "No USD master — GLB path"
- Dynamic render log label: "USD → Blender" vs "STEP → GLB → Blender"

Task 3: Persistent BVH for turntable animations
- Added scene.render.use_persistent_data = True before frame loop
- BVH acceleration structure cached between frames (not rebuilt per frame)
- Applies to both camera orbit and object rotation modes

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-15 12:03:31 +01:00
parent ce15526a15
commit ffe3eebfca
4 changed files with 125 additions and 103 deletions
@@ -888,6 +888,10 @@ def main():
else:
print("[turntable_render] transparent_bg enabled (alpha PNG frames)")
# ── Persistent data (Cycles BVH caching between frames) ────────────────
scene.render.use_persistent_data = True
print("[turntable_render] persistent_data enabled — BVH cached between frames", flush=True)
# ── Render all frames ────────────────────────────────────────────────────
# Per-frame loop with write_still=True. In a single Blender session,
# Cycles keeps the GPU scene (BVH, textures, material graph) loaded