Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix WebXR Layers example. #24691

Merged
merged 2 commits into from
Sep 27, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions examples/webxr_vr_layers.html
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,10 @@
] );
const line = new THREE.Line( lineGeometry, new THREE.LineBasicMaterial( { color: 0x5555ff } ) );

// The invisible dummyMesh quads and the guiMesh need to be rendered before the controller lines so that they
// leave a hole in the depth buffer that the lines can intersect.
line.renderOrder = 1;
Mugen87 marked this conversation as resolved.
Show resolved Hide resolved

const controllerModelFactory = new XRControllerModelFactory();
const handModelFactory = new XRHandModelFactory().setPath( './models/fbx/' );

Expand Down Expand Up @@ -202,7 +206,7 @@
// projection layer is rendered.
const dummyMeshLeft = new THREE.Mesh(
new THREE.PlaneGeometry( snellenConfig.widthMeters, snellenConfig.heightMeters ),
new THREE.MeshBasicMaterial( { opacity: 0 } ) );
new THREE.MeshBasicMaterial( { colorWrite: false } ) );
dummyMeshLeft.position.x = snellenConfig.x - snellenConfig.widthMeters;
dummyMeshLeft.position.y = snellenConfig.y + snellenConfig.heightMeters;
eyeCharts.add( dummyMeshLeft );
Expand Down Expand Up @@ -255,7 +259,8 @@
guiMesh.position.set( 1.0, 1.5, - 1.0 );
guiMesh.rotation.y = - Math.PI / 4;
guiMesh.scale.setScalar( 2 );
guiMesh.material.opacity = 0;
guiMesh.material.colorWrite = false;
guiMesh.material.transparent = false;
group.add( guiMesh );

// Error message if layer initialization fails.
Expand Down