Mekaboo Posted June 23, 2018 Share Posted June 23, 2018 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 Quote Link to comment Share on other sites More sharing options...
JohnK Posted June 23, 2018 Share Posted June 23, 2018 /******* 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 ******/ Mekaboo 1 Quote Link to comment Share on other sites More sharing options...
Mekaboo Posted June 23, 2018 Author Share Posted June 23, 2018 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 Quote Link to comment Share on other sites More sharing options...
Mekaboo Posted June 25, 2018 Author Share Posted June 25, 2018 Figured it out didnt add a skeleton ? Quote Link to comment Share on other sites More sharing options...
dbawel Posted June 25, 2018 Share Posted June 25, 2018 @Mekaboo If you want to add a skeleton and animation, then load the bones and if more than one animation; load these separately and you'll need to start each animation - at least from my experience - but I'm a bit old school. DB Mekaboo 1 Quote Link to comment Share on other sites More sharing options...
Dad72 Posted June 25, 2018 Share Posted June 25, 2018 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]; }); GameMonetize 1 Quote Link to comment Share on other sites More sharing options...
Mekaboo Posted June 25, 2018 Author Share Posted June 25, 2018 @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 Quote Link to comment Share on other sites More sharing options...
Dad72 Posted June 26, 2018 Share Posted June 26, 2018 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]; }); Mekaboo 1 Quote Link to comment Share on other sites More sharing options...
Mekaboo Posted June 26, 2018 Author Share Posted June 26, 2018 @Dad72 will try it out for sure! Thank ya? Mekaboo Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.