Search the Community
Showing results for tags 'Tower of Babel'.
-
Hi Thanks for the great BJS and TOB exporter, the meshes could be generated from Blender and rendered in BJS environment efficiently. However I find out something interesting that JS heap increases when the mesh is instanced in the scene. But the heap size could not be decreased when the mesh is disposed. I’m curious whether this will cause some memory issues(such as memory leak). Here is the demo of the system: https://willlinifm.github.io/Playground_bjs/index.html The Source code is as the following or the link : https://willlinifm.github.io/Playground_bjs/js/Scene.js If the playground is better for debugging, please try this link. The implementation and the outcome are nearly the same. (Click Sphere to generate mesh //// Click ground to dispose it) https://www.babylonjs-playground.com/#4GQCEL#2 The attachment are the heap snapshots ! 。The heap1 snapshot is took before the mesh is made an instance by TOB-generated-js file 。The heap2 heap snapshot is took after the mesh is made an instance by TOB-generated-js file. We can find that the heap size is increased. 。The heap3 snapshot is somehow hard to understand that when the mesh dispose function is called, the heap size still raise a high level compared to the first snapshot. NO~~ My questions are 1. If the meshes are generated and the Js heap size is increasing at the same time. Will it cause the memory issue and make the system run slowly? 2. How to make the best to decrease the heap size after mesh dispose process. 3. I’m not sure, but during watching the snapshot constructor information, I find there may be some looping references within BJS/TOB/MeshFactory structure. Will it cause the GC(Garbage Collection) unable to release memory? Thank you ! BJS and everything here are awesome!
-
Hi, my friends, Recently I try TOB ( tower of babel) exporter to get the mesh for babylonjs. I try to export the shape keys under the group of ENTIRE_MESH config. However, after I deform another shape key after the first shape key is deformed completely. I find it initially referenced the BASIS shape key group and then execute the next shape key . It seems to be fixed in the QI lib.js . I'm wondering if there is any approach that I can make the following happens? ------------------------------------------ Blender ShapekeyA ( from 0~1, default as 0) Blender ShapekeyB ( from 0~1, default as 0) key = Qi.deformation("ENTIRE_MESH" ,"ShapekeyA", 1 , duration) mesh.queueSingleEvent(key); key = Qi.deformation("ENTIRE_MESH" ,"ShapekeyB", 1 , duration) mesh.queueSingleEvent(key); =======> in the recommened way, finally, I can get the mesh with (ShapekeyA=1 )&& (ShapekeyB=1) instead of ( ShapekeyA returing to BASIS ) && ( ShapekeyB=1) Any advice will be appreciated Thank you so much!
-
I attach model. And test project (look below). You don't need any server to test it. Just export project zip file and run html in browser! Original exported ToB file is in directory. (I change this file by hand (some lines in code) and seve it in ProjectTest/js/ToB/1/ModelFInish.js. What I would like to achive is to add BoxImpostors on each box/cube/mesh which is named as BoxCollider* Note: There are boxes which have instances !!! When I change code by hand and save in ProjectTest/js/ToB/1/ModelFInish.js. I setup scene in file indexToB.html I add code (for both physics, you can test/try/run any of this but you should comment one of each. scene.enablePhysics( new BABYLON.Vector3(0, -10, 0), new BABYLON.CannonJSPlugin() ); //scene.enablePhysics( new BABYLON.Vector3(0,-10,0), new BABYLON.OimoJSPlugin() ); MAIN PROBLEM HERE IS WHY COLLISION BETWEEN "Ball" AND "BoxCollider.135" DOES NOT WORK! AM I MISSING ANYTHING? WHAT IS THE PROBLEM? CAN ANYBODY TAKE A LOOK AND HELP ME SOLVE THE PROBLEM? IT WILL BE VERY GOOD TO TAKE A LOOK AN TEST IT ALSO INSTANCES AND PHYSICS IMPOSTORS! IF YOU CAN FIND A PROBLEM WHY COLLISION NOT WORKS AND THAN IF YOU CAN CHANGE/FIX CODE OF ToB EXPORTER SO THAT COLLISION DEFINED IN BLENDER FILE AND/OR CHECKCOLLISION CAN BE PROPERLY GENERATED WHEN WE EXPORT FROM .BLENDER TO ToB .JS THAN THIS COULD BE VERY GOOD EXPORTER WITH COLLISIONS FOR BABYLONJS !!! PLEASE LET ME KNOW IF ANYBODY FIND A ERROR IN CODE AND IF AUTOR OF ToB EXPORTER CAN FIX/ADD/REPAIR EXPORTER SO THAT COLLISION/IMPOSTORS CODE IN JS WILL BE SO THAT COLLISION WILL WORKS IN BABYLONJS WHEN WE IMPORT "ModelFInish.initScene(scene);" ToB .js file. What I have change in code by hand! ProjectTest/js/ToB/1/ModelFInish.js Ball: ----- //this.setPhysicsState({ impostor: 1, mass: 1, friction: .5, restitution: 0}); this.physicsImpostor = new BABYLON.PhysicsImpostor( this, BABYLON.PhysicsImpostor.SphereImpostor, { mass : 0.2, friction : 0.5, restitution : 0 }, scene); And Box collider under Ball and its instances BoxCollider.134 or BoxCollider_134 is main box mesh and it have its instances. I also add checkCollisions = true;! I change (this boxes/cubes should be colliders/BoxImpostors with mass 0 (I also add //this.setPhysicsState({ impostor: 2, mass: 0, friction: .5, restitution: 0}); this.checkCollisions = true; this.physicsImpostor = new BABYLON.PhysicsImpostor( this, BABYLON.PhysicsImpostor.BoxImpostor, { mass : 0, friction : 0.5, restitution : 0.5 }, scene); and.. // add below two lines instance.checkCollisions = true; instance.physicsImpostor = new BABYLON.PhysicsImpostor( instance, BABYLON.PhysicsImpostor.BoxImpostor, { mass : 0.0, friction : 1, restitution : 0 }, --------------------------------------------- var BoxCollider_134 = (function (_super) { __extends(BoxCollider_134, _super); function BoxCollider_134(name, scene, materialsRootDir, source) { _super.call(this, name, scene, null, source, true); if (!materialsRootDir) { materialsRootDir = "./"; } defineMaterials(scene, materialsRootDir); //embedded version check var cloning = source && source !== null; var load = _B.Tools.Now; var geo = 0; var shape = 0; this.position.x = 0; this.position.y = 0; this.position.z = 0; this.rotation.x = 0; this.rotation.y = 0; this.rotation.z = 0; this.scaling.x = 1; this.scaling.y = 1; this.scaling.z = 1; this.id = this.name; this.billboardMode = 0; this.isVisible = false; //always false; evaluated again at bottom this.setEnabled(true); // add below line this.checkCollisions = true; this.receiveShadows = false; this.castShadows = false; if (!scene.isPhysicsEnabled()) { scene.enablePhysics(); } //this.setPhysicsState({ impostor: 2, mass: 0, friction: .5, restitution: 0}); this.checkCollisions = true; this.physicsImpostor = new BABYLON.PhysicsImpostor( this, BABYLON.PhysicsImpostor.BoxImpostor, { mass : 0, friction : 0.5, restitution : 0.5 }, scene); if (!cloning){ geo = _B.Tools.Now; this.setVerticesData(_B.VertexBuffer.PositionKind, new Float32Array([ -5,.5,-5,-5,-.5,5,-5,-.5,-5,-5,.5,5,5,-.5,5,-5,-.5,5,5,.5,5,5,-.5,-5,5,-.5,5,5,.5,-5,-5,-.5,-5,5,-.5,-5,5,-.5,5,-5,-.5,-5,-5,-.5,5,-5,.5,5,5,.5,-5 ,5,.5,5,-5,.5,-5,-5,.5,5,-5,-.5,5,-5,.5,5,5,.5,5,5,-.5,5,5,.5,5,5,.5,-5,5,-.5,-5,5,.5,-5,-5,.5,-5,-5,-.5,-5,5,-.5,5,5,-.5,-5,-5,-.5,-5,-5,.5,5 ,-5,.5,-5,5,.5,-5 ]), false); var _i;//indices & affected indices for shapekeys _i = new Uint32Array(36); CONTIG(_i, 0, 0, 35); this.setIndices(_i); this.setVerticesData(_B.VertexBuffer.NormalKind, new Float32Array([ -1,0,0,-1,0,0,-1,0,0,0,0,1,0,0,1,0,0,1,1,0,0,1,0,0,1,0,0,0,0,-1,0,0,-1,0,0,-1,0,-1,0,0,-1,0,0,-1,0,0,1,0,0,1,0 ,0,1,0,-1,0,0,-1,0,0,-1,0,0,0,0,1,0,0,1,0,0,1,1,0,0,1,0,0,1,0,0,0,0,-1,0,0,-1,0,0,-1,0,-1,0,0,-1,0,0,-1,0,0,1,0 ,0,1,0,0,1,0 ]), false); geo = (_B.Tools.Now - geo) / 1000; this.subMeshes = []; new _B.SubMesh(0, 0, 36, 0, 36, this); if (scene._selectionOctree) { scene.createOrUpdateSelectionOctree(); } } if (this.postConstruction) this.postConstruction(); load = (_B.Tools.Now - load) / 1000; _B.Tools.Log("defined mesh: " + this.name + (cloning ? " (cloned)" : "") + " completed: " + load.toFixed(2) + ", geometry: " + geo.toFixed(2) + ", skey: " + shape.toFixed(2) + " secs"); if (matLoaded && !_sceneTransitionName){ if (typeof this.grandEntrance == "function") this.grandEntrance(); else makeVisible(this); } else waitingMeshes.push(this); } BoxCollider_134.prototype.dispose = function (doNotRecurse) { _super.prototype.dispose.call(this, doNotRecurse); if (this.skeleton) this.skeleton.dispose(); }; BoxCollider_134.prototype.makeInstances = function (positionOffset) { var instance; instance = this.createInstance("BoxCollider.129"); instance.position.x = 0; instance.position.y = 0; instance.position.z = -10; instance.rotation.x = 0; instance.rotation.y = 0; instance.rotation.z = 0; instance.scaling.x = 1; instance.scaling.y = 1; instance.scaling.z = 1; // add below two lines instance.checkCollisions = true; instance.physicsImpostor = new BABYLON.PhysicsImpostor( instance, BABYLON.PhysicsImpostor.BoxImpostor, { mass : 0.0, friction : 1, restitution : 0 }, scene); if (positionOffset) instance.position.addInPlace(positionOffset); instance.checkCollisions = false; instance = this.createInstance("BoxCollider.100"); instance.position.x = 29.5438; instance.position.y = -2.3742; instance.position.z = 0; instance.rotation.x = 0; instance.rotation.y = 0; instance.rotation.z = 0; instance.scaling.x = 1; instance.scaling.y = 1; instance.scaling.z = 1; // add below two lines instance.checkCollisions = true; instance.physicsImpostor = new BABYLON.PhysicsImpostor( instance, BABYLON.PhysicsImpostor.BoxImpostor, { mass : 0.0, friction : 1, restitution : 0 }, scene); if (positionOffset) instance.position.addInPlace(positionOffset); instance.checkCollisions = false; instance = this.createInstance("BoxCollider.095"); instance.position.x = 29.4404; instance.position.y = 2.5005; instance.position.z = -10.0006; instance.rotation.x = 0; instance.rotation.y = 0; instance.rotation.z = 0; instance.scaling.x = 1; instance.scaling.y = 1; instance.scaling.z = 1; // add below two lines instance.checkCollisions = true; instance.physicsImpostor = new BABYLON.PhysicsImpostor( instance, BABYLON.PhysicsImpostor.BoxImpostor, { mass : 0.0, friction : 1, restitution : 0 }, scene); if (positionOffset) instance.position.addInPlace(positionOffset); instance.checkCollisions = false; instance = this.createInstance("BoxCollider.078"); instance.position.x = -39.0553; instance.position.y = 5.1819; instance.position.z = 0; instance.rotation.x = 0; instance.rotation.y = 0; instance.rotation.z = 0; instance.scaling.x = 1; instance.scaling.y = 1; instance.scaling.z = 1; // add below two lines instance.checkCollisions = true; instance.physicsImpostor = new BABYLON.PhysicsImpostor( instance, BABYLON.PhysicsImpostor.BoxImpostor, { mass : 0.0, friction : 1, restitution : 0 }, scene); if (positionOffset) instance.position.addInPlace(positionOffset); instance.checkCollisions = false; instance = this.createInstance("BoxCollider.073"); instance.position.x = -39.1818; instance.position.y = -4.9811; instance.position.z = -9.9322; instance.rotation.x = 0; instance.rotation.y = 0; instance.rotation.z = 0; instance.scaling.x = 1; instance.scaling.y = 1; instance.scaling.z = 1; // add below two lines instance.checkCollisions = true; instance.physicsImpostor = new BABYLON.PhysicsImpostor( instance, BABYLON.PhysicsImpostor.BoxImpostor, { mass : 0.0, friction : 1, restitution : 0 }, scene); if (positionOffset) instance.position.addInPlace(positionOffset); //instance.checkCollisions = false; instance.checkCollisions = true; }; return BoxCollider_134; })(BABYLON.Mesh); ModelFInish.BoxCollider_134 = BoxCollider_134; @JCPalmer @gryff @Deltakosh @RaananW ProjectTest.zip Model.zip
-
Some time ago I started optimize my scene. After some fixes, now I have problem with grouping objects in BabylonJS. For export I use tower of Babel. I experimented with linking, parenting and joining. Linking When objects is linked in Babylon i can see only one object. Parenting This method do not change anything about draw calls - it is same without parenting. Joining This method show all objects correct with smaller draw calls. But i must divide to smaller groupis to avoid inncorect collisions (check link https://ibb.co/gVcROQ to show how bounding boxes are builded). In this screen it is not perfect, so i must divide to more groups my trees. Can anyone help me to export/import my scene to Babylon with optimal perfomance? I think about one object for all tress for example.
-
I should have realized that going on the assumption that babylonFileLoader.js was static when building the to_javascript() methods of each of my python classes(World, Mesh, SubMesh, Node, Bone, Skeleton, MultiMaterial, Camera, Light, ShadowGenerator, Texture, Material, Animation & its subclass VectorAnimation) was incorrect. I am now diffing all changes since June 1st, & io_export_babylon.py changes too. Found light animation was added to babylonFileLoader, but io_export_babylon.py had not been updated to send it. I had actually wondered about adding this myself, but quickly put it out of my mind, as I thought it would have just been ignored in the .babylon. Might be kind of cool for like a POW camp game with search lights. Guess I should add it, though I am not going to maintain io_export_babylon.py. I am going to ignore any changes to babylonFileLoader.js related to working with an alternatively loaded file, as it has no meaning on the Blender side. Will try sync up TOB with all else, and use this thread to ask questions. Gryff, are you up to working in another animation type to one of the testing .blends, please? Jeff
- 25 replies
-
- babylonFileLoader
- io_export_babylon
-
(and 2 more)
Tagged with: