Jump to content

3d model mesh is not loading


Mekaboo
 Share

Recommended Posts

Hello there..Im trying to load model and its not loading. Here is my code:                    // The first parameter can be used to specify which mesh to import. Here we import all meshes
      BABYLON.SceneLoader.ImportMesh("happygal", "scenes/swargirl", "happygal.babylon", scene, function (newMeshes) {
          // Set the target of the camera to the first imported mesh
          camera.target = newMeshes[0];
      });

 

When I load this is what I get:

Error: WebGL warning: Failed to create WebGL context: WebGL creation failed:
* WebGL 2 requires support for the following features:
  transform_feedback2
* Exhausted GL driver options.
babylon.js:5:9041
TypeError: scene is undefined[Learn More]
index6.html:67:21
BJS - [23:23:14]: Unable to import meshes from scenes/swargirlhappygal.babylon: Failed to load scene.

Here is my complete page attached

Thank ya kindly?

Mekaboo

index6.html

Link to comment
Share on other sites

/******* Add the create scene function ******/
            var createScene = function () {} //<<<<<<< No statements in function - move } to function end

                        // Create the scene space
                        var scene = new BABYLON.Scene(engine);

                        // Add a camera to the scene and attach it to the canvas
                        var camera = new BABYLON.ArcRotateCamera("Camera", Math.PI / 2, Math.PI / 2, 2, BABYLON.Vector3.Zero(), scene);
                        camera.attachControl(canvas, true);

                        // Add lights to the scene
                        var light1 = new BABYLON.HemisphericLight("light1", new BABYLON.Vector3(1, 1, 0), scene);
                        var light2 = new BABYLON.PointLight("light2", new BABYLON.Vector3(0, 1, -1), scene);


                        // The first parameter can be used to specify which mesh to import. Here we import all meshes
      BABYLON.SceneLoader.ImportMesh("model", "scenes/swargirl", "happygal.babylon", scene, function (newMeshes) {
          // Set the target of the camera to the first imported mesh
          camera.target = newMeshes[0];
      });

           //<<<<<<<<<<<<<< No return
                /******* End of the create scene function ******/

Try

/******* Add the create scene function ******/
            var createScene = function () {
                        // Create the scene space
                        var scene = new BABYLON.Scene(engine);

                        // Add a camera to the scene and attach it to the canvas
                        var camera = new BABYLON.ArcRotateCamera("Camera", Math.PI / 2, Math.PI / 2, 2, BABYLON.Vector3.Zero(), scene);
                        camera.attachControl(canvas, true);

                        // Add lights to the scene
                        var light1 = new BABYLON.HemisphericLight("light1", new BABYLON.Vector3(1, 1, 0), scene);
                        var light2 = new BABYLON.PointLight("light2", new BABYLON.Vector3(0, 1, -1), scene);


                        // The first parameter can be used to specify which mesh to import. Here we import all meshes
      BABYLON.SceneLoader.ImportMesh("model", "scenes/swargirl", "happygal.babylon", scene, function (newMeshes) {
          // Set the target of the camera to the first imported mesh
          camera.target = newMeshes[0];
      });

         return scene;           
      }
                /******* End of the create scene function ******/

 

Link to comment
Share on other sites

THANK YOU SIR @JohnK IT WORKED?

Now another issue but it sems to be on the js side..here area the errors Im getting:

