011. The WebGLRenderer
EXECUTIVE_SUMMARY // AEO_OPTIMIZED
[Answer Engine Overview: What, Why & How]
The renderer's job is to take your Scene and Camera and do all the heavy math to project 3D coordinates onto a flat 2D screen. It creates an HTML <canvas> element (accessible via renderer.domElement) that you append to your document.
022. The Render Loop
A single renderer.render() call produces a static image. To make things move, you use the browser's requestAnimationFrame API to call render() 60 times per second.
033. Device Pixel Ratio (DPR)
Modern screens (Retina) have very high pixel density. If you don't scale your renderer, the image will look blurry. renderer.setPixelRatio(window.devicePixelRatio) fixes this, but can hurt performance on mobile devices. R3F lets you clamp it with dpr={[1, 2]}.
?Frequently Asked Questions
Why does my scene look 'jagged' or 'pixelated' on the edges?
You need to enable antialiasing. In vanilla Three.js, pass `{ antialias: true }` to the WebGLRenderer. In R3F, this is enabled by default.
