question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Three.js does not support the Windows Holographic platform

See original GitHub issue
Description of the problem

Three.js does not support Windows Holographics. I’ve been working on a platform for creating JS apps in Microsoft HoloLens using WebGL. This requires a bunch of technology (old and new) to get working. I’m using Microsoft’s fork of ANGLE which has holographic support. I wrote my own WebGL implementation in C++ using ChakraCore as a bridge for the JS runtime. Currently, I have a working proof of concept app and I’d like to do something similar with Three.js. The issue I’m having is that Three.js of course doesn’t support the required GLSL property uHolographicViewProjectionMatrix which is provided by Microsoft’s ANGLE fork.

I suppose what I’m looking for is some guidance on how to achieve this with Three.js. We basically don’t have a need for a camera (HoloLens is a mobile platform so speed is critical, avoiding JS is necessary when dealing with the projection matrix to maximize hologram stability.)

Three.js version

https://github.com/lwansbrough/three.js/tree/holographic

Browser

None, see: https://github.com/lwansbrough/HolographicJS

OS
  • Windows
Hardware Requirements (graphics card, VR Device, …)
  • Microsoft HoloLens or HoloLens emulator

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:1
  • Comments:21 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
Mugen87commented, Apr 30, 2017

Closing. There is a basic three.js support for HoloJS, see https://github.com/Microsoft/HoloJS/pull/23

1reaction
carstenschwedecommented, Nov 23, 2016

I’m not sure how Microsoft ANGLE fork modifies the vertex shader, but at least for the “simple drawing mode” I understand that it should be sufficient to use a regular THREE.Camera with no special projection matrix and a modelView matrix based on the view matrix provided by the “Holographic App”. MS ANGLEs “magic” will double the drawing calls, rewind the view matrix transformation and apply view and projection matrices for each eye. I’m not sure how this is going to work out for more complex shader setups (e.g. it will expect the view matrix operation to be the last operation that is applied to vertices and assumes that the view matrix is only being used during the transformation of vertices but not in the fragment shader).

The “advanced drawing mode” expects you to provide instanced drawing calls for stereo rendering. The current THREE.StereoEffect works by switching cameras and re-rendering the whole scenery. If you’d like to go that route it might make sense to create some form THREE.InstancedStereoEffect first - although you would have to adapt THREE.WebGLRenderer and probably lots of the shaders as well.

The result is my render surface flashes different colours.

You are using simple mode right? Your current example uses a THREE.PerspectiveCamera with a non-identity projection matrix. You also use a THREE.MeshNormalMaterial which means the color in the fragment shader is affected based on the viewMatrix which is not “magically” corrected by ANGLE because it does not know about it. Does THREE.MeshBasicMaterial work as expected? I’ll see if I can get the HoloLens Emulator running and will give it a try.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Hololens applications using WebGL / ThreeJS - Stack Overflow
There's this new tool from Microsoft called HoloJS. It's a framework for creating holographic apps using JavaScript and WebGL.
Read more >
Heads-Up Display(s) - Resources - three.js forum
Holographic Displays A type of display that utilizes light diffraction to create a virtual three-dimensional image of an object.
Read more >
Using WebXR with Windows Mixed Reality - Microsoft Learn
Learn the basics of using and developing for WebXR applications running on Windows Mixed Reality immersive headsets.
Read more >
Hologram stability - Mixed Reality | Microsoft Learn
The HoloLens automatically stabilize holograms, but there are steps developers can take to improve hologram stability further.
Read more >
Spatial mapping - Mixed Reality | Microsoft Learn
Device supports; Why is spatial mapping important? ... Holograms floating in space or moving with the user won't feel as real.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found