HTML,
as a canvas texture.
three-html-render brings the HTMLCanvasElement
API extensions from the W3C draft
(requestPaint, texElementImage2D,
captureElementImage) to every modern browser, plus
the three.js helpers to drop live HTML into a WebGL or WebGPU
scene — interactive, not a screenshot.
drop into any page
<script src="https://cdn.jsdelivr.net/npm/three-html-render/dist/polyfill.js"></script> // HTML-in-Canvas API is now patched onto every <canvas layoutsubtree>.
npm install three-html-render
import { installHtmlInCanvasPolyfill } from 'three-html-render/polyfill' import { HTMLTexture, InteractionManager } from 'three-html-render' installHtmlInCanvasPolyfill() // patches requestPaint, onpaint, ... material.map = new HTMLTexture(element) new InteractionManager().connect(renderer, camera).add(mesh)
Dragon + glass panel
A scrollable HTML page rendered behind a transmissive glass dragon. Hover, type, follow links — all inside the canvas.
Examples
Everything below runs through the polyfill. Source in examples/.
three-html
Direct port of three.js's webgl_materials_texture_html example. HTMLTexture + InteractionManager from three.js 0.184.
three-html-raycast
Same cube, but one DOM element translates to the pointer via raycast UV — every face is interactive on a single element. Drag the background to orbit.
three.js · webgputhree-html-webgpu
The same demo on WebGPURenderer via copyElementImageToTexture.
three-html-webgpu-raycast
WebGPU + raycast interaction + OrbitControls.
three.js 0.164 · fallbackthree-html-legacy
Same user code, pinned to three.js 0.164 (predates native HTMLTexture). Exercises our captureElementImage fallback + ported overlay math.
dragon + glass panel
Scrollable HTML panel behind a glass dragon (fork of a Codrops scene). Form, hover states, theme toggle — all inside the canvas.
webGL
Minimal gl-matrix scene, an HTML panel as a texture on a cube face.
webgl · interactionwebGL text input
Six-face cube with a form overlay per face using InteractionManagerStandalone (no three.js dependency).
focus ring
Custom WebGL focus-glow shader sampling the HTML texture.
webgpujelly slider
WebGPU sample using copyElementImageToTexture for the HTML readout.