Capítulo 856 de 859
WebGPURenderer is three.js's next-generation renderer, targeting the modern WebGPU API with automatic fallback to WebGL 2 on unsupported devices, and bringing a new node-based material system, TSL (three.js shading language), and a redesigned post-processing stack.
WebGPURenderer prefers WebGPU for performance but automatically falls back to a WebGL 2 backend, so apps don't lose support for devices/browsers without WebGPU.renderer.setAnimationLoop() is the recommended way to drive the render loop (it waits for initialization automatically); using a manual requestAnimationFrame loop or needing the renderer ready during init requires explicitly awaiting renderer.init().forceWebGL option: forces the WebGL 2 backend even on WebGPU-capable devices, useful for testing or intentionally opting out of WebGPU.WebGLRenderer: WebGLRenderer remains maintained and is still the recommended choice for pure WebGL 2 apps, but new major features are focused on WebGPURenderer/TSL going forward, with limited node-material support for WebGLRenderer being explored to ease migration.const renderer = new THREE.WebGPURenderer({ antialias: true });
renderer.setPixelRatio(window.devicePixelRatio);
renderer.setSize(window.innerWidth, window.innerHeight);
renderer.setAnimationLoop(render);
document.body.appendChild(renderer.domElement);
WebGPURenderer setup, relying on setAnimationLoop to handle the renderer's asynchronous initialization automatically.WebGPURenderer targets WebGPU with automatic WebGL 2 fallback, so it's safe to adopt without dropping support for non-WebGPU devices.renderer.setAnimationLoop() over a manual requestAnimationFrame loop, since WebGPU initializes asynchronously; otherwise explicitly await renderer.init() first.WebGLRenderer is still maintained for pure WebGL 2 use, but future major feature development is focused on WebGPURenderer.WebGPURenderer can fall back to, and the one it's positioned to eventually supersede.RenderPipeline/MRT post-processing system built specifically for this renderer.