Jump to content

Search the Community

Showing results for tags 'obj'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • HTML5 Game Coding
    • News
    • Game Showcase
    • Facebook Instant Games
    • Web Gaming Standards
    • Coding and Game Design
    • Paid Promotion (Buy Banner)
  • Frameworks
    • Pixi.js
    • Phaser 3
    • Phaser 2
    • Babylon.js
    • Panda 2
    • melonJS
    • Haxe JS
    • Kiwi.js
  • General
    • General Talk
    • GameMonetize
  • Business
    • Collaborations (un-paid)
    • Jobs (Hiring and Freelance)
    • Services Offered
    • Marketplace (Sell Apps, Websites, Games)

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Website URL


Twitter


Skype


Location


Interests

  1. I'm trying to load an OBJ in the playground. There are 2 meshes in the OBJ with exact same number of vertices. This works in normal code when I use BABYLON.SceneLoader.Load() but when I use this special playground technique I get funny side-effects. One of the meshes is twice the number of vertices as the other one: http://www.babylonjs-playground.com/#28YUR5#202 You can see it in the console output. Is there another way to load an OBJ in the playground?
  2. When I downloaded the "SceneLoader.Append" demo code into my computer, then changed to my own .gltf file and run it on the chrome browser, but nothing was happened. I would be very grateful if someone could help me. By the way, I attached my test code below. <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Babylon.js sample code</title> <!-- Babylon.js --> <script src="https://code.jquery.com/pep/0.4.2/pep.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/dat-gui/0.6.2/dat.gui.min.js"></script> <script src="https://preview.babylonjs.com/ammo.js"></script> <script src="https://preview.babylonjs.com/cannon.js"></script> <script src="https://preview.babylonjs.com/Oimo.js"></script> <script src="https://preview.babylonjs.com/gltf_validator.js"></script> <script src="https://preview.babylonjs.com/earcut.min.js"></script> <script src="https://preview.babylonjs.com/babylon.js"></script> <script src="https://preview.babylonjs.com/inspector/babylon.inspector.bundle.js"></script> <script src="https://preview.babylonjs.com/materialsLibrary/babylonjs.materials.min.js"></script> <script src="https://preview.babylonjs.com/proceduralTexturesLibrary/babylonjs.proceduralTextures.min.js"></script> <script src="https://preview.babylonjs.com/postProcessesLibrary/babylonjs.postProcess.min.js"></script> <script src="https://preview.babylonjs.com/loaders/babylonjs.loaders.js"></script> <script src="https://preview.babylonjs.com/serializers/babylonjs.serializers.min.js"></script> <script src="https://preview.babylonjs.com/gui/babylon.gui.min.js"></script> <style> html, body { overflow: hidden; width: 100%; height: 100%; margin: 0; padding: 0; } #renderCanvas { width: 100%; height: 100%; touch-action: none; } </style> </head> <body> <canvas id="renderCanvas"></canvas> <script> var canvas = document.getElementById("renderCanvas"); var delayCreateScene = function () { // Create a scene. var scene = new BABYLON.Scene(engine); // Create a default skybox with an environment. var hdrTexture = BABYLON.CubeTexture.CreateFromPrefilteredData("textures/environment.dds", scene); var currentSkybox = scene.createDefaultSkybox(hdrTexture, true); // Append glTF model to scene. BABYLON.SceneLoader.Append("./", "test.gltf", scene, function (scene) { // Create a default arc rotate camera and light. scene.createDefaultCameraOrLight(true, true, true); // The default camera looks at the back of the asset. // Rotate the camera by 180 degrees to the front of the asset. scene.activeCamera.alpha += Math.PI; }); return scene; }; var engine = new BABYLON.Engine(canvas, true, { preserveDrawingBuffer: true, stencil: true }); var scene = delayCreateScene(); engine.runRenderLoop(function () { if (scene) { scene.render(); } }); // Resize window.addEventListener("resize", function () { engine.resize(); }); </script> </body> </html>
  3. i have zip file contains multiple obj and mtl files on a node js server i was wondering how load the content of the obj files inside the zip file
  4. Hi everyone, In the obj file, when an object has multi-material, the obj file loader will create several meshes. I want to only create one mesh with multi-material, but got the wrong result: I attached the obj file and the new obj file loader I modified(objFileLoader_new.js ), can anybody help to have a look why it is wrong. It troubled me a whole day now. obj.rar
  5. Hi, i would like to import an OBJ file into my scene and I have got it. However, I don't get change the position and scale of the mesh. ¿How could I do it? This is my code: var loader = new BABYLON.AssetsManager(scene); var edificioB4 = loader.addMeshTask("A2", "", "http://localhost:8080/modelos/A2/", "A2.obj"); BABYLON.OBJFileLoader.OPTIMIZE_WITH_UV = true; loader.load(); Thanks, JuanMa J.R.
  6. My scene meshes partially created uses ribbons. Orange meshes on picture. All meshes displayed good on screen , but when i try to export scene meshes to OBJ file, then ribbons created meshes not export to result file, without errors. Just nothing, except usual created meshes(black/gray on picture) in result OBJ file , after importing uses freecad/meshlab. And file size is tiny (looks like ribbons just not added to export flow). while i try export only ribbons , in import time i see error "no vertex field found" and file include only elements heading exported_wheel(4).obj
  7. Hello! I need to export my objects to obj. I found an example that I could adapt. But I can not incorporate the position of the object in the scene. Any idea? note: I'm a beginner*** BABYLON.Mesh.prototype.exportOBJ = function() { var output=[]; output.push("mtllib savedFile.mtl"); for(var i2 = 0; i2< selectedItems.length; i2++) { output.push("g object"+i2); output.push("o object_"+i2); output.push("usemtl material"+i2); var g = window[selectedItem[i2]].geometry; console.log(selectedItem[i2]); trunkVerts = g.getVerticesData('position'); trunkNormals = g.getVerticesData('normal'); trunkUV = g.getVerticesData('uv'); trunkFaces = g.getIndices(); for(var i=0;i<trunkVerts.length;i+=3){ output.push("v "+trunkVerts[i]+" "+trunkVerts[i+1]+" "+trunkVerts[i+2]); } for(i=0;i<trunkNormals.length;i+=3){ output.push("vn "+trunkNormals[i]+" "+trunkNormals[i+1]+" "+trunkNormals[i+2]); } for(i=0;i<trunkUV.length;i+=2){ output.push("vt "+trunkUV[i]+" "+trunkUV[i+1]); } for(i=0;i<trunkFaces.length;i+=3) { output.push( "f "+(trunkFaces[i+2]+1)+"/"+(trunkFaces[i+2]+1)+"/"+(trunkFaces[i+2]+1)+ " "+(trunkFaces[i+1]+1)+"/"+(trunkFaces[i+1]+1)+"/"+(trunkFaces[i+1]+1)+ " "+(trunkFaces[i]+1)+"/"+(trunkFaces[i]+1)+"/"+(trunkFaces[i]+1) ); } } var text = output.join("\n"); var fileBlob; try{ fileBlob=new Blob([text]); }catch(e){ var blobBuilder=window.BlobBuilder || window.MozBlobBuilder || window.WebKitBlobBuilder; var bb=new blobBuilder(); bb.append([text]); fileBlob=bb.getBlob(); } var URL=window.URL || window.webkitURL; var link=URL.createObjectURL(fileBlob); return link; }
  8. Hi everybody ! I'm importing .obj files in my application, and I want to change their color. However, the color seems to be changed when the page is loading, but when it's finally loaded the mesh still has its basic grey material (so while the whole scene is loading we can see the mesh being pink for half a second and then takes back its basic color/texture/material). I've seen something about UV maps etc.. but I checked it in Blender and it is activated when I import into obj. Here's a pg trying to reproduce my problem ( first you will need to help me importing my object into the pg because it doesn't seem to be working, I can't see it on scene); I added a skull.babylon to show that the code I provide is supposed to work : https://www.babylonjs-playground.com/#V9KE7I#7 Thanks for your time !
  9. I have an OBJ that starts like this: v -212.947922 761.461914 28.203093 v -213.405563 766.404602 28.193245 v -214.460007 771.238403 28.648092 v -214.639648 776.197327 28.477924 v -215.033905 781.149658 28.498495 v -215.717438 786.059753 28.729038 I copied the vertices to an array using mesh.getVerticesData(BABYLON.VertexBuffer.PositionKind) When I look at vertices[0] I expected to get -212.947922 (the first value in the OBJ file) but it comes up with a value that's somewhere else in the OBJ file. How can I map a value from getVerticesData() to a location in the OBJ file? So for example a value I get from getVerticesData could be -215.033905 which would map to 12th value in the OBJ file.
  10. Hello guys I have one issue . I unable to import meshes when i using Class () but everything works except for importing meshes. You can see my code here : class Player { constructor(scene) { this.scene = scene; this._skeleton; BABYLON.SceneLoader.ImportMesh("", "", "skull.babylon", this.scene, function (newMeshes, particleSystems, skeletons) { skull = newMeshes[0]; this._skeleton = skeletons[0]; skull.rotation.y= Math.PI; scene.beginAnimation(skeletons[0], 0, 501, true, 1) this.collider = BABYLON.Mesh.CreateBox("collider_box", .32, scene, false); this.collider.position.y = .151; this.collider.rotation.y = 0; this.collider.ellipsoid = new BABYLON.Vector3(0.155, 1.14, 0.155); this.collider.ellipsoidOffset = new BABYLON.Vector3(0, 1.0, 0); this.collider.isVisible = false; skull.parent= this.collider; }); } get mesh (){ return this.collider; } } Why is this didn't work ? It is becouse babylon-loaders doesn't support Class () or do I do something wrong ? Thank you in advance for your answers
  11. Hello, I'm importing a new OBJ file with the MTL and texture into my scene every 30 seconds. When I import, I dispose of an existing OBJ and MTL, and declare their variable (array) as null. But my frame rate continues to drop as I add and dispose of objects - even though there is only 20 heads at a time in the scene - never more. But my fps drops from over 40fps to under 20fps once I add less than 10 new heads and dispose of an equal amount. I've even forced dispose, but fps still drops. Thanks, DB
  12. Hello folks, i try load an .obj file and modify the material/texture scaling. Loading goes well, but not scaling of the textures When i try to access the material object i get a undefined error. meshes[0].material is undefined, in the screen shot you can see the property is there. I dont know what i do wrong // first param: ["myMesh1", "myMesh2"] // https://doc.babylonjs.com/how_to/load_from_any_file_type BABYLON.SceneLoader.ImportMesh("", "./assets/temp/house/", "restaurant.obj", game.scene, function (meshes, particleSystems, skeletons) { // do something with the meshes and skeletons // particleSystems are always null for glTF assets //console.log(meshes, particleSystems, skeletons); console.log(meshes[0]); });
  13. Hello, I hope someone knows how to do this - I need to have a scene running, and also a scanner beside it. As scanned heads are added to the scene as OBJ files, I need them loaded and rendered in the scene without disposing of the scene. The paths to the new files must be added to an array. I currently have a test scene online, and am loading 2 heads at the start. Then I have a left mouse event add a new file path and folder to the array - but don't know how to tell the loader to load again from the new path. I can delete any path in the array which has already had an OBJ loaded from it, as the path will only be used once. The online scene is below - it might need to be loaded twice the first time. http://qedsoft.com/SBSW/10_heads/index.html The main JS code is as follows: I appreciate it if you can assist. Thanks, DB
  14. Hi, I´m new to BJS and trying to get along with a 3D visualization for warehouses. The 2D visualization already work pretty well, the coordinates are stored in a DB running on a remote server. Target is to provide a library of rack elements (frames and beams) of different dimensions (height, width, length). I can provide a JSON from server-side Java-application with all the necessary data (rack id, rack type, coordinates, etc.) I´m using OBJFileLoader for importing obj and mtl which works fine as well. This is 2D visualization of a warehouse: Every blue rectangle is a warehouse rack consisting of two frames an a bunch of beam pairs: Both elements, frame and beam, come from separate obj-files. In the end of the day, i want to have something like this: The displayed meshes are kind of super simple, but perfect for playing around with BJS (i´ve all models in high poly as well). For some reason I can´t move (or change) meshes imported by this method: I can specify the mesh position while importing like this (works for the sphere btw.): var loader = new BABYLON.AssetsManager(scene); var pos = function(t){ t.loadedMeshes.forEach(function(m){ var meshName = m.name; var meshID = m.id; m.position.z = 5; m.position.x = 7; }); }; var steher1 = loader.addMeshTask("steher_2500_900_120", "", "http://localhost:8080/MagllanMain/Babylon/Cyril/", "steher_2500_900_120.obj"); steher1.onSuccess = pos; var sphere = BABYLON.Mesh.CreateSphere("sphere", 0.5, 0.5, scene); var simpleMaterial = new BABYLON.StandardMaterial("texture2", scene); simpleMaterial.diffuseColor = new BABYLON.Color3(0, 1, 0);//Green sphere.material=simpleMaterial; sphere.position.x = Math.floor((Math.random() * 2) ); sphere.position.y = Math.floor((Math.random() * 2) ); sphere.position.z=3; BABYLON.OBJFileLoader.OPTIMIZE_WITH_UV = true; loader.load(); // Begin of User interaction via button event $("#move_z").click(function(){ //scene.meshes.forEach(function(k) {alert(k.name);}); pilot.position.z = pilot.position.z + 1; sphere.position.z = sphere.position.z + 0.4; scene.getMeshByName('steher_2500_900_120').position.z +=10; }); Funny thing is, i can move all other meshed via click-event. In general, I´ve been asking myself if I´m using the best way of doing this (import-method, file-types: obj and mtl). The workflow should be like this: 1) get JSON from server with an array of IDs and their coordinates (e.g.: ID="10012", ID_name="rack_012", ID_pos_x="130", ID_pos_y="120", etc.); 2) Importing the rack elements that belong to a specific ID into existing BJS scene; 3) Every rack element uses the same obj-file(s) (meshes) because all racks shall be of the same rack type, but with different IDs in BJS; I don´t know how to give imported meshes their own unique, custom IDs so that I can access them in the scene. More in general: I have my server-side array and i need a client-side array as well. When i change the position of let´s say 10 of 2000 racks in my layout / scene, I need to know which meshes i have to "move" on client-side. If there are any other weak points my way of trying to achieve this, please tell me. Any help appreciated !!! Topper
  15. Hello, I've not been working in BJS for a while now, and am back on a job. I've imported loads of OBJ files into babylon.js, and never had an issue. However, I must have forgotten everything already. I need to have the OBJ file into babylon.js tomorrow, and m stuck. I know it's an idiot issue, but I'm too stupid to sort out why this OBJ won't load. http://qedsoft.com/DEMOS2017/obj_loader/index.html Thanks, DB Or better yet - if I import an OBJ file into Blender, the mesh imports as a completely black material with no texture. How do I correct this? It all imorts fine into Maya, which is what I normally use. However, it seems that I'm the only one using Maya in WebGL production, and there is no compatibility between Maya and babylon.js - not that I've ever found reliable. Could someone PLEASE write a reliable FBX converter to babylon.js? Everyone's been asking for this for many years now. I wish I had the skills to write it and support it.
  16. Hey, I have an issue with loading textures using an .obj and .mtl file. There's over 300 textures that need to be loaded in. I've checked the developer console in chrome and it appears that BabylonJS does indeed load them in, but they're still appearing as black textures in the view-port. Check below for image: I've seen that this is a common issue with .obj and .mtl files. Just wondering if anyone actually has a solution for this? Pete.
  17. Hello, I'm looking for a way to change a loaded mesh texture after it been loaded, without fetching new obj file. for example - I have the same chair in different textures, when the user does something I want to change the chair's texture. I can create a different .mtl file for each variant, but is it possible to load just the .mtl file after the obj already been loaded? Thanks, Tomer.
  18. Hi, I am loading an obj file and trying to scale it as shown below. The mesh is loaded but the scaling does not work. What am I doing wrong? var maraca = loader.addMeshTask("maraca", "", "assets/", "Maraca.obj"); maraca.scaling = new BABYLON.Vector3(0.1, 0.1, 0.1); Thanks!
  19. So, with some googling i found this... the problem is, it's in TypeScript (I don't know what this is even)... I don't know how to implement this any time i try using this i get unexpected identifiers. (I also noticed this TypeScript language is really similar to c# lol). So how would i use this... I know this is very nooby but meh
  20. I'm new to babylonJS, so please forgive if this question is stupid. I'd like to use the playground and import an OBJ from my computer into the scene. I've looked at the documentation, but it seems to indicate I need a special loader. The sample of which does not work on my computer/Chrome or IE browser (i.e. https://www.babylonjs-playground.com/#28YUR5) And the other way seems to be to just use playground and use Assetsmanager. But the forums seem to indicate that Assetsmanager is for loading scenes or .babylon file and/or you "simply cant' do that, the OBJ must be on the web") I'm a little unclear on this. It seems a simple request, to be able to load an OBJ into playground and then save it off again as a zip (babylon scene, I assume, or perhaps just a zip of html code). I even saw someone try using loader.addMeshTask("A2", "", "http://localhost:8080/A2/", "a2.obj"); Which apparently works for them, but again, not me (though perhaps one must somehow set up one's computer to act like a localhost? ) Also, the docs seem limited on this...if I'm missing something (other than the Assetsmanager tutorial and page, obj loader page, and link already provided) could someone point me at the docs I need? Much appreciated,
  21. Hi folks. Can someone please tell me why my tree model "deciduous01.dae" is not loading correctly? It loads, but then it gives an error "BJS - [06:39:35]: importMesh of undefined from undefined version: undefined, exporter version: undefinedimportMesh has failed JSON parse" This is the demo : http://babylontesting.epizy.com/loader/main.php This happens with the OBJ version of the Object as well. http://babylontesting.epizy.com/loader/models/deciduous/01/deciduous01/deciduous01.obj I also can't get the textures to load. I have them in the same folder... http://babylontesting.epizy.com/loader/models/deciduous/01/deciduous01/ view-source:http://babylontesting.epizy.com/loader/app/main.js line 180 is where LoadEntity ( ) is called inside http://babylontesting.epizy.com/loader/plugins/BabylonLib/BabylonLib.js , is where the function LoadEntity ( ) is created on line 138 --------------- I just want this model to load correctly... Thank you all so kindly! <3 Mythros
  22. I have encountered a problem with the lighting of my imported obj. Testing models (both lambert and phong materials) both have the same effect: my lighting doesn't work on the loaded models, but works perfectly fine on the default spheres. Directional lights don't work at all (they might as well not exist) and hemisphere lights make a minimal difference on the brightness of the model. I'm not exactly sure if this is a bug, because I read that in the documentation, it states that the obj loader does not support illumination. If that's the problem, then well, does anyone know of a workaround?
  23. Hi there, I have one single OBJ file with several objects within. Each element has its unique name. Is it possible to load each object as a single mesh? Tried to do this: var parts = []; obj.onSuccess = function (task) { for(var i = 0; i < task.loadedMeshes.length; i++){ parts.push(task.loadedMeshes[i]); parts[parts - 1].material = uniqueMat; ... } } But it seems that each next mesh / geometry has all previous ones like an avalanche. Loading OBJ with 5 similar spheres as a test Geometry {delayLoadState: 0, _totalVertices: 266, _isDisposed: false, id: "c0d23769-a422-47c5-8060-fabd67a55b1a", _engine: Engine…} main.js:254 Geometry {delayLoadState: 0, _totalVertices: 532, _isDisposed: false, id: "e83a4890-a107-425d-969c-eea1f356e200", _engine: Engine…} main.js:254 Geometry {delayLoadState: 0, _totalVertices: 798, _isDisposed: false, id: "19b85286-2066-4ef7-9e95-bba19d906e71", _engine: Engine…} main.js:254 Geometry {delayLoadState: 0, _totalVertices: 1064, _isDisposed: false, id: "22bc102d-1acc-4fa8-9576-77a9915e666f", _engine: Engine…} main.js:254 Geometry {delayLoadState: 0, _totalVertices: 1330, _isDisposed: false, id: "3eb8eab7-1871-4fed-b484-c18fc881cb23", _engine: Engine…} main.js:234 0
  24. Hello, For a test, I download a zip file. I extract files with JSZip. All files are OBJ files. I use babylon.objFileLoader for OBJ files. After extraction, I try to use BABYLON.SceneLoader.ImportMesh with rawData like this : var rawData = "data:" + contentOfFiles; BABYLON.SceneLoader.ImportMesh("", "model.obj", rawData, scene, function(){ console.log("Success"); }, function(){ console.log("PROGRESS"); }); But that's not work :((( I receive this message : importMesh of undefined from undefined version: undefined, exporter version: undefined importMesh has failed JSON parse Someone have an idea ? How can I import mu obj files ? Thanks Loïc
  25. Hi team, @Deltakosh I have a question relative to the optimization of my scene. I have to load a huge amount of building models to represent a 3D city enviroment. I need to improve the FPS of my scene. In recent days, I have tested the SPS but each building is a different mesh and I don't reach an important improvement. All of this buildings share the same texture and material but each of them have a lot of triangles... How can I get a great performance for rendering of all them? Thanks!
×
×
  • Create New...