Search the Community
Showing results for tags 'models'.
-
I want to import my .babylon model with animation into my code but the model didn't appear and if it does appear, the animation won't work. This is the code var human = new BABYLON.Mesh.CreateBox("human", 1.0, scene); human.isVisible = false; human.position.y = 0; human.position.x = 0; BABYLON.SceneLoader.ImportMesh("", "models/Vanquish/Human/", "Humans.babylon", scene, function(newMeshes, particleSystems, skeletons){ skeleton = skeletons[0]; skeletonMesh = newMeshes[0]; scene.beginAnimation(skeleton, 0, 20, false, 2.5); for(i = 0; i < newMeshes.length; i++){ newMeshes.parent = human; } });
-
Hello again. I continue develop a site with babylonjs, but I have a few problems. I have a scene created with blender, I generate the babylon file, the scene has some textures, I converted the textures to a ktx format, with the script in the babylon page. You can see the page in: http://entornomexicano.com/ I import the scene with: if (!BABYLON.Engine.isSupported()){ console.log("Motor no soportado"); return; } canvas = document.getElementById("renderCanvas"); engine = new BABYLON.Engine(canvas, true); // Asignamos los tipos de textura compimidos que se pueden usar var available = ['-astc.ktx', '-dxt.ktx', '-pvrtc.ktx', '-etc1.ktx', '-etc2.ktx']; var formatUsed = engine.setTextureFormatToUse(available); BABYLON.SceneLoader.Load(blendPath + "scene1/", "landScape.babylon", engine, function (newScene) { // asignamos la escena scene = newScene; // Creamos el entorno y las luces createSkybox("models/scene1/sky2.jpg"); createWaterMesh("waterMesh", imgPath + "waterbump.png", new BABYLON.Vector3(0, -0.08, 0), 6, getMeshListToRender()); createCamera(1, new BABYLON.Vector3(-0.23, 0.56,-2.73), new BABYLON.Vector3(0, 0, 0)); // arch camera createParticleSystem(); createLights(); createShadows(); createVolumetricLightEffect(); createActionsContollers(); // Wait for textures and shaders to be ready scene.executeWhenReady(function () { // Quitamos la imagen del cargador cuando termine el proceso de carga $("#loaderPadre").remove(); scene.createOrUpdateSelectionOctree(); // quitamos los calculos de los objetos para hacer mas eficiente la escena scene.meshes.forEach(function (mesh) { if(mesh.name.search("NO_") === -1) mesh.freezeWorldMatrix(); }); // Funcion para cuando se redimensiona la ventana $(window).on('resize', function() { engine.resize(); }); // Once the scene is loaded, just register a render loop to render it engine.runRenderLoop(function() { // console.log(engine.getFps()); scene.render(); }); }); }, function (progress) { if(progress.total == 0) return; $(".textoCarga").text( ((progress.loaded/progress.total)*100).toFixed(2) + "%"); }); In the callback function I return the loadign progress, but in some devices the progres is too slow, and When I already have 100% the scene still takes time to show, maybe i have doing some wrong. Somebody know, What I can do for resolve that? And other problem is the performance of the scene, I rremoved some elements and I have down the quality of the shadows, but the fps is 30, How I can increase the speed? the complete code is in: https://github.com/flelix/entorno-models.git in the folder: entorno-models/code/proyBabylon/entorno/ here you can see the project. I hope you can help me. Thanks and regards.
- 3 replies
-
- performance
- loading
-
(and 2 more)
Tagged with:
-
I'm stuck with loading my meshes. I'm new to all the 3D and modelling so any thoughts are highly appreciated. Basically I want to extends Babylons default Mesh class called BaseMesh and add a 'load' function to it to get rid of clutter in my scene code. I'm extending this BaseMesh class for each model I have. My BaseMesh class: (Note that all code examples are written in TypeScript) // BaseMesh.ts class BaseMesh /* extends BABLYON.Mesh */ { public readonly BASE_URL: string; // I want these to be static public readonly MODEL_URL: string; // I want these to be static public readonly NAME: string; // I want these to be static public body; /* constructor( scene ) { // I don't know what to do here super( this.NAME //name scene // scene null // parent ? // source ); } */ public load( assetsManager: BABYLON.AssetsManager ) { return assetsManager.addMeshTask( this.NAME + ' task', // name "", this.BASE_URL, this.MODEL_URL ); } public onLoaded( results ) { // I don't know what to do here this.body = results.loadedMeshes[0]; } public update(): void {} }; A model class would looks like this: // Robot.ts class Robot extends BaseMesh { public readonly BASE_URL: string = '/models/'; public readonly MODEL_URL: string = 'robot.babylon'; public readonly NAME: string = 'robotMesh'; public update(): void { this.body.rotation.y += 0.03; } } In my code above I store the loadedMesh from the AssetsManager into this.body. But here is question 1: why is my model already showing on the scene when the meshtask has run? I'm only loading a mesh, I've not put anything about putting it on the scene. Question 2: How do I extend my BaseMesh class from BABLYON.Mesh so that the result (loadedMeshes) of my load function is "the mesh itself" (instead of an attribute this.body). For example this would mean I could change my update function to 'this.rotation.y += 0.03;' and just generally makes more sense. Question 3: I'm really confused about the relationship between my "code" and my "model/.babylon files". Is there any good documentation/tutorials about this? These questions range from: - when is it healthy to split different parts of a model in different files - do I apply textures in my code or do I do that in my .babylon file - do I apply animations in my blender file or do I code them - ... This was a pain to type, if you have any questions please do ask Thank you in advance!
-
Hello! I created a simple semi cylinder on Blender and imported it inside my game but for some reason the .checkCollisions of the model is not working. It is set to true , and the free camera's .checkCollisions is also set to true but the camera can still go through the model. I've tried with babylon meshes and checkCollisions is working fine. I even enabled collisions in the physics tab in Blender but nothing seems to be working. I am guessing the problem is with the model itself. But any thoughts on why it's not working? I attached the model here if you need to check it. Help would be really appreciated. cylinder1.blend
- 12 replies
-
- models
- collisions
-
(and 1 more)
Tagged with:
-
Hi team, @jerome @Wingnut I have an question relative to solid particle system (SPS). I need to create a SPS composed with different buildings (.obj files). This is my code but i only can add one of them. How can I solve it? var models = function(edificios_texto) { var t = 0; var loader = new BABYLON.AssetsManager(scene); edificios_texto.forEach(function() { if(edificios_texto[t].length!=2){ return; } var edificio = loader.addMeshTask(t, "","<?=$url?>assets/modelos/",edificios_texto[t]+".obj"); var nM; //mesh of building edificio.onSuccess = function (task) { task.loadedMeshes.forEach(function(b) { b.scaling = new BABYLON.Vector3(2.65, 2.65, 2.65); b.rotation.y = Math.PI; b.computeWorldMatrix(true); var vertex_data = BABYLON.VertexData.ExtractFromMesh(b); for (var i = 0; i < vertex_data.normals.length; i+=3) { vertex_data.positions[i] *= -1; } vertex_data.applyToMesh(b); }); nM = BABYLON.Mesh.MergeMeshes(task.loadedMeshes); for (var i = 0; i < edificios.length; i++) { if(edificios[i].descripcion == edificios_texto[edificio.name]){ var myPositionFunction = function(particle, s) { var utmPlaceX = edificios[i].x; var utmPlaceZ = edificios[i].z; var utmPlaceXFromCentre = utmPlaceX - mapCentreX; var utmPlaceZFromCentre = utmPlaceZ - mapCentreZ; var x = utmPlaceXFromCentre/scaleX; var z = utmPlaceZFromCentre/scaleZ; particle.position.x = x; particle.position.z = z; particle.position.y = alturas[ edificios_texto[edificio.name]]; particle.color = new BABYLON.Color4(0, 0, 1,0.5); }; spsEdificios.addShape(nM, 1, {positionFunction: myPositionFunction}); nM.dispose(); break; } } var buildings = spsEdificios.buildMesh(); spsEdificios.mesh.hasVertexAlpha = true; } t++; }); loader.load(); }; Thanks!
-
FREE Nice piece of work for your games Collection of over 50 FREE models from 3DModels-Textures (DEXSOFT-Games) production. Textures are downsized to 512*512px, ideal for mobile environments. https://www.3dmodels-textures.com/FREESFCorridors
-
What's the best (though feasible) polycount for lowpoly models in bjs assuming I want to have 10 lowpoly meshes rendered at the same time on mobile with dynamic lighting? (no rigs/animations) Is 600 per model reasonable or is it too much?
-
1) Is it possible to have 3D models with animations? Perhaps using the OBJ extension? 2) Can 3D models be lightweight or are they always around a few megabytes per model? I need to be able to have multiple animated 3d models in the game at a reasonable size - hopefully the sum of all assets will not exceed a few megabytes, more than that would mean unbearable loading times to the end user.
-
I was wondering what other people do for there 3ds Max/Blender -> babylon.js workflows? I find that If I create a scene with multiple objects, materials & animation within 3ds max and then export to Babylon.js I will usually need to do some more work on the Babylon.js side (adjust and fine-tune material parameters, add advanced material types, minor repositioning to perfect things in the browser environment, additional animation easing and so on..). I will then re-export my using the SceneSerializer method so that it is saved using the standard format. The annoyance for me is then when I decide to swap out an object or make a change to my animation on the 3ds Max side - I then have to re-work all of the post-export modifications or dive into a huge scene.js file full of mesh vertices and animation keys to merge the two versions. Could there be a way to export from 3ds Max that will produce a folder with a main Scene.js file with references to a separate JS file for each material and each object. This would mean that the materials could be edited without hunting through a file of several megabytes, objects could be changed or added without re-exporting an entire scene and scene files which are a lot more manageable.
-
Introducing yoanimate online service for 3D animators and Game Artists. Example Participate to the yoanimate 3d animated character Contest and win prizes ranging from $50-$1000! Start uploading your fbx files now at yoanimate.com and be among the first 50 talented animators to get $50 just for uploading your models! 2nd prize $250 1st prize $1000 Do you want to find out more? Go to http://yoanimate.com/ Watch the video tutorials for our 3dpreview editor and for the material editor. 3d preview editor Material Editor Check out specifications to know what to do before uploading your files. Specifications Our site offers an enhanced interactive 3dpreview editor with many features such as: A variety of backgrounds and platforms Adjustment of animation speed Scaling of your characters Hue and saturation of the background Adjustments to materials with our online material editor Preferable lighting settings Save your settings Share your work with your colleagues and friends
-
Hello) Prompt two things, please: 1. How to add to the scene two .babylon model to one was the surface, and the second can be controlled and moved over the surface? 2. How can we realize switching model? In other words, how to implement the switching from the first vessel to the second. Thanks in advance)