Jump to content

BABYLON.SceneLoader.ImportMesh and problem with colour of a 3D model


Visam
 Share

Recommended Posts

Hi

I am using BABYLON.SceneLoader.ImportMesh to load the files ( https://www.dropbox.com/s/75q86impdtutlwz/test.zip?dl=0 ) to a scene.
If I am importing only one file from the files list, everything works fine. I can see correct colour of each 3D model.
But when I am loading all (6) files to the same(!) scene, I can see wrong colours.
Why? Can somebody help me?

Brg

Mikhail

Link to comment
Share on other sites

11 hours ago, Dad72 said:

BABYLON.SceneLoader.ImportMesh is made to load a single mesh and not several.
You should use instead  BABYLON.SceneLoader.Load or  BABYLON.SceneLoader.Append

Maybe that's your problem.

I will try to explain my problem.

I have several files. Each file contains a 3D model. Each model has meshes. Each mesh has a name.

Finally, I need to have one scene which includes the several 3D models and each model has to have only one name to be picked by scene.pick. One file - one mesh - one name.

How can I have it? Any ideas?

Link to comment
Share on other sites

16 hours ago, iTekVR said:

Hi

I am using BABYLON.SceneLoader.ImportMesh to load the files ( https://www.dropbox.com/s/75q86impdtutlwz/test.zip?dl=0 ) to a scene.
If I am importing only one file from the files list, everything works fine. I can see correct colour of each 3D model.
But when I am loading all (6) files to the same(!) scene, I can see wrong colours.
Why? Can somebody help me?

Brg

Mikhail

the colours distribution between meshes are different each loading time. 3D model files are the same. loading meshes order is the same. but results are different:

 

 

1.png

2.png

3.png

Link to comment
Share on other sites

11 hours ago, Dad72 said:

Your model must be merged into one to use ImportMesh (). If your models are detached into multiple pieces, you must use Load () or Append () and you can use pick () on your piece of your model.

Can I move a mesh from one scene to another scene, if both scenes will be created for the same engine?

Link to comment
Share on other sites

9 hours ago, Dad72 said:

Yes.

may be it is a stupid question, but what is the best way to move a mesh from one scene to another scene?

I am trying, but have some problems. May be I will fix it by myself even before you answer to my question :-)

Link to comment
Share on other sites

  • 2 weeks later...
On 08/01/2017 at 0:06 AM, Dad72 said:

BABYLON.SceneLoader.ImportMesh is made to load a single mesh and not several.
You should use instead  BABYLON.SceneLoader.Load or  BABYLON.SceneLoader.Append

Maybe that's your problem.

 

I am using Load and then Append... same problem with colours as I described here

 

Link to comment
Share on other sites

@iTekVR: Well I downloaded your files and took a look at them. I'm used to creating my .babylon files in Blender,  so I'm really used to the format in your files - though it looks like they are derived from AutoCad initially.

Anyway things that seem odd to me - using file 28.babylon as an example:

1. The materials.

"materials":[
{"alpha":1,"ambient":[1,0,0],"backFaceCulling":true,"diffuse":[1,0,0],"emissive":[0,0,0],"id":"51","name":"AutoCAD Color Index 1","specular":[0,0,0],"specularPower":0.011999999172985554,"wireframe":false},
{"alpha":1,"ambient":[1,0,0],"backFaceCulling":true,"diffuse":[1,0,0],"emissive":[0,0,0],"id":"52","name":"AutoCAD Color Index 1","specular":[0,0,0],"specularPower":0.011999999172985554,"wireframe":false},
{"alpha":1,"ambient":[1,0,0],"backFaceCulling":true,"diffuse":[1,0,0],"emissive":[0,0,0],"id":"53","name":"AutoCAD Color Index 1","specular":[0,0,0],"specularPower":0.011999999172985554,"wireframe":false},
{"alpha":1,"ambient":[1,0,0],"backFaceCulling":true,"diffuse":[1,0,0],"emissive":[0,0,0],"id":"54","name":"AutoCAD Color Index 1","specular":[0,0,0],"specularPower":0.011999999172985554,"wireframe":false},
{"alpha":1,"ambient":[1,0,0],"backFaceCulling":true,"diffuse":[1,0,0],"emissive":[0,0,0],"id":"55","name":"AutoCAD Color Index 1","specular":[0,0,0],"specularPower":0.011999999172985554,"wireframe":false},
{"alpha":1,"ambient":[1,0,0],"backFaceCulling":true,"diffuse":[1,0,0],"emissive":[0,0,0],"id":"56","name":"AutoCAD Color Index 1","specular":[0,0,0],"specularPower":0.011999999172985554,"wireframe":false},
{"alpha":1,"ambient":[1,0,0],"backFaceCulling":true,"diffuse":[1,0,0],"emissive":[0,0,0],"id":"57","name":"AutoCAD Color Index 1","specular":[0,0,0],"specularPower":0.011999999172985554,"wireframe":false},
{"alpha":1,"ambient":[1,0,0],"backFaceCulling":true,"diffuse":[1,0,0],"emissive":[0,0,0],"id":"58","name":"AutoCAD Color Index 1","specular":[0,0,0],"specularPower":0.011999999172985554,"wireframe":false}
],

You are defining 8 materials by id, but they all have the same material name, and they, in fact they are all identical apart from the id :o. I looked at two more of your files and there is the same issue.

2. Mesh materialId.

I then did a search of the file for materialId - to see what materials the meshes were using - again 28.babylon as an example:

"materialId":"42_Polygon Mesh" ...
"materialId":"43_Polygon Mesh" ...
"materialId":"44_Polygon Mesh" ...
"materialId":"45_Polygon Mesh" ...

The materials associated with the meshes bear no resemblance to the materials listed above. Same issue with the two other files I looked at.

So to me, and my Blender approach, there is an issue with the methods you are using to create these files.

I don't know if that will help - hope it does :)

cheers, gryff :)

