• Content Count

  • Joined

  • Last visited

About snupas

  • Rank

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. It would be kinda hard to reproduce cause of the custom meshes and materials. I sorta solved it though. Put the secondaryAssetsManager.load() function in the success callback of the mainAssetsManager like so: var mainAssetsManager = new BABYLON.AssetsManager(scene); var secondaryAssetsManager = new BABYLON.AssetsManager(scene); mainAssetsManager.useDefaultLoadingScreen = false; secondaryAssetsManager.useDefaultLoadingScreen = false; var userId = "example"; var mainMesh = mainAssetsManager.addMeshTask("mesh"+0,"","./dist/assets/",userId+"_"+0+".obj"); var meshTasks = []; for(var x = 2; x<23; x++){ if(x%2==0){ meshTasks.push(secondaryAssetsManager.addMeshTask("mesh"+x,"","./dist/assets/",userId+"_"+x+".obj")); } } mainMesh.onSuccess = function (task) { console.log(task); secondaryAssetsManager.load(); } mainAssetsManager.load(); The loading looks like this now: Makes sense since before the secondary assetsmanager was firing off right after the first in code, but not in execution. Don't mind the lag as long as there's the initial mesh up in the scene with the correct material loaded.
  2. Sure. This is the playground with the stripped down code and stock meshes: And this is a gif video of my website loading the actual models. The first model should be an extremely skinny one, but it starts off with displaying a model loaded with the secondary assetsmanager. And as you can see it only loads the material at the end, even though all of the models come with a material. You can also see it first displays all the manifest errors for all of the models from both assetsmanagers before any model is loaded from either.
  3. I'm importing roughly 22 .obj models via the AssetsManager, but I want the user to be able to see the first model loaded in the scene while the others are being imported. I've tried separating the main mesh that's supposed to appear in a separate AssetsManager like so: var mainAssetsManager = new BABYLON.AssetsManager(scene); var secondaryAssetsManager = new BABYLON.AssetsManager(scene); var userId = "example"; mainAssetsManager.useDefaultLoadingScreen = true; secondaryAssetsManager.useDefaultLoadingScreen = false; var mainMesh=mainAssetsManager.addMeshTask("mesh"+0,"","./dist/assets/",userId+"_"+0+".obj") var meshTasks = []; for(var x = 2; x<23; x++){ if(x%2==0){ meshTasks.push(secondaryAssetsManager.addMeshTask("mesh"+x,"","./dist/assets/",userId+"_"+x+".obj")); // meshTasks.onSuccess = function (task) { // fatsos.push([task.loadedMashes[0],task.loadedMashes[1],task.loadedMashes[2]]); // console.log("mesh"+x+" loaded succesfuly."); // } } } mainAssetsManager.load(); secondaryAssetsManager.load(); The loading screen disappears after half a second, so I assume the first model gets loaded, but it doesn't appear in the scene until the rest of the models have been loaded, even though for the other models I've disabled the loading screen.
  4. Ahh firefox properly outputs the error: Error: WebGL warning: Exceeded 16 live WebGL contexts for this principal, losing the least recently used one. How am I exceeding 16 live webgl contexts with a single copy? EDIT: Nevermind, that doesn't relate to this error, I don't get this error in Chrome or Edge.
  5. I'm trying to test out morphtargets, so I load up a scene and try to create a copy of the original mesh to then scale it and morph between the two, but for some reason the original mesh isn't being rendered anymore, plus the copy isn't hidden with setEnabled(). If I remove all of the copy code, the original mesh starts being rendered fine again. var scene; var mesh; var meshCopy; if (BABYLON.Engine.isSupported()) { var canvas = document.getElementById("renderCanvas"); var engine = new BABYLON.Engine(canvas, true); BABYLON.SceneLoader.Load("assets/2/", "untitled.babylon", engine, function (newScene) { newScene.executeWhenReady(function () { // Attach camera to canvas inputs newScene.activeCamera.attachControl(canvas); scene = newScene; mesh = scene.meshes[0]; mesh.convertToFlatShadedMesh(); meshCopy = mesh.clone("1"); meshCopy.x -=10; // meshCopy.parent = mesh; meshCopy.setEnabled(false); meshCopy.position.y =+ 1; meshCopy.scaling = new BABYLON.Vector3(1.1, 1.5, 1.0); meshCopy.bakeCurrentTransformIntoVertices(); var manager = new BABYLON.MorphTargetManager(); mesh.morphTargetManager = manager; //var target = BABYLON.MorphTarget.FromMesh(meshCopy, "instance1", 0.25); engine.runRenderLoop(function() { newScene.render(); }); }); }, function (progress) { }); }
  6. I was wondering where to start in terms of adjusting the rigged 3D model, what variables are involved, what are the prerequisites? If there is something that exists there that I could build off of, that would be great. Thanks.
  7. Solution was to show the bootstrap modal on page load with 0 opacity and z-index of -2 and allow everything to load up while being invisible on the web page and not obstructing anything. Then when I need to prepare to show it, I hide the modal, set back opacity to 1 and z-index to bootstrap modal default of 1050. $('#myModal').modal('toggle'); $("#myModal").css({ opacity: 0, 'z-index': -2, }); $('#myModal').modal('toggle'); $("#myModal").css({ opacity: 1, 'z-index': 1050, }); Not really a babylon.js library related bug, but someone that's using babylon.js in an iframe situation could end up in the same situation.
  8. Thanks for the input, But apparently the bug is more so related to the canvas element being inside of a hidden iframe. So the parent element of the iframe that has the babylon js document is hidden initially, so certain canvas functions you can't perform in Firefox on such an element. In my case it's a bootstrap modal, so I can't use the opacity:0 workaround instead of having it hidden... In case anyone else stumbles upon this:
  9. Cordova is still the equivalent of running a chromium tab, if not slightly slower. The only performance boost you'd get is that you wouldn't have to serve the scene files from a server necessarily.
  10. Was just trying to draw some axis for transformations based on some already working code on the forums/playground and I keept getting errors in Firefox that points to the i.prototype.drawText function in the babylon js library. Here's the error: Here's the source: var showAxis = function (size) { var makeTextPlane = function (text, color, size) { var dynamicTexture = new BABYLON.DynamicTexture("DynamicTexture", 50, scene, true); dynamicTexture.hasAlpha = true; dynamicTexture.drawText(text, 5, 40, "bold 36px Arial", color, "transparent", true); var plane = new BABYLON.Mesh.CreatePlane("TextPlane", size, scene, true); plane.material = new BABYLON.StandardMaterial("TextPlaneMaterial", scene); plane.material.backFaceCulling = false; plane.material.specularColor = new BABYLON.Color3(0, 0, 0); plane.material.diffuseTexture = dynamicTexture; return plane; }; var axisX = BABYLON.Mesh.CreateLines("axisX", [ new BABYLON.Vector3.Zero(), new BABYLON.Vector3(size, 0, 0), new BABYLON.Vector3(size * 0.95, 0.05 * size, 0), new BABYLON.Vector3(size, 0, 0), new BABYLON.Vector3(size * 0.95, -0.05 * size, 0) ], scene); axisX.color = new BABYLON.Color3(0, 0, 1); axisX.position.z += 20; axisX.position.y -= 4; axisX.position.x -= 40; var xChar = makeTextPlane("X", "red", size / 10); xChar.position = new BABYLON.Vector3(0.9 * size, -0.05 * size, 0); var axisY = BABYLON.Mesh.CreateLines("axisY", [ new BABYLON.Vector3.Zero(), new BABYLON.Vector3(0, size, 0), new BABYLON.Vector3(-0.05 * size, size * 0.95, 0), new BABYLON.Vector3(0, size, 0), new BABYLON.Vector3(0.05 * size, size * 0.95, 0) ], scene); axisY.position.z = 34 axisY.position.y = -20; axisY.position.x += offset; axisY.color = new BABYLON.Color3(0, 0, 1); var yChar = makeTextPlane("Y", "green", size / 10); yChar.position = new BABYLON.Vector3(0, 0.9 * size, -0.05 * size); }; I tried both preview and stable versions of babylon.js, both with the majority of components included.
  11. Cheers mate, just what i needed :).
  12. Hello, Does Babylon JS have some built in functionality for transform controls(the likes you would see in your average 3D manipulation software), or any examples that I could start building off of? Three js example of this. Thanks.
  13. Quick question, I'm trying to export a unity scene and utilize with babylon js. 5 Using the deprecated exporter seems straight forward and actually works, is there a reason to use the other one and is it ready for prime time? Thanks