Skip to content
wtc-gl
Main Navigation DocsAPIDemos
Changelog
npm

Appearance

Sidebar Navigation

Getting started

Introduction

Installation

Your first shader

Your first 3D scene

Scroll-synced scenes

Core concepts

Renderer

Scene graph

Cameras

Programs and shaders

Uniforms

Textures

Render targets

Cleaning up

Geometry

Geometry and attributes

Primitives

Paths and curves

Tube, Extrude and Lathe

CSG

Instancing

Lines

Polyline

Lighting

Lights and LitProgram

Shadows

Debug helpers

Loading

glTF models

Interaction

Raycast

Simulation

TransformFeedback

Recipes

FragmentShader

Stage

GPUSimulation

ScrollRenderer

ParticleSimulation (deprecated)

Cookbook

Feedback with ping-pong buffers

Pointer, time and resolution

Pick and drag

A glTF model with shadows

Carve a model with CSG

Pointer trails

A field of instances

Images that ripple on scroll

React

Setup

ScrollRendererProvider

useScrollScene

useScrollImage

Examples

Gallery

Lighting walkthrough

Paths walkthrough

Icon swarm walkthrough

Scroll cloth walkthrough

Examples

Examples ​

Full demos built with wtc-gl, each one a page you can open, take apart and adapt.

Each demo isolates one or two ideas, from a texture fed by a video to a swarm of icons under physics, and most have a panel of options to play with. The chips on each card are the classes and functions it leans on: pick one to see only the demos that use it.

Four of them have a walkthrough that goes through the source section by section: Lighting, Paths, Icon swarm and ScrollImage and ScrollHTML. The recipes, FragmentShader, ParticleSimulation and ScrollRenderer, have pages of their own.

