Skip to content

Conversation

mrdoob
Copy link
Owner

@mrdoob mrdoob commented Jun 6, 2025

Description

This is just a quick test adding support for the HTML-in-Canvas proposal.

Screenshot 2025-06-06 at 4 39 18 PM

https://raw.githack.com/mrdoob/three.js/htmltexture/examples/webgl_materials_texture_html.html

(Requires passing --enable-blink-features=CanvasDrawElement to Chrome Canary versions later than 138.0.7175.0)

Here's a jsfiddle for anyone that wants to experiment with this: https://jsfiddle.net/ysw4dtbq/

Copy link

github-actions bot commented Jun 6, 2025

📦 Bundle size

Full ESM build, minified and gzipped.

Before After Diff
WebGL 337.4
78.67
337.73
78.76
+332 B
+82 B
WebGPU 553.89
153.48
553.9
153.49
+12 B
+6 B
WebGPU Nodes 553.24
153.32
553.26
153.33
+12 B
+7 B

🌳 Bundle size after tree-shaking

Minimal build including a renderer, camera, empty scene, and dependencies.

Before After Diff
WebGL 468.59
113.33
468.91
113.4
+320 B
+78 B
WebGPU 628.86
170.19
628.86
170.19
+0 B
+0 B
WebGPU Nodes 583.72
159.53
583.72
159.53
+0 B
+0 B

@Makio64
Copy link
Contributor

Makio64 commented Jun 24, 2025

so weird, but also so usefull!

@mkeblx
Copy link
Contributor

mkeblx commented Aug 25, 2025

When I try out I don't see the inline image drawn.

html_texture_inline

When I switch to a same origin image it works.

html_texture_image_same_origin

This may be expected behavior. Although I see the 2D canvas example working currently with a different origin image.

@mkeblx
Copy link
Contributor

mkeblx commented Aug 25, 2025

Also, you can now try this a bit easier.

In the latest Chrome Beta (or Dev, Canary; just not Stable), there is now a 'HTML-in-Canvas' flag (chrome://flags) you can enable.

@mrdoob mrdoob added this to the r??? milestone Aug 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants