HTML in Canvas: Bridging UI and GPU on the Web

This ad is not shown to multipass and full ticket holders
React Advanced
React Advanced 2026
October 23 - 26, 2026
London, UK & Online
Upcoming event
React Advanced 2026
React Advanced 2026
October 23 - 26, 2026. London, UK & Online
Bookmark
Rate this content
Sentry
Promoted
Code breaks, fix it faster

Crashes, slowdowns, regressions in prod. Seer by Sentry unifies traces, replays, errors, profiles to find root causes fast.

Get started

Modern web development still relies on a strong separation between HTML/CSS for UI and Canvas/WebGL for rendering. In practice, combining both often leads to complex synchronization logic and a series of workarounds.

In this talk, we’ll first walk through how these problems are typically solved today — including scroll synchronization, frame loop timing, scissor-based rendering, and mapping DOM elements into a WebGL scene — and why these approaches tend to be fragile and hard to scale.

Using a set of experiments and websites developed at basement.studio, we’ll show these patterns in practice, combining real layouts with shaders and interactive effects.

From there, we’ll introduce HTML-in-Canvas and show how it simplifies many of these problems — not as a finalized solution, but as a direction that removes the need for most of the synchronization and rendering workarounds we rely on today.

We’ll also cover the challenges of building UI directly in WebGL, where layout, text, and interactivity become difficult to manage, especially in environments like WebXR.

This talk has been presented at Web Engineering Summit 2026, check out the latest edition of this Tech Conference.

Santiago Colombatto
Santiago Colombatto
Tomas Ferreras
Tomas Ferreras
17 min
15 Jun, 2026

Comments

Sign in or register to post your comment.
Video Summary and Transcription
Santiago Colombato discusses challenges in synchronizing DOM and WebGL for visually heavy websites, focusing on scroll sync and basics of WebGL's rendering process. The talk addresses the complexities of rendering text on GPU in WebGL and the challenges of HTML in canvas implementation. The proposal introduces advanced features like a paint event and element image capture to enable synchronization of HTML changes and element snapshots. Exciting prospects include blurring the lines between DOM and canvas, showcasing 3D scenes, distorted text, and GPU effects, offering new possibilities for website generation.

1. Challenges in Synchronizing DOM and WebGL

Short description:

Santiago Colombato, front-end developer, discusses challenges in synchronizing DOM and WebGL for visually heavy websites. Focus on scroll sync and basics of WebGL's rendering process.

Hi, everyone. I'm Santiago Colombato. I work as a front-end developer at Basement Studio. We build sites and experiences with companies like Bracel, Daylight, MrBeast, and a lot of what we ship uses WebGL.

Today, I want to talk about a gap that we keep running into, and that gap is making the DOM and WebGL move as one. When you build a visually heavy website, you usually have two phases to manage. One side, it's the DOM. It gives you layout, text, scroll, accessibility. And the other is WebGL. Shaders, GPU rendering, cool effects, basically. The challenge starts when both need to stay in sync, and the hard part is making them move as one.

So I'm going to focus on one specific problem today, and that is scroll sync. But first, most of you write JavaScript, but not everyone writes WebGL. So let me take a minute to cover the basics so we can understand the full context. When you work on a normal web page, you write HTML and CSS. The browser calculates layout, paint text, and elements, and everything works. You don't think too much about the GPU. WebGL changes that. WebGL is a JavaScript API that lets you render graphics inside a canvas element. You are directly with the GPU. But the tradeoff here is that you leave the normal rendering pipeline of the browser.

2. Understanding Vertex and Fragment Shaders in WebGL

Short description:

Explanation of vertex and fragment shaders in WebGL. Addressing synchronization challenges between browser scroll and WebGL layer movements.

Inside the canvas, you don't have HTML, you don't have CSS. So you are just drawing pixels with little programs that run on the GPU. Those programs are called shaders.

We have two types of shaders. The first one is the vertex shader. Every shape on the canvas is made of triangles, and triangles are made of points or vertices. So as you can see on the slide, this code snippet represents a basic vertex shader. That program runs once per vertex, with the task of taking a 3D position and outputting a screen coordinate.

The second type is the fragment shader. Once the GPU identifies where the triangles are, it fills them in. For every pixel inside a triangle, the fragment shader determines the color to write, addressing visual effects, lights, and textures. The vertex shader defines the position, while the fragment shader determines the appearance. Visually heavy websites often employ this hybrid approach where the canvas handles significant visual work alongside the DOM.

When scrolling, discrepancies arise. The browser updates the visual scroll position instantly, while the WebGL layer updates in a frame loop after scroll from a sampled value. This delay causes misalignment, where the browser moves the page, and the canvas reacts slightly later. To address this issue, adjustments are needed to synchronize the scroll between the DOM and WebGL layers for seamless movement.

Check out more articles and videos

We constantly think of articles and videos that might spark Git people interest / skill us up or help building a stellar career

