Real three.js through @solidjs/universal

Each slot is a Mesh with an attached BoxGeometry, MeshBasicMaterial, and DataTexture. Swap them, change the box width (a constructor argument), or unmount them, and watch the WebGL memory counters.

Pointer events and raycasting

@solidjs/universal knows nothing about events. A prop like onClick reaches the renderer as an ordinary prop, so the renderer stores it, and a small event system does what the browser does for DOM elements:

Try it: hover a box, click A then B and compare the group count, press on A and drag sideways past B, or unmount the boxes while one is hovered.

Async loaders and shared resources

This example has its own canvas and WebGLRenderer, so its GPU counters stand alone. Each box waits for a texture from a slow loader. The left and middle boxes ask for the same texture, so they share one. The right box has its own.

Per-frame loop

Animation needs code that runs every frame, outside Solid's reactivity. The frame loop is plain JavaScript: each frame it runs its subscribers, calls a beforeRender hook, and draws. The Solid binding adds two things: useFrame(), which unsubscribes when its component unmounts, and flush() as the beforeRender hook.

JSX types

This section has no canvas: TypeScript does the checking. In Solid 2, solid-js does not own JSX types. Each renderer package provides its own jsx-runtime types, and a file picks one with jsxImportSource. These types derive each element's props from its three.js class and match what the renderer does with them.

View the renderer · View the scenes: renderer, events, async, frame loop · Back to the main demo