Jump to content

Load a *.glb model off local drive with babylon.viewer.js


KerwinK
 Share

Recommended Posts

Can anyone please tell me if it is possible to load a *.glb file off a local drive with Babylon.viewer.js?

Note: I have a valid glb file I named part2.glb... and it works fine to display locally in the Mixed Reality viewer in Windows 10... and also up in Remix 3D community models page.

However, when I try to open it off a local drive with the simple 2 line HTML syntax (see below) I receive an error in the browser page display "Error loading the model".

<head>
    <title>Babylon.js Viewer - Display a 3D model</title>
    <!-- <script src="https://preview.babylonjs.com/viewer/babylon.viewer.js"></script> -->
    <script src="C:\Babylon.js\Babylon.js-master\dist\viewer\babylon.viewer.js"></script>
</head>
<body>
   <!-- <babylon model="https://models.babylonjs.com/boombox.glb" templates.main.params.fill-screen="true"></babylon> -->
   <babylon model="C:\part2.glb" templates.main.params.fill-screen="true"></babylon> -->   
</body>

 

Link to comment
Share on other sites

@deltakosh  thank you for the suggestion...  here is the error it is displaying:

BJS - [16:28:19]: Load Error: There was an error loading the model. Unable to import meshes from //part2.glb: Failed to load scene.

Note: As I mentioned in my original post... the model works fine to display locally in the Mixed Reality viewer in Windows 10 and also up in Remix 3D community models page.

Link to comment
Share on other sites

I solved the issue of being able to open a *.glb file on a local drive.  Placing Babylon.viewer.js and part.glb within the same folder and referencing directly as shown below in the snippet (i.e. with no folder path specification) it works. 

<!DOCTYPE html>

<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>Babylon.js Viewer - Display a 3D model</title>
    <!-- <script src="https://preview.babylonjs.com/viewer/babylon.viewer.js"></script> -->
    <script src="babylon.viewer.js"></script>
        </head>
<body>
    <!-- <babylon model="https://models.babylonjs.com/boombox.glb" templates.main.params.fill-screen="true"></babylon> -->
    <babylon model="part2.glb" templates.main.params.fill-screen="true"></babylon> 
</body>
</html>

 

Link to comment
Share on other sites

  • 1 year later...
On 9/18/2018 at 5:50 AM, KerwinK said:

I solved the issue of being able to open a *.glb file on a local drive.  Placing Babylon.viewer.js and part.glb within the same folder and referencing directly as shown below in the snippet (i.e. with no folder path specification) it works. 

I tried the same but it did not work?
COuld you send me your files in a zip ?
Thx a lot.
Very important to me. I can grant you some little money for that.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...