Boost the Performance of Your WebGL Unity Games!
JS GameDev Summit 2023JS GameDev Summit 2023
7 min
Boost the Performance of Your WebGL Unity Games!
Top Content
The Talk discusses ways to boost the performance of WebGL Unity games, including issues with bundle size, memory usage, and runtime performance. It suggests using Brotli for compression and non-exception support for better performance. Choosing the appropriate texture compression format and experimenting with separate builds can also help. The Talk also covers optimizing textures, models, audio, and assets by reducing build size, using compression, disabling unnecessary models, and optimizing audio quality. Unity's optimization tools and profilers are recommended for analyzing performance and memory issues.
Unreal Engine in WebAssembly/WebGPU
JS GameDev Summit 2022JS GameDev Summit 2022
33 min
Unreal Engine in WebAssembly/WebGPU
Top Content
Alex Saint-Louis, co-founder of Wunder Interactive, shares the mission of bringing Unreal Engine to the browser, enabling cross-platform 3D applications and games. They are working on a WebGPU back end for Unreal Engine to push the limits of 3D on the web. Wunder Interactive has improved compression, built their own asset file system, and offers powerful tools for game developers. They are utilizing modern web technologies like WebAssembly, WebGL, and WebGPU, and plan to support other engines like Unity and Godot. The team aims to transform the industry by bringing console-quality games to the browser and providing an alternative distribution path. They are excited to bring Unreal Engine 5 to the web with WebGPU support and are working on WebXR support for cross-platform 3D experiences, including VR.
Detect and Avoid Common Performance and Memory Issues in Unity WebGL Builds
JS GameDev Summit 2022JS GameDev Summit 2022
10 min
Detect and Avoid Common Performance and Memory Issues in Unity WebGL Builds
Top Content
Today's Talk focuses on avoiding performance and memory issues in Unity WebGL builds. The importance of managing memory and keeping the heap size small is highlighted. Techniques such as using asset bundles or an addressable system can help reduce memory usage. The limitations of garbage collection in WebGL builds are discussed, along with tips for optimizing Unity code. Tools like Backtrace can assist in debugging memory and performance issues.
Extending Unity WebGL With Javascript
JS GameDev Summit 2022JS GameDev Summit 2022
32 min
Extending Unity WebGL With Javascript
Top Content
Unity targets over 25 platforms and technologies, including desktop, mobile, and virtual reality. They use Emscripten to compile the engine and game logic into WebAssembly for web development. Unity can be extended with plugins to access browser features like WebXR's augmented reality mode. The speaker demonstrates intercepting Unity's calls to the browser to modify its behavior. Unity is actively working on mobile support for web export and improving documentation for extending Unity with web plugins.
Pixi Powerups!
JSNation Live 2021JSNation Live 2021
30 min
Pixi Powerups!
Pixie is a powerful tool for creating scenes and effects in software development. It supports features like texture mapping, Spine animation, and filters for creating cool effects. The talk also covers the use of render textures to capture and download images, as well as the importance of communication and a positive attitude in software development. The speaker shares their journey into coding and discusses the potential for porting Unity games to JavaScript using technologies like web GL and web GPU.
Marrying WASM/WebGL Games with React UI
React Summit 2022React Summit 2022
22 min
Marrying WASM/WebGL Games with React UI
Jonny discusses marrying WebAssembly and WebGL games with React, emphasizing the importance of choosing the right tool for game development. He introduces the Godot game engine as a powerful choice for game development and highlights the limitations of Godot. Jonny demonstrates how to combine React with Godot and showcases the ability to dynamically switch between different games on the same website. He explains the process of exporting a Godot game to the web using WebAssembly. Jonny also discusses the communication between React and Godot games and highlights the benefits and future improvements of using this approach.

Workshops on related topic

Make a Game With PlayCanvas in 2 Hours
JSNation 2023JSNation 2023
116 min
Make a Game With PlayCanvas in 2 Hours
Top Content
Featured WorkshopFree
Steven Yau
Steven Yau
In this workshop, we’ll build a game using the PlayCanvas WebGL engine from start to finish. From development to publishing, we’ll cover the most crucial features such as scripting, UI creation and much more.
Table of the content:- Introduction- Intro to PlayCanvas- What we will be building- Adding a character model and animation- Making the character move with scripts- 'Fake' running- Adding obstacles- Detecting collisions- Adding a score counter- Game over and restarting- Wrap up!- Questions
Workshop levelFamiliarity with game engines and game development aspects is recommended, but not required.
How to make amazing generative art with simple JavaScript code
JS GameDev Summit 2022JS GameDev Summit 2022
165 min
How to make amazing generative art with simple JavaScript code
Top Content
Workshop
Frank Force
Frank Force
Instead of manually drawing each image like traditional art, generative artists write programs that are capable of producing a variety of results. In this workshop you will learn how to create incredible generative art using only a web browser and text editor. Starting with basic concepts and building towards advanced theory, we will cover everything you need to know.