Skip to content

Conversation

mrdoob
Copy link
Owner

@mrdoob mrdoob commented Aug 5, 2025

Description

Added an example mixing CSS3D and WebGL. Not sure if it's the simplest approach though...

https://raw.githack.com/mrdoob/three.js/128860b66f0c250af933714fc7f77a03ef0b06d7/examples/css3d_mixed.html

Screenshot 2025-08-05 at 9 37 22 PM

@mrdoob mrdoob added this to the r180 milestone Aug 5, 2025
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
@Mugen87
Copy link
Collaborator

Mugen87 commented Aug 6, 2025

I have noticed the following errors in the browser console:

[Violation] Potential permissions policy violation: fullscreen is not allowed in this document.
[Violation] Potential permissions policy violation: xr-spatial-tracking is not allowed in this document.

They appear not just with rawgit but also when running the demo locally (with HTTPS). It seems it's possible to prevent them locally by adding this line when creating the iFrame.

iframe.allow = 'fullscreen;xr-spatial-tracking';

I wonder why they appear in the first place. Does the browser analyze the JS and realize the engine could make use of WebXR?

@mrxz
Copy link
Contributor

mrxz commented Aug 6, 2025

I wonder why they appear in the first place. Does the browser analyze the JS and realize the engine could make use of WebXR?

I believe it's caused by the fact that the Three.js examples page tries to allow the inner iframe both fullscreen and xr-spatial-tracking (examples/index.html#L41). But in this example, it itself is in an iframe that isn't allowed these permissions, so it can't pass these on or grant them.

@Makio64
Copy link
Contributor

Makio64 commented Aug 27, 2025

@mrdoob Another example im often asked by client is the opposite usage, all the 3d is done in webgl and texts like tooltips or form input are added on top of them using css3d.

@mrdoob
Copy link
Owner Author

mrdoob commented Aug 27, 2025

We have a couple of examples like that (using CSS2DRenderer):

https://threejs.org/examples/?q=css2#css2d_label
https://threejs.org/examples/?q=css2#webgl_loader_pdb

@Makio64
Copy link
Contributor

Makio64 commented Aug 27, 2025

@mrdoob actually i didnt realize its a webgl into a css into a webgl scene , i though you did all the canvas and environment in css as well , it works super well !

@mrdoob mrdoob merged commit 4384903 into dev Sep 3, 2025
8 checks passed
@whatisor
Copy link
Contributor

whatisor commented Sep 3, 2025

Demo looks awesome! Just curious why it stops working since the 3rd layer
image

@mrdoob
Copy link
Owner Author

mrdoob commented Sep 4, 2025

Not sure! Just asked Twitter about it.

@mrdoob mrdoob deleted the css3d branch September 4, 2025 04:24
@mrdoob
Copy link
Owner Author

mrdoob commented Sep 4, 2025

And... here's the answer.

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.

5 participants