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

Preview failing for Babylon and Cesium in MacOS #58

Closed
donmccurdy opened this issue Nov 11, 2017 · 23 comments · Fixed by #73
Closed

Preview failing for Babylon and Cesium in MacOS #58

donmccurdy opened this issue Nov 11, 2017 · 23 comments · Fixed by #73
Labels

Comments

@donmccurdy
Copy link

Getting errors when trying to open sample models. I tested with the WaterBottle directory and tried previewing the .glTF files:

screen shot 2017-11-11 at 3 42 24 pm

screen shot 2017-11-11 at 3 42 23 pm

screen shot 2017-11-11 at 3 43 51 pm

@emackey emackey added the bug label Nov 12, 2017
@michaelybecker
Copy link

+1. Mbp, High Sierra.

On Babylon.js preview:

#/buffers/0: Failed to load 'scene.bin': 0

On Cesium:
Cesium Error: RuntimeError: Failed to load buffer: file://Users/mhazani/Desktop/mech_drone/scene.bin Error at new t (file:///Users/mhazani/.vscode/extensions/cesium.gltf-vscode-2.1.0/engines/Cesium/Cesium.js:518:4127) at Ce.Le.t (file:///Users/mhazani/.vscode/extensions/cesium.gltf-vscode-2.1.0/engines/Cesium/Cesium.js:559:5999) at i.then (file:///Users/mhazani/.vscode/extensions/cesium.gltf-vscode-2.1.0/engines/Cesium/Cesium.js:516:27958) at file:///Users/mhazani/.vscode/extensions/cesium.gltf-vscode-2.1.0/engines/Cesium/Cesium.js:516:28436 at m (file:///Users/mhazani/.vscode/extensions/cesium.gltf-vscode-2.1.0/engines/Cesium/Cesium.js:516:29818) at f (file:///Users/mhazani/.vscode/extensions/cesium.gltf-vscode-2.1.0/engines/Cesium/Cesium.js:516:28572) at n (file:///Users/mhazani/.vscode/extensions/cesium.gltf-vscode-2.1.0/engines/Cesium/Cesium.js:516:28096) at i.then (file:///Users/mhazani/.vscode/extensions/cesium.gltf-vscode-2.1.0/engines/Cesium/Cesium.js:516:27958) at file:///Users/mhazani/.vscode/extensions/cesium.gltf-vscode-2.1.0/engines/Cesium/Cesium.js:516:28446 at m (file:///Users/mhazani/.vscode/extensions/cesium.gltf-vscode-2.1.0/engines/Cesium/Cesium.js:516:29818)

On three.js there's no error, but nothing shows up.
The model is glTF2, a Mech drone downloaded from Sketchfab.

WebGL is otherwise running fine on my computer so I'm thinking this is something local.

@emackey
Copy link
Member

emackey commented Nov 15, 2017

Yeah there's a shortage of MacOS devices around here to test & debug. Trying to get that problem fixed first.

@michaelybecker
Copy link

michaelybecker commented Nov 15, 2017 via email

@emackey
Copy link
Member

emackey commented Nov 15, 2017

If you or @donmccurdy or any web developer reading this wants to take a stab before I manage to get my hands on someone else's hardware (just to borrow, of course), you can actually debug this directly from the market-installed extension, without building from source. The instructions for actually getting a Chrome DevTools open are sadly a bit convoluted in that they open the "wrong" DevTools before you get to the right one. But once you get there, you can check the network tab for errors, you can break on JavaScript exceptions, all the usual stuff. Of particular interest seems to be why the URI given for the bin file is not resolving. It's an Electron environment, so local filesystem access is enabled. What's different about the bin uri compared to some of the other uris that do resolve?

@michaelybecker
Copy link

michaelybecker commented Nov 15, 2017 via email

@lexaknyazev
Copy link

Same error in Ubuntu 17.10.

@lexaknyazev
Copy link

virtualbox_ubuntu_16_11_2017_12_28_30

@emackey
Copy link
Member

emackey commented Nov 17, 2017

I have a partial fix going in branch path-problems. But, this branch breaks BabylonJS previews across all platforms. There's a bad assumption in Babylon.Tools.LoadFile that if the URL contains file: then it must be from dropped files, not local files with access enabled.

I'll write up a bug for them... it will be convoluted. Also I have thoughts for a workaround here, involving either base href or monkey-patches on top of Babylon, neither of which are ideal...

@emackey
Copy link
Member

emackey commented Nov 17, 2017

Basically, on master now we're supplying local file URLs without the protocol. This works fine on Windows, where the drive letter itself forms the needed clue to access a local file:

c:/path/to/file.bin

But on Mac and Linux systems, there's no drive letter, so, the path ends up looking like a host-relative path, not a true absolute path:

/mnt/path/to/file.bin

This gets interpreted with completely the wrong protocol (the custom glTF preview protocol). The correct solution appears to be to add the intended protocol:

file:///c:/path/to/file.bin

file:///mnt/path/to/file.bin

This fixes it for Cesium and ThreeJS. But Babylon makes a very poor assumption on this line right here, and gets confused by the presence of file: into not sending an XHR request for the file. This leads to Babylon failing where the other two succeed.

