Kefniark Posted October 16, 2018 Share Posted October 16, 2018 Hello there, I have a weird behavior and I can't figure what is really going on here. I have a babylon scene which works fine in my browser, electron, ... For my workflow I was planning to use the null engine to be able to do some preprocessing through CLI (mesh merging, lightmap baking, navigation mesh, ...). It seems to work, the engine is loading fine, xhr2 seems to work ok, my mesh are loaded but my textures are not. I use this code to load my different assets (exactly the same code than the browser version): // Loading Mesh const modelTask = assetsManager.addMeshTask(modelId, null, "assets/models/", modelId + ".babylon"); modelTask.onSuccess = (task) => console.log("loaded mesh", modelId, task.rootUrl, !!task.loadedMeshes, task.taskState); modelTask.onError = (task, message, exception) => console.error(message, exception); // Load Textures const textureTask = assetsManager.addTextureTask(textureId, "assets/textures/" + textureId, false, true); textureTask.onSuccess = (task) => console.log("loaded texture", textureId, task.url, task.texture, task.taskState); textureTask.onError = (task, message, exception) => console.error(message, exception); So something quite standard which work fine in the browser But in node cli: Loading JSON: console.log("loaded map", name, task.url, !!task.text, task.taskState); >> loaded map map1 http://localhost:8000/data/maps/map1.json true 2 Loading Mesh: console.log("loaded mesh", modelId, task.rootUrl, !!task.loadedMeshes, task.taskState); >> loaded mesh wall http://localhost:8000/assets/models/ true 2 Loading Texture: console.log("loaded texture", textureId, task.url, task.texture, task.taskState); >> loaded texture Bricks.png http://localhost:8000/assets/textures/Bricks.png undefined 2 So it turns out that both json and meshes are loaded properly. But my texture loading task created with `assetsManager.addTextureTask` onSuccess is called ? task.taskState is 2 ? task.texture is undefined ? How can onSuccess be called if the texture is not loaded ? Is it a known limitation of the null engine (Cannot load textures, only meshes) ? I was able to reproduce that here https://playground.babylonjs.com/#9I07DU#1 Just comment/uncomment the 3rd line (declaration of nullEngine) to switch engine Quote Link to comment Share on other sites More sharing options...
Guest Posted October 16, 2018 Share Posted October 16, 2018 Everything related to DOM or webgl is not supported by the nullEngine. In your case the images cannot be loaded because they rely on the Image tag to decode the files Quote Link to comment Share on other sites More sharing options...
Kefniark Posted October 17, 2018 Author Share Posted October 17, 2018 OK it makes sense, so does that mean that uncompressed textures should work ? Quote Link to comment Share on other sites More sharing options...
Guest Posted October 18, 2018 Share Posted October 18, 2018 Nope as all textures are just ignored by the nullengine (because even BMP files are loaded using Image tag) 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.