26 demos.

  • Video texture demo

    Video texture

    A video element sampled as a live Texture and fed into a fragment shader each frame. The onBeforeRender hook marks the texture dirty so the GPU always sees the current video frame.

    Open the demo →Source

  • Transform feedback particles demo

    GPU particle simulation

    Thousands of particles simulated entirely on the GPU using TransformFeedback ping-pong buffers. Velocity is computed in a vertex shader and fed back as position attributes each frame - zero CPU involvement per particle.

    Open the demo →Source

  • A swarm of thousands of arrows gathering around the pointer

    Swarm

    8,192 agents chase the pointer through a flow field. One TransformFeedback simulation is stepped several times a frame without drawing, then drawn twice from the same buffers: as instanced arrows pointing along each agent's velocity, and as an additive glow. Position and velocity are captured interleaved, each agent's seed is a static attribute, and Reset restarts the simulation.

    Open the demo →Source

  • Framebuffer post-processing demo

    Framebuffer post-processing

    A scene rendered to an off-screen Framebuffer, then composited through a second pass. Demonstrates the render-to-texture pipeline for effects like bloom, blur, and feedback loops.

    Open the demo →Source

  • Verlet cloth simulation deforming a photo of sand

    ScrollImage & ScrollHTML

    Three scenes on one canvas. Scene 1: hue ripple at the cursor via Rodrigues rotation. Scene 2: a Verlet cloth simulation deforming an image — scroll to inject inertia, click to grab. Scene 3: the same cloth with a live HTML form as its texture using the experimental HTML-in-Canvas API.

    Open the demo →WalkthroughSource

  • A full-width rainbow plasma shader behind a dark card titled React ScrollRenderer

    React ScrollRenderer

    The ScrollRenderer demo rebuilt with @wethegit/react-wtc-gl: a provider owns the canvas and render loop, hooks register scenes from components, and React state pauses the loop. Runs in StrictMode to exercise the cleanup paths.

    Open the demo →Source

  • Teal box modules coiled around a line on helical strands

    React Manifold Divider

    A section divider: instanced box modules coil around a line on helical strands and flow along it. Each divider renders a float G-buffer offscreen, then composites outlines, AO and fog into its strip of the shared ScrollRenderer canvas.

    Open the demo →Source

  • Rings of box modules forming a funnel-shaped mandala

    Manifold Mandala

    Thirty rings of instanced box modules form a funnel that reads as a mandala head-on. Rings spin, ripple and regrow as new shapes; click to sweep a new palette through them. The same float G-buffer and outline, AO and fog pass as the divider.

    Open the demo →Source

  • A rainbow plasma shader panel on a cream, dotted map, with region tabs along the bottom

    React DragWorld

    A click-and-drag explorable world in the style of the Super Mario Odyssey site: a 4,400px map panned with momentum and elastic bounds, where shader regions registered with useScrollScene light up as you approach them.

    Open the demo →Source

  • A glowing blue Voronoi shader panel on a cream, dotted map, with region tabs along the bottom

    React DragWorld Infinite

    The drag world wrapped into a torus: no edges, no bounds — each region is a single DOM element folded back around the seam while off-screen, with a compass pointing the shortest way home across the wrap.

    Open the demo →Source

  • A webcam portrait redrawn as speckled cellular-automaton noise, in warm and cool tones on black

    Webcam cellular automata

    A ping-pong Framebuffer runs Conway's Game of Life where webcam brightness seeds new cells. Living cells inherit the webcam's colour at the moment of their birth, creating a living portrait that evolves frame by frame.

    Open the demo →Source

  • A blue, softly glowing raymarched box nested inside a cube, on a dark background

    Raymarching on a mesh

    A raymarching SDF rendered inside the volume of a rotating Box mesh. The fragment shader casts rays from each mesh surface point, infinitely repeating a frame-and-sphere lattice. The cube's model matrix is passed as a uniform so the SDF space rotates in sync with the geometry.

    Open the demo →Source

  • A winding ribbon of motion-blurred blocks, rendered in tiles

    Progressive render

    A raymarcher far too heavy for one frame, rendered a tile at a time. Each tile goes into one Framebuffer through a viewport, a composition pass adds it to the image so far in another, and the tile size adapts to keep frames responsive. Click for a new image.

    Open the demo →Source

  • The heading Scroll Image. over a dark blue, cloudy shader background

    Scroll blades

    An editorial scroll layout: a fullscreen animated background via ScrollScene, four alternating image/text blades each using ScrollImage for cover-fit, parallax, and chromatic aberration — all on one shared WebGL context.

    Open the demo →Source

  • A glowing portal among boxes, showing a world of spheres

    Stencil & depth texture

    A portal into another world, drawn with a RenderTarget whose depth and stencil share one texture. The stencil limits the second world to the portal, and a post pass samples the depth texture for fog and outlines. Switch views to see the depth and stencil on their own.

    Open the demo →Source

  • A galaxy of cubes beside an overview of the camera and its frustum

    Many meshes

    A spiral galaxy of up to 6,000 separate meshes, each moved and rotated every frame. One pane is the camera you control; the other watches it from above, showing its frustum and only the meshes it didn't cull. Matrices, uniforms and render lists are updated in place, so the render loop makes almost no garbage. Switch to one InstancedMesh to draw the same galaxy in a single draw call, still culled cube by cube, for a fraction of the CPU time, and hover to pick out one cube with a Raycast.

    Open the demo →Source

  • Concentric rings of block and sphere modules in a shallow bowl, over a peach and mint sky

    Building geometry

    Concentric rings of modules, built in code and drawn as one mesh. Boxes and spheres placed with applyMatrix merge into a module, copies of the module (every other one mirrored) merge into a ring, and the rings merge into the sculpture. A regrow wave rebuilds one ring at a time while the shader grows it and explodes the sculpture, so it stays a single draw call. Flat and smooth shading come from toNonIndexed and mergeVertices.

    Open the demo →Source

  • A box, sphere, plane, cylinder, cone, torus, capsule and vase in two rows, with their triangle edges drawn

    Primitives

    Every built-in primitive side by side, with its options in the pane: segments, radii, partial sweeps and open ends. Changing an option rebuilds that shape. Switch between lit, a uv checker and NormalProgram in view or world space, flat and smooth shading, and turn off back-face culling to see inside the open shapes. The helpers add vertex normals, face normals and local axes to every shape, and clicking one shows the triangle and uv under the pointer. The vase is a Lathe of a 2D profile, and a cone is a Cylinder with radiusTop: 0.

    Open the demo →Source

  • A sphere, torus, checkered box, faceted sphere, two-tone capsule and open cup in a row on a grey floor, lit from the upper left by a small yellow sun

    Lighting

    The built-in lit program, one option per shape: plain Lambert, a Blinn-Phong highlight, a texture map, flat shading, vertex colours and a double-sided open cylinder. Every shape shares one Lights, so moving the sun or changing the sky and ground colours relights them all. The light is fixed in the world as you orbit, and the highlights follow the camera. A GridHelper and AxesHelper mark the floor and origin, and a WireMesh can show each shape's triangles. Hover a shape to see a Raycast hit: the point, the surface normal, the face and the uv.

    Open the demo →WalkthroughSource

  • A low-poly floating island with pine trees, grey rocks, a lamp post with a glowing orange lamp and a wooden sign with an arrow

    glTF

    A floating island made in Blender and loaded from a .glb with GLTFLoader. Its materials become LitPrograms sharing one Lights: vertex-coloured rocks, a textured double-sided sign and an emissive lamp. The trees are exported with EXT_mesh_gpu_instancing, so they load as InstancedMeshes. Look through the file's camera, or hover to name the node under the pointer.

    Open the demo →Source

  • Twisting towers of navy and plum hexagons, rings of yellow and lilac triangles and pink pillars crowding a pale blue haze

    Fly

    Fly through endless space with a FlyCamera: drag to steer like a joystick, or use WASD or the arrows, Q and E to roll, R and F to change speed and space to stop. Each cell of space grows towers, spirals and rings of prisms from a small rule grammar, seeded by where it is, and cells are regrown ahead of you as you fly. Each cell is two InstancedMeshes, drawn with litShading and fog.

    Open the demo →Source

  • A clump of chunky coloured icons — red hearts, blue crosses, yellow bolts, green triangles and white discs — casting a soft shadow onto a dark backdrop

    Icon swarm

    Five icons loaded from .glbs, their materials made into instanced LitPrograms so every copy of an icon is one InstancedMesh. Their convex colliders drive Rapier physics with no gravity: the icons drip in and clump, the pointer's Raycast pushes them aside and a click blasts them apart. They cast a Shadow onto each other and onto a backdrop drawn with shadowShading.

    Open the demo →WalkthroughSource

  • A pale cube with a spherical bite taken out of one corner, the hollow coloured orange, casting a shadow onto a grid floor

    CSG

    Booleans with manifold-3d, which wtc-gl doesn't depend on: the demo loads the WASM and toManifold converts wtc-gl primitives for it. A cutter orbits through a box, cylinder, torus or extruded star and the subtraction, intersection or union is redone every frame. The cut faces keep the cutter's colour and its normals, flipped to face the right way.

    Open the demo →Source

  • A translucent trefoil-knot tube with small red, green and blue axes along its centre line

    Paths

    A tube swept along a Catmull-Rom curve through points you can drag. Markers compare samples spaced evenly by distance with parametric ones that bunch up, and axes show the rotation-minimising frames the tube follows, matched up around a closed trefoil. Twist and taper the tube, and switch alpha to see the uniform curve loop on a hairpin where the centripetal one doesn't. Tension tightens or loosens the curve, and the B-spline type is smoother still, pulled towards the points rather than through them. The extrude preset turns a flat outline and hole into a bevelled solid as you drag, with hard edges wherever it turns sharper than the crease angle. Handles are picked and dragged with a Raycast.

    Open the demo →WalkthroughSource

  • A tapered, dashed blue spiral line, with a short orange trail tapering to a point

    Lines

    A spiral that draws itself on, tapered and dashed, with dashes measured by the distance travelled so they keep their length. As a billboard it always faces the camera, in pixels or world units. Switch it to a ribbon and it becomes a flat strip in world space that twists along its length and banks into its turns. Move the pointer to draw a trail, which pushes a new point every frame.

    Open the demo →Source

  • A dense, swirling cluster of thin orange and teal particle trails on a dark background

    Polyline trails

    16,384 particles swirl through a force field, each drawn as a ribbon through its recent positions. A float simulation writes into a history texture, and one instanced Polyline with a custom vertex shader reads it back and extrudes each trail with polylineExtrude. Click for the next shot.

    Open the demo →Source

Edit this page on GitHub
Pager
PrevioususeScrollImage
NextLighting walkthrough