Link to comment
Share on other sites

14 hours ago, gryff said:

@iTekVR: Well I downloaded your files and took a look at them. I'm used to creating my .babylon files in Blender,  so I'm really used to the format in your files - though it looks like they are derived from AutoCad initially.

Anyway things that seem odd to me - using file 28.babylon as an example:

1. The materials.


"materials":[
{"alpha":1,"ambient":[1,0,0],"backFaceCulling":true,"diffuse":[1,0,0],"emissive":[0,0,0],"id":"51","name":"AutoCAD Color Index 1","specular":[0,0,0],"specularPower":0.011999999172985554,"wireframe":false},
{"alpha":1,"ambient":[1,0,0],"backFaceCulling":true,"diffuse":[1,0,0],"emissive":[0,0,0],"id":"52","name":"AutoCAD Color Index 1","specular":[0,0,0],"specularPower":0.011999999172985554,"wireframe":false},
{"alpha":1,"ambient":[1,0,0],"backFaceCulling":true,"diffuse":[1,0,0],"emissive":[0,0,0],"id":"53","name":"AutoCAD Color Index 1","specular":[0,0,0],"specularPower":0.011999999172985554,"wireframe":false},
{"alpha":1,"ambient":[1,0,0],"backFaceCulling":true,"diffuse":[1,0,0],"emissive":[0,0,0],"id":"54","name":"AutoCAD Color Index 1","specular":[0,0,0],"specularPower":0.011999999172985554,"wireframe":false},
{"alpha":1,"ambient":[1,0,0],"backFaceCulling":true,"diffuse":[1,0,0],"emissive":[0,0,0],"id":"55","name":"AutoCAD Color Index 1","specular":[0,0,0],"specularPower":0.011999999172985554,"wireframe":false},
{"alpha":1,"ambient":[1,0,0],"backFaceCulling":true,"diffuse":[1,0,0],"emissive":[0,0,0],"id":"56","name":"AutoCAD Color Index 1","specular":[0,0,0],"specularPower":0.011999999172985554,"wireframe":false},
{"alpha":1,"ambient":[1,0,0],"backFaceCulling":true,"diffuse":[1,0,0],"emissive":[0,0,0],"id":"57","name":"AutoCAD Color Index 1","specular":[0,0,0],"specularPower":0.011999999172985554,"wireframe":false},
{"alpha":1,"ambient":[1,0,0],"backFaceCulling":true,"diffuse":[1,0,0],"emissive":[0,0,0],"id":"58","name":"AutoCAD Color Index 1","specular":[0,0,0],"specularPower":0.011999999172985554,"wireframe":false}
],

You are defining 8 materials by id, but they all have the same material name, and they, in fact they are all identical apart from the id :o. I looked at two more of your files and there is the same issue.

2. Mesh materialId.

I then did a search of the file for materialId - to see what materials the meshes were using - again 28.babylon as an example:


"materialId":"42_Polygon Mesh" ...
"materialId":"43_Polygon Mesh" ...
"materialId":"44_Polygon Mesh" ...
"materialId":"45_Polygon Mesh" ...

The materials associated with the meshes bear no resemblance to the materials listed above. Same issue with the two other files I looked at.

So to me, and my Blender approach, there is an issue with the methods you are using to create these files.

I don't know if that will help - hope it does :)

cheers, gryff :)

thank you!

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...