Search the Community
Showing results for tags 'sceneloader'.
-
I am getting the following errors when calling ImportMesh. BJS - [14:34:00]: Unable to import meshes from data:# Blender v2.79 (sub 0) OBJ File: '' : importMesh of undefined from undefined version: undefined, exporter version: undefinedimportMesh has failed JSON parse I am using beta 1 version of Babylon and loaders because of babylonjs.loaders.module.d.ts with 3.2.0-beta.3 reported Following code give me the error import * as BABYLON from 'babylonjs'; import 'babylonjs-loaders'; uploadSaveFiles(files: File[]) { files.map((file, i) => { let reader = new FileReader(); if (isImage(file)) { reader.readAsDataURL(file); } else if (isObj(file)) { reader.readAsText(file); } else if (isMtl(file)) { reader.readAsText(file); } else { console.log("File not supported!"); } let data = reader.result; if( isObj(file)) { BABYLON.SceneLoader.ImportMesh("", "", 'data:' + data, scene, function (meshes: BABYLON.AbstractMesh[]) { meshes.forEach((mesh) => { console.log(mesh); }); }); } } } I am trying to load a Obj file from disk. The obj file has accompanying mtl and images files. I currently have a interface where the user drags and drops all appropriate files. Not sure if this is the best way. Do the accompanying files need to be in uploaded first before I can load obj file? If there is a better way to upload obj and material files let me know Thanks
-
Hello, recently i met a problem and it really troubles me. I use BABYLON.SceneLoader.Append() to load the .glb file(export from Max2babylon plugin) and it failed. The browser said: "Unable to load from ../BIM/incremental/helin.glb: importScene of undefined from undefined version: undefined, exporter version: undefinedimportScene has failed JSON parse". then i load the .gltf file, The browser said: "Unable to load from ../BIM/incremental/helin.gltf: loadAssts of unknown". It's really wired, huh? After that i use the same project load .babylon file(also export from Max2babylon plugin) correctly to make sure it's not the problem with project. And i test to load the .gltf file in a plain html file and it works, so i think it's no the problem with the file and the peoject. So i think it's a bug.(no offense)
-
I've been working on an open world project that involves a lot of loading and unloading of assets. (A virtual museum of Earth history.) SceneLoader.LoadAssetContainerAsync() seems to be the only means of tracking which and when new assets have been loaded, as SceneLoader.LoadAsync() returns only the current scene. Where I'm running into trouble is the end of the life cycle. AssetContainer does not have a dispose() method. My attempts to manually create one have thus far ended in halt & catching fire. The removeAllFromScene() method will dispose of the assets* but I'm still left with an AssetContainer object from every SceneLoader call. If I clear the assets in a different way, the assets won't garbage collect, because the AssetContainer itself still references them. Has anyone worked on a similar scenario? How did you manage large volumes of load -> use -> forget? *AssetContainer.removeAllFromScene() seems to have a problem removing instanced objects, but I've been too lazy to create a proper bug report. I promise I will!
- 2 replies
-
- open world
- dispose
-
(and 2 more)
Tagged with:
-
I think I spot an issue when importing a gltf file containing instanced meshes. It simply seems to not instanciate meshes, but make copies instead. Here the gltf json showing meshes are correctly exported: and the result (playground link, check the console) same scene exported as .babylon is OK (playground link)
- 7 replies
-
- sceneloader
- instance
-
(and 1 more)
Tagged with:
-
Hey guys, Has anyone had any luck packaging up a Babylon scene inside a Cordova app? The problem I'm having is apparently path related: I get the error message "Error status: 0 - Unable to load..". Everything works fine on the webserver though.
- 14 replies
-
- sceneloader
- phonegap
-
(and 2 more)
Tagged with:
-
Hey, I'm currently successfully loading glb files through the `BABYLON.SceneLoader.ImportMeshAsync('', rootURL, filename, scene)` method. I was wondering if (for loading times) it was possible to import meshes from a zip file containing the glb one. I could unzip and get the GLB file but, all I have is it's content but not its path. Is there a way to provide ImportMesh or ImportMeshAsync the content to load instead of its path ? Thanks in advance !
- 6 replies
-
- sceneloader
- zip
-
(and 2 more)
Tagged with:
-
Hi Everyone, i have doubt in progressHandler using importmesh BABYLON.SceneLoader.ImportMesh("", "assets/", "meshes.babylon", scenes, function (newMeshes, particleSystems, skeletons) { obstacleBig = scenes.getMeshByName("terminal"); obstacleSmall2 = scenes.getMeshByName("sky_bin"); obstacleSmall = scenes.getMeshByName("round_planter"); coin = scenes.getMeshByName("Coin"); boostObj = scenes.getMeshByName("Boost"); floor[0] = scenes.getMeshByName("Platform001"); floor[1] = scenes.getMeshByName("Platform002"); stLamp = scenes.getMeshByName("lamp"); wideAd = scenes.getMeshByName("Ad_B"); lengthAd = scenes.getMeshByName("Ad_C"); plot = scenes.getMeshByName("platform_LOD_1"); directionArrow = scenes.getMeshByName("Sign_arrow"); }, function (evt) { if (evt.lengthComputable) { loadingProgress = (evt.loaded * 100 / evt.total).toFixed(); } }, function(scenes, msg, exception){ console.log("error while loading assets"); console.log(scenes); console.log(msg); console.log(exception); } ); onprogress functions will be run at 1st time but not in second time means when i run my game at first time on pc it will run after that when i refresh/run the game the onProgress function is not executing. but it will run after clearing the cache file(only for 1st time) i can't clear cache in everytime so anyone have solution for this???
-
What is the best way to get the results--the appended bits--from BABYLON.SceneLoader.Append() ? The function for a single model, BABYLON.SceneLoader.ImportMesh(), and the function to load a new scene BABYLON.SceneLoader.Load(), both return their result, but Append() seems to only return the existing scene. I believe I understand the concept in this thread--mark everything that's already loaded before calling BABYLON.SceneLoader.Append(), at which point everything that's not marked can be assumed to come from the file load. The trouble is, if multiple files are being loaded, there's no guarantee that all of the new meshes, lights and cameras in the scene come from the same file when onSuccess fires. (This is assuming file loading happens async.) I suppose it would be possible to use BABYLON.SceneLoader.Load() to instead put the results into a new (hidden) scene, loot that scene for parts to the main scene, then delete it. That feels like a lot of overhead though. Any better ideas? [Peeling this out into its own topic, as Q&A threads don't "bump" anyway!]
-
Greetings all, I am have been a 'C' and Assembler systems coder for over 35 years. I am retired now and I want to try my hand at writing a game. I have been reading the documentation a great deal as well as looking at many examples. I have also been in communication with Dad72 who is a member here. He has been very kind. That being said I have some questions regarding the mechanics of Babylon.js. I am a real noob when it comes to this framework as I have always programmed 'on the wire' and never used a scripted language that is not strictly type cast so please forgive my ignorance. My goal is to build a 3D game that has a detective who runs around and solves crimes. He will go into several areas looking for clues and then use those clues to solve the crime. As an example, the detective may be sent to a warehouse where he will open a safe after finding the combination and then see some clues that will lead him to a suspects home. There will be human models, as well as different things that can be picked up examined and used. The story may be outside sometimes as well as inside. This is a very basic description of the mechanics of the game but I think you can see where I am going. I need some advice on what documentation I should read. What forums I should frequent and perhaps even some examples. I am really at a loss as my area is low level operating system programming in Windows, Linux, and DOS. I do have some questions about what I think may help me, so if you would not mind I would like to ask them. I have been doing some reading and stumbled upon SceneLoader.Append. Is it possible to build an entire level in Blender, then export that with the Babylon.js Blender exporter, then load that with SceneLoader.Append? Is that the best way to build the game I described. After a level is loaded can I then set up collision detection with actions? Can I bring in different models with their textures and place them in the scene after it is loaded? As an example, opening a container will expose a model that was not there before. Can I also delete models from the scene after some action. I have no idea how to accomplish any of this. I cannot load a terrain and place a model on it and keep it from falling through the terrain. I can't even build walls for a room and set up collision detection within the room. The one thing I do have is lots of time as I am retired and a clear understanding of programming principles. Thank you so much for your time, it is greatly appreciated. Regards, Richard
- 4 replies
-
- sceneloader
- collision
-
(and 1 more)
Tagged with:
-
Hello everyone, I have two questions about the SceneLoader.ImportMesh() function. 1- Does it import objects including their materials or should we do it by ourselves in the callback body ? I tried importing object from a babylon file (generated with 3DsMax plugin including materials) but the Mesh in babylon scene has no mateiral ! 2- The meshes are added automatically to the scene (given as an argument to the importScene function). But I wish to import the objects and then have the control to add the desired mesh with Scene.addMesh(newMesh) Is that possible ? Thanks A.
- 1 reply
-
- importmesh
- loadmesh
-
(and 3 more)
Tagged with:
-
Hi, I've got a problem with loading scene with .babylon extension. I making project in .NET Core with BabylonJS addon and I got a problem with this script: // Get the canvas element from our HTML below var canvas = document.querySelector("#renderCanvas"); // Load the BABYLON 3D engine var engine = new BABYLON.Engine(canvas, true); // ------------------------------------------------------------- engine.enableOfflineSupport = false; var scene = new BABYLON.Scene(engine); BABYLON.SceneLoader.Load("./js/", "babilon_blender.babylon", engine, function(newScene){ var scene = newScene; scene.executeWhenReady(function(){ scene.activeCamera.attachControl(canvas); engine.runRenderLoop(function(){ scene.render(); }); }); }); Page is build and start loading scene, but this is over. Neverending loading with Babylon mark. Could someone help me and advice what should I do to make a load scene properly? Thanks for help
- 11 replies
-
- babylonjs
- dotnetcore
-
(and 2 more)
Tagged with:
-
Hello. Is there a way to interrupt/stop BABYLON.SceneLoader.load ?
-
Hi everyone, I am working on a scene that requires import meshes from .babylon file, most of the time I debug the scene on android mobile browser, and I got this error while trying to load the scene in iphone 5 & 6 (ios 10.2.1 up to date)safari browser: Error status: 0 - Unable to load myfile.babylon this is the link of the webpage http://52.74.240.184/infographics/game_RisingSeaLevel/. I have no problem loading the scene on desktop, android mobile browser(chrome, firefox, opera), however, when I try to load the scene on iphone 6, most of the times I encounter the above error during the middle of importing mesh, if you open the webpage using iphone, there is a chance for you to stuck in the loading screen, when the error occurs. Nonetheless, there is a few times the scene can be successfully loaded, but only a few times. May I know if anyone who ever got with this error knows what is going on, as I am mainly working on the content of the 3D scene rather than handle the back-end part, thanks!
- 5 replies
-
- sceneloader
- importmesh
-
(and 2 more)
Tagged with:
-
I have an existing scene made in Babylon.js (scene1) I have a `.babylon` file (scene2) I want to append to scene1. Before appending scene2 to scene1 I want to do some operations on the meshes of scene2. `BABYLON.SceneLoader.Append` just immediately dumps everything from scene2 into the scope of scene1. This is not helpful. I have a lot of meshes in scene2 and scene1 with dynamic names so it's a lot of work to manually go through the merged array and look for the meshes that were in scene2. I was hoping I could use `BABYLON.SceneLoader.Load` for this. Load scene2, iterate over the scene2 meshes, then manually add them to scene1. Maybe I've missed something but, it doesn't like there is straightforward support for this. Seems like `BABYLON.SceneLoader.Load` is designed to load an initial scene only.
-
I think I've come across a bug with how SceneLoader handles positioning. Not sure yet whether this is BJS 2.4, or the FBXExporter code that is being used to generate a .babylon file from the FBX that I exported from Blender. When I load this file: https://drive.google.com/open?id=0BzfS-gwTfPBtMFp1bzg5N1BLOWM using BABYLON.SceneLoader.load() I can't get the correct BoundingInfo for the lower equalizer bars (38_EQBars001); it provides the same bounding info as the upper equalizer bars (37_EQBars002). e.g. for (i = 0; i < myScene.meshes.length; i++){ myScene.meshes[i].refreshBoundingInfo(); console.log("found mesh with min: id = "+myScene.meshes[i].id+", "+myScene.meshes[i].getBoundingInfo().minimum.y+", and max"+myScene.meshes[i].getBoundingInfo().maximum.y); } returns the same min and max Y values for both equalizer meshes; even though they display correctly (e.g. not the same positions). If you analyze the JSON of the .babylon file; you'll notice the position values for both meshes are almost identical. What is different is the rotation quaternion for both meshes - which makes sense because to create the 2nd set of equalizer bars, I cloned the first set and then rotated them into position; Thus my theory at this stage is that either the FBXConverter or BJS 2.4 aren't taking this into consideration. I also read this forum: However, using setTimeout in conjunction with refreshBoundingInfo() doesn't seem to have any positive effect. The downside of this all is that I can't tangentially position this model next to anything else as I don't have correct bounding info. Any help would be much appreciated.
-
I can't seem to load a babylon mesh into my scene from my server. I am familiar with the playground, but my version appends appends manifest?unixtimestamp to the resource url I provide and I get a showstopping GET error. My console reports I have a version of skull.babylon on the server but the url appended with .manifest?unixtimestamp returns a 404. I find the SceneLoader documentation a little confusing, with lots of repeated text. https://doc.babylonjs.com/classes/2.3/SceneLoader My questions: How do I get rid of the GET error? How would you code this up if you have your .babylon files in a separate folder from your root folder? I have my root folder with index.html, then a js folder and a json folder for saved .babylon mesh files. BABYLON.SceneLoader.ImportMesh("", "_json/", "skull.babylon", scene, function (newMeshes) { }); Thanks for any help! I think I am learning a lot but am often bewildered for hours.
-
I have loaded a scene exported from 3ds max. The scene includes skeletons and an animation and plays on load. If I serialize the scene and load the saved scene I do not see an animation. I can see that the loaded - serialized scene's meshes do have arrays of animations. However, scene.Animatables is empty - whereas in the original this was populated. Is there anything I can probe to see whats going on? Perhaps I am just missing a function to start all the animations?
- 4 replies
-
- sceneserializer
- sceneloader
-
(and 2 more)
Tagged with:
-
I follow a Microsoft tutorial to show a scene that I exported from 3ds Max. The tutorial link is: https://blogs.msdn.microsoft.com/eternalcoding/2013/06/28/babylon-js-how-to-load-a-babylon-file-produced-with-blender/ The Babylon scene can be seen on the Sandbox, but not offline. Here is my page code: <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Using babylon.js - How to load a scene</title> <script src="babylon.js"></script> <script src="hand.js"></script> <script src="cannon.js"></script> <!-- optional physics engine --> <script src="oimo.js"></script> <style> html, body { width: 100%; height: 100%; padding: 0; margin: 0; overflow: hidden; } #renderCanvas { width: 100%; height: 100%; } </style> </head> <body> <canvas id="renderCanvas"></canvas> <script> if (BABYLON.Engine.isSupported()) { var canvas = document.getElementById("renderCanvas"); var engine = new BABYLON.Engine(canvas, true); BABYLON.SceneLoader.Load("", "TestExportFrom3dsMax.babylon", engine, function (newScene) { // Wait for textures and shaders to be ready newScene.executeWhenReady(function () { // Attach camera to canvas inputs newScene.activeCamera.attachControl(canvas); // Once the scene is loaded, just register a render loop to render it engine.runRenderLoop(function() { newScene.render(); }); }); }, function (progress) { // To do: give progress feedback to user }); } </script> </body> </html> How to show the Babylon scene on web browser offline?
- 3 replies
-
- babylon js
- scene
-
(and 3 more)
Tagged with:
-
Load a scene from a file, serialize it and count the number of materials in the serialized string. You will see that the material count in the string is double the count in the file. Serialization doubles the count. I checked the code and I think it has to do with the way the loader and serializer work together. Loader, while loading, loads each material in the file as StandardMaterial into the scene. The Serializer while serializing adds all the material in the scene to the JSON object and then adds the material again if it is StandardMaterial - effectively doubling the count. I am working on an app which allows the user to serialize and save the scene to a file and I noticed that over subsequent saves the file kept getting bigger and bigger even though no changes were made to the scene, which is when I started looking into this issue.
-
Hi! Perhaps i found another small moustached features 1. If we turn on tags for object (EnableFor(obj), but not set any tags, then SceneSerializer save lexeme like this: "tags":{ } It's Ok. 2. If we try load such scene file, we got error: babylon.2.2.max.js:27559 Uncaught TypeError: tagsString.split is not a function I think we need check string of tags on empty, we haven't split string in this case.
- 4 replies
-
- tags
- serializer
-
(and 1 more)
Tagged with:
-
The latest commits by DK, labelled as "Keep working on serialization refactoring", on the 2.3 alpha preview release started giving me SceneLoader.ImportMesh error as follow: Unable to import meshes from /location/file.babylon (Exception: TypeError: y.ParseMultiMaterial is not a function)An even more recent commit, labelled as "Serialization/Parsing refactoring done", gave me this instead: Unable to import meshes from /location/file.babylon (Exception: TypeError: y.Parse is not a function)The latest commit as of this time of writing still gives me the above error message. My mesh exported out from and using the Blender Exporter (version 3.0.6) imports and loads without errors with the previous commits. (Was wondering why the screen was stuck at the preloader until I decided to stick an onerror callback function into the mesh loader.) I don't see updates to the Blender Exporter or I'd try that. p/s: Oh and by the way, hi there, all of you kind souls on here. I've been stalking these forums a lots this past week when I decided to start my webGL exploration with Babylon.js. Also been itching to communicate and I finally found enough reason to create an account for this post. Cheers!
- 10 replies
-
- parsing
- SceneLoader
-
(and 1 more)
Tagged with:
-
I am trying to test a scene I created in Blender, but I keep getting the following error. "Uncaught TypeError: Cannot read property 'attachControl' of undefined" Here is my code: if (BABYLON.Engine.isSupported()) { var canvas = document.getElementById("renderCanvas"); var engine = new BABYLON.Engine(canvas, true); BABYLON.SceneLoader.Load("", "realestate.babylon", engine, function (newScene) { // Wait for textures and shaders to be ready newScene.executeWhenReady(function () { // Attach camera to canvas inputs newScene.activeCamera.attachControl(canvas); // Once the scene is loaded, just register a render loop to render it engine.runRenderLoop(function() { newScene.render(); }); }); }, function (progress) { // To do: give progress feedback to user }); }I have been away from Babylon.js for a little while, I figured I may have missed something, but I am not sure. I have searched to see if this has been a problem that has been solved. Any help you can give is much appreciated.Thank you.
-
Hello, I have been trying to understand how to use the 3ds max exported binary format. My understanding that it is for incremental loading (loading what the camera sees) ? I have tried importing the exported file into my scene but I only get one mesh: BABYLON.SceneLoader.ImportMesh("", "3ds/Binary/", "testBinary.binary.babylon", scene); hopefully someone can shine some light on this?
-
Hi all. I am quite new to Babylon.js as well as Javascript so I guess this problem I have has a simple solution but I have been trying for a few hours now without success. I have a simple SceneLoader.Load routine to load a 3dsmax scene into my project, the scene contains a few meshes a light and a camera. All I wish to do is implement an ArcRotateCamera using the Betalimit and Alphalimit for restrictions but I can't seem to get it to move at all, so obviously I am doing something wrong, if anyone can point me in the wright direction I would be very grateful. Here is the code I am using. BABYLON.SceneLoader.Load("scenes/", "test.babylon", engine, function (scene) { scene.executeWhenReady(function () { var camera = new BABYLON.ArcRotateCamera("camera", 130.4, 1.3, 120, BABYLON.Vector3.Zero(), scene); camera.attachControl(canvas, true); scene.lights[0].intensity = 1.2; // Add shadows var shadowGenerator = new BABYLON.ShadowGenerator(2048, scene.lights[0]); for (var i = 0; i < scene.meshes.length; ++i) { shadowGenerator.getShadowMap().renderList.push(scene.meshes); shadowGenerator.setDarkness(0.8); scene.meshes.receiveShadows = true; }; camera.lowerBetaLimit = 1.2; camera.upperBetaLimit = 1.4; camera.lowerAlphaLimit = 129.9; camera.upperAlphaLimit = 130.9; // Once the scene is loaded, just register a render loop to render it engine.runRenderLoop(function() { scene.render(); }); }); });