@emackey
Copy link
Member

emackey commented Nov 18, 2017

Oh look, I was wrong. Cesium messes up file: URLs too, just in a different way. PR on the way.

@emackey
Copy link
Member

emackey commented Nov 18, 2017

@MichaelHazani If you have a minute, please try out branch path-problems-cesium-unminified. Does it work for you? In particular, the sample models "NormalTangentTest" and "DamagedHelmet" both have very shiny surfaces, do they work in all three engines?

@michaelybecker
Copy link

Checking! (Will update w/results shortly)

@emackey
Copy link
Member

emackey commented Nov 18, 2017

Try pressing Option-P (what would be CTRL-P on Windows) and typing task watch into the launch bar that appears.

@michaelybecker
Copy link

michaelybecker commented Nov 18, 2017

(Sorry for deleting the previous comment; I thought it was related to forgetting to yarn beforehand, but it persists and is probably unrelated)
Getting a The terminal process terminated with exit code: 254 even on task watch, with no debugger errors...

Getting the same stack on the Master branch. For posterity (because I deleted the previous message):
/Applications/Visual Studio Code.app/Contents/MacOS/Electron --debugBrkPluginHost=44351 --debugId=36608adf-447b-481e-9b8a-5465a6006836 --extensionDevelopmentPath=/Users/Michael_MBP/Desktop/gltf-vscode Activating extension cesium.gltf-vscodefailed: Cannot find module '/Users/Michael_MBP/Desktop/gltf-vscode/out/src/extension'. Activating extensioncesium.gltf-vscodefailed: Cannot find module '/Users/Michael_MBP/Desktop/gltf-vscode/out/src/extension' Here is the error stack: Error: Cannot find module '/Users/Michael_MBP/Desktop/gltf-vscode/out/src/extension' at Function.Module._resolveFilename (module.js:470:15) at Function.Module._load (module.js:418:25) at Function.$.J.t.getExtensionPathIndex.then.o._load (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:4:484450) at Module.require (module.js:498:17) at require (internal/module.js:20:19) at Function.a [as __$__nodeRequire] (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/loader.js:4:27799) at /Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:4:504789 at t._doActivateExtension (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:4:504901) at t._activateExtension (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:4:503463) at Object.actualActivateExtension (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:4:501641)

@emackey
Copy link
Member

emackey commented Nov 18, 2017

What version of node is installed? I'm using 8.9.0, and older versions may not work. Are you opening the root folder of gltf-vscode in VSCode for this? (Meaning, you're not trying to "install" the extension from the source tree itself, right?)

@michaelybecker
Copy link

michaelybecker commented Nov 18, 2017

Hmm. Upgrading 8.7 to 9.2 didn't solve the issue - same errors.
And yes, exactly, I'm opening the gltf-vscode folder and hitting F5.

btw - @donmccurdy, have you had any luck loading and running the extension locally (on either branch)? I have a strong hunch this is a local problem.

@michaelybecker
Copy link

michaelybecker commented Nov 18, 2017

Also, this could still be a path error.
Activating extension 'cesium.gltf-vscode' failed: Cannot find module '/Users/Michael_MBP/Desktop/gltf-vscode/out/src/extension'. extensionHostProcess.js:4

Clearly, "out" doesn't belong there - the path should be "gltf-vscode/src/extension". But it's nontrivial to debug - I'm not sure where the config for that path is set...

@emackey
Copy link
Member

emackey commented Nov 18, 2017

"out/src" is where the compiled files go. There's no extension subfolder under that. You should see some .js and some .js.map files in out/src after you compile it.

@michaelybecker
Copy link

michaelybecker commented Nov 18, 2017

Didn't realize I had to compile first! The local dev instructions in the VS Code docs could be clearer...

Fundamentally I think you solved it - working on Babylon. Cesium is throwing an error because apparently the model uses a KHR extension (understandable), and still nothing on threejs - gonna try on a simpler model.

screen shot 2017-11-18 at 14 23 43

@emackey
Copy link
Member

emackey commented Nov 18, 2017

The task watch thing is the compile step. There should be a status bar at the bottom with a number 2 next to a wrench+screwdriver icon, showing two watchers running.

Glad you got it working! And yes we expect the KHR extension message, we're going to add support for that to Cesium at some point. I think there's still some lingering initial scale/position problems in both the Cesium and ThreeJS viewers, I need to look into that too.

@michaelybecker
Copy link

michaelybecker commented Nov 18, 2017

Okay, got the simple red box from the sample models working on all three engines. Beautiful!

If it's not too much trouble, please leave a note here when the extension is officially updated - can't wait to reload it and put it into everyday use.

And thanks for shedding light on the VS Code extension dev process as well!

@emackey
Copy link
Member

emackey commented Nov 19, 2017

Will do. I think this branch is basically ready to go, except that it's using a not-yet-official branch of Cesium. Once CesiumGS/cesium#5989 gets reviewed & merged, this will be ready.

@emackey
Copy link
Member

emackey commented Dec 1, 2017

Published as 2.1.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants