Jump to content

model import and texture


thecco
 Share

Recommended Posts

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 files

scene = 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

post-5970-0-66576700-1388133424_thumb.jp

Link to comment
Share on other sites

To apply the textures you must use diffuseTexture

var 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

Link to comment
Share on other sites

thank you  reply

 

when i using your source

 

print this

Resource 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
Link to comment
Share on other sites

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;                        }
Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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];                    }
  1. Uncaught TypeError: Cannot read property 'uv' of undefined
    1. BABYLON.Mesh.isVerticesDataPresent
    2. BABYLON.StandardMaterial.isReady
    3. BABYLON.Scene.isReady
    4. BABYLON.Scene._checkIsReady
    5. (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)
Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...