A DOM form on a quad in a Godot 4 scene

Godot is a game engine. Its web export draws everything into one WebGL canvas, so a login form or a chat box has to be rebuilt from engine controls, and on a phone the keyboard only opens for a real <input>. Here the form is a real <form> inside Godot's canvas. The browser paints it into a texture that Godot puts on a quad in a 3D scene. Load the engine, then type in the fields, press Sign in and send a chat line. A press outside the form goes to Godot and recolours the orbiting objects.

Sign in
form: not signed in

Godot 4.7.2, Compatibility renderer (WebGL2), single-threaded. It isn't loaded until you ask.

Route to the texture

The yellow line above the form is a Godot Label3D, drawn with Godot's own font. It changes when the form reports a sign-in or a chat line. The three small objects orbit the panel and pass in front of the form and behind it. The panel sways less while a field has focus.

Show the code a DOM form as a Godot texture
  1. Put the form inside the canvas Godot renders into.
  2. Style it like any other form. It is opaque, because the quad's shader doesn't blend.
  3. Start the engine when the reader asks.
  4. Fetch the engine. The 39.5 MB index.wasm is stored as a 10.1 MB gzip file and inflated in the page.
  5. Start Godot on the canvas with the engine's own Engine loader and no HTML shell.
  6. GDScript: a quad with an unshaded material.
  7. GDScript: make a texture and find the WebGLTexture behind it. texture_get_native_handle() gives the GL name; GL.textures is reached with JavaScriptBridge.eval() inside the engine's module.
  8. JavaScript: the object GDScript calls.
  9. JavaScript: note each paint event.
  10. GDScript: each frame, upload if the form was repainted.
  11. JavaScript: texElementSubImage2D() into Godot's texture.
  12. GDScript: project the quad's corners to the screen.
  13. JavaScript: four corners to one perspective matrix.
  14. JavaScript: updateElementGeometry().
  15. JavaScript: keep Godot from handling events the form received.
  16. GDScript: hear from the form, and Godot's own input.
  17. The route without Emscripten internals, JavaScript side.
  18. The same route, GDScript side.
  19. GDScript: which ways reach GL.
  20. All of main.gd.
  21. All of bridge.js.

How it works

Live checks

The checks start a second copy of the Godot app in a small frame, so they don't touch the one above. They download the engine (10.4 MB) if it isn't cached and take several seconds.

ResultExperimentDetail

Findings

Measured in headless Chromium 157 on 2026-11-21 with Godot 4.7.2 and software WebGL2, at 1× and at a 2.625 device scale with touch. Nothing here was run on a phone.