XML Parsing Error: not well-formed
Location: http://localhost/happygal.babylon
Line Number 1, Column 1:
happygal.babylon:1:1
BJS - [10:48:21]: Error while trying to load image: happygal.babylonswgalmodel_Hair_Diffuse.png
babylon.js:4:11018
BJS - [10:48:21]: Error while trying to load image: happygal.babylonswgalmodel_Hair_Opacity.png
babylon.js:4:11018
BJS - [10:48:21]: Error while trying to load image: happygal.babylonswgalmodel_Hair_Specular.png
babylon.js:4:11018
BJS - [10:48:21]: Error while trying to load image: happygal.babylonswgalmodel_Bottom_Diffuse.png
babylon.js:4:11018
BJS - [10:48:21]: Error while trying to load image: happygal.babylonswgalmodel_Bottom_Opacity.png
babylon.js:4:11018
BJS - [10:48:21]: Error while trying to load image: happygal.babylonswgalmodel_Bottom_Specular.png
babylon.js:4:11018
BJS - [10:48:21]: Error while trying to load image: happygal.babylonswgalmodel_Shoes_Diffuse.png
babylon.js:4:11018
BJS - [10:48:21]: Error while trying to load image: happygal.babylonswgalmodel_Shoes_Opacity.png
babylon.js:4:11018
BJS - [10:48:21]: Error while trying to load image: happygal.babylonswgalmodel_Shoes_Specular.png
babylon.js:4:11018
BJS - [10:48:21]: Error while trying to load image: happygal.babylonswgalmodel_Top_Opacity.png
babylon.js:4:11018
BJS - [10:48:21]: Error while trying to load image: happygal.babylonswgalmodel_Top_Diffuse.png
babylon.js:4:11018
BJS - [10:48:21]: Error while trying to load image: happygal.babylonswgalmodel_Top_Specular.png
babylon.js:4:11018
BJS - [10:48:21]: Error while trying to load image: happygal.babylonswgalmodel_Body_Diffuse.png
babylon.js:4:11018
BJS - [10:48:21]: Error while trying to load image: happygal.babylonswgalmodel_Body_Opacity.png
babylon.js:4:11018
BJS - [10:48:21]: Error while trying to load image: happygal.babylonswgalmodel_Body_Specular.png
babylon.js:4:11018

 

They are being created by this line of code:
babylon.js:4:11018 from https://cdn.babylonjs.com/babylon.js:4:11018
l
https://cdn.babylonjs.com/babylon.js:4:1353

I created my model in Fuse then in Blender..do I need to add something from those 2 or use another js from the Babylon Master folder? Attached is a updated version of the index6 file.

Thank you for all of your help!

??,

Mekaboo

 

index6.html

Link to comment
Share on other sites

It seems that your error is on the loading of the images, I do not think that this image exists for example:  happygal.babylonswgalmodel_Hair_Diffuse.png

 happygal.babylon swgalmodel_Hair_Diffuse.png

try this :  scenes/swargirl/ it will work a lot better I think

BABYLON.SceneLoader.ImportMesh("", "scenes/swargirl/", "happygal.babylon", scene, function (newMeshes) {
          // Set the target of the camera to the first imported mesh
          camera.target = newMeshes[0];
});

 

Link to comment
Share on other sites

@dbawelI tried to do an animation from Mixamo and that is impossible because they wont let you load an animation without character so Im just going to animate the T-Pose from BJS. Blender wont let me convert both character and animation to BJS together?. Since Im an extreme novice Im going to keep my animations real simple..wanted to have my character greeting folks on the 1st page but Im may nix it and just have her walking with a moving background which is perfectly fine?.

@Dad72 I noticed that adding "scenes/swargirl" the mesh is still distorted but not by much. Do I need to change up the directory that leads to it? Actually I get this error:XML Parsing Error: not well-formed
Location: http://localhost/scenes/swargirl/happygal.babylon
Line Number 1, Column 1:
happygal.babylon:1:1

Then I look at code line and this is what comes up:

{"producer":{"name":"Blender","version":"2.79 (sub 0)","exporter_version":"5.6.3","file":"happygal.babylon"},

Do I need to redo the image in Blender again?

Thank you both Sirs for your time to help me out!!

??,

Mekaboo

 

Link to comment
Share on other sites

Your file is joygal.babylon or happygal.babylon?

For your error with images you must enter a path like this:  scenes/swargirl/ and not scenes/swargirl

try like this:

BABYLON.SceneLoader.ImportMesh("", "scenes/swargirl/", "joygal.babylon", scene, function (newMeshes) {
          camera.target = newMeshes[0];
});

 

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...