How danielmartinezsebastian/r3f-offscreen-webworker works
Project type and purpose
• This is a modern front‐end web application built with Next.js 14 that demonstrates offscreen 3D rendering using React Three Fiber (R3F) in a WebWorker.
• Its goal is to offload complex 3D animations to a background thread so the main UI thread stays responsive.
File structure
• Top‐level config & build files (.eslintrc.json, next.config.mjs, tailwind.config.ts, tsconfig.json, package.json).
• public/ holds static assets (pmndrs.glb 3D model, textures folder).
• src/app/ contains the Next.js “app router” pages and global CSS.
• src/components/OffScreenCanvas.tsx implements the offscreen canvas in the browser.
• src/scenes/ contains scene definitions (Scene.tsx, AlternativeScene.tsx).
• src/workers/sceneWorker.tsx is the WebWorker entry point that instantiates Three.js offscreen.
README for additional insights
• Confirms use of Next.js 14, R3F, and WebWorker to render 3D scenes off the main thread.
• No backend API—this is a static/SSR front-end demo.
Detail without overcomplication
• Both React component tree (app → OffScreenCanvas → scenes) and Worker internals (Three.js Renderer → Scene Graph → GPU).
• Essential pieces: Next.js routing, React hydration, OffscreenCanvas transfer, Worker rendering, asset loading.