thecco Posted December 27, 2013 Share Posted December 27, 2013 hello i can't use english well.. sorry i have many problem. first. i have 3d model make from 3dmax.(obj, fbx) using converter obj- > babylon // Success but fbx -> babylon // Failure so i decision using obj.BABYLON.SceneLoader.Load("Scenes/test/", "HUB_F.babylon", engine, function (newScene) {but texture is not loading this model have 124 jpg filesscene = newScene;var ship = scene.meshes[0];var mat = new BABYLON.StandardMaterial("Mat", scene); mat.reflectionTexture = new BABYLON.Texture("Scenes/test/", scene);scene.material = mat; texture files are exist in the same folder as the model files.( scenes/test/) how can i apply texture? i'm Language breaker....TT Quote Link to comment Share on other sites More sharing options...
Dad72 Posted December 27, 2013 Share Posted December 27, 2013 To apply the textures you must use diffuseTexturevar ship = scene.meshes[0]; myNewMaterial = new BABYLON.StandardMaterial("Mat", scene);myNewMaterial.diffuseTexture = new BABYLON.Texture("Scenes/test/", scene); for(var i = 1; i < ship.length; i++) { ship[i].material = myNewMaterial; }For export fbx, use the FXB exporter version 2012 or 2013 Quote Link to comment Share on other sites More sharing options...
thecco Posted December 27, 2013 Author Share Posted December 27, 2013 thank you reply when i using your source print thisResource interpreted as Image but transferred with MIME type text/html: "http://localhost:47688/Scenes/test/". b-1.8.0.js:22(anonymous function) b-1.8.0.js:22Resource interpreted as Image but transferred with MIME type text/html: "blob:http%3A//localhost%3A47688/68db1fb7-606c-4b9e-88bb-6a63be72a3c1". b-1.8.0.js:22generateBlobUrl b-1.8.0.js:22transaction.oncomplete Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted December 27, 2013 Share Posted December 27, 2013 Do not forget to define the filename :var ship = scene.meshes[0];myNewMaterial = new BABYLON.StandardMaterial("Mat", scene);myNewMaterial.diffuseTexture = new BABYLON.Texture("Scenes/test/texture.jpg", scene); for(var i = 1; i < ship.length; i++) { ship[i].material = myNewMaterial; } Quote Link to comment Share on other sites More sharing options...
thecco Posted December 28, 2013 Author Share Posted December 28, 2013 but.... i have 124 jpg files... so.......................... 1 myNewMaterial1.diffuseTexture = new BABYLON.Texture("Scenes/test/head.jpg", scene); 2 myNewMaterial2.diffuseTexture = new BABYLON.Texture("Scenes/test/body.jpg", scene); 3 myNewMaterial3.diffuseTexture = new BABYLON.Texture("Scenes/test/foot.jpg", scene); 4. . .....123 .124 myNewMaterial124.diffuseTexture = new BABYLON.Texture("Scenes/test/hairjpg", scene); like this? and... console.log(ship.length) ---> undefined .... i found some strange BABYLON.SceneLoader.Load("Scenes/test/", "HUB_F.babylon", engine, function (newScene) { scene = newScene; var ship = scene.meshes[0]; ship.scaling.x = 0.03; ship.scaling.y = 0.03; ship.scaling.z = 0.03;i think "scene.meshes[0]" is just one mesh.... how can i load model and put in one variable like ship? Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted December 28, 2013 Share Posted December 28, 2013 Yes like this:)scene.meshes[0] is the first loaded mesh, all other meshes are scene.meshes[1], etc... Quote Link to comment Share on other sites More sharing options...
thecco Posted December 30, 2013 Author Share Posted December 30, 2013 thanks can u check my code? var myNewMaterial = []; console.log(scene.meshes[0]); console.log(scene.meshes[1]); console.log(scene.meshes[129]); console.log(scene.meshes[scene.meshes.length - 1] + " , " + scene.meshes.length); for (var i = 0; i < scene.meshes.length; i++) { myNewMaterial[i] = new BABYLON.StandardMaterial("Mat" + i, scene); var name = scene.meshes[i].name + ""; var tmp = name.split("#"); //var imgName = (tmp[1] + "").replace(" ", ""); console.log(scene.meshes[i].name + ", " + name + ", " + tmp + ", " + imgName); myNewMaterial[i].diffuseTexture = new BABYLON.Texture("Scenes/test/" + tmp + ".jpg", scene); scene.meshes[i].material = myNewMaterial[i]; }Uncaught TypeError: Cannot read property 'uv' of undefined BABYLON.Mesh.isVerticesDataPresent BABYLON.StandardMaterial.isReady BABYLON.Scene.isReady BABYLON.Scene._checkIsReady (anonymous function) and. How to convert mtl file when i used obj file converter is not using mtl.... when i used fbx file xna framework print out err message (65xxx mesh over) Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted December 30, 2013 Share Posted December 30, 2013 You seems to have a issue with big meshes. Your meshes cannot have more than 65535 vertices. You have to split them else. Obj converter supports .mtl so the issue above should be the source of the problem 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.