Jump to content

load mulpitle objects .babylon to scene with heightmap, skybox etc


Mira
 Share

Recommended Posts

gryff, thank you for your work!

Yep, I know that this model is not good and export from skp->3ds->babylon just get it worse. 

Another models is loading okay, but they are have much more simple structure.  :(

 

Can you help me with second question? How to load mesh into the scene with their own texture? I wrote what I had change names of the textures in Blender but it doesnt work and all mesh which have been imported by ImportMesh have the textures of first loaded scene .
Link to comment
Share on other sites

If I may try to clarify the 2nd question, Mira, you imported mesh into Blender... using its ImportMesh option, then you renamed the textures that were on those mesh, but the textures stayed the same?

 

I think that is normal.  I think you have to somehow remove the textures from the imported mesh, and then apply new textures (with any name you choose).  An imported mesh that has textures applied... will likely keep those textures even if they are renamed.  Likely you need to remove the textures from the imported mesh, and then apply new textures... with Blender.

 

But I am not a Blender user... so I am guessing.  Modeling is lots of work, yes?  Importing and exporting is even more work.  Importing from Google Sketchpad... directly into Blender, without having to use 3DS... would be better, if possible.  Using ONLY Blender would probably be the best, but I understand that Google has many nice models for Sketchpad.

 

And thanks Gryff, and anyone else who is working with Mira's experiments.  Mira, I hope the teacher realizes that you are trying things that are not easy at all, and you are experiencing the same problems with importing and exporting... that experts also have.  Each modeling software handles their meshes/models differently, and there is not much cooperating... it seems.  I think you will find that babylon.js will work very nicely... once the modeling is fixed... if it can be. 

 

I hope you get to play with a non-imported babylon.js BOX and GROUND someday soon, because there is lots of fun that can be had with those simple models... in babylon.js.  And particles... oh they are fun.  And physics applyImpulse... LOTS of fun.  Sprites... fun.  Shadows and animated lights and mesh... fun... and all easy.  (Easier than loading complex models after going through many imports and exports.)  :)

 

Stay positive.

Link to comment
Share on other sites

Ok Mira an update for you. See image below - the 1K mesh babylon (in purple) loaded into scene with all the other meshes using your code.

 

Now to get that to work I did the following things:

 

1. Removed any mesh faces that had no material assigned.

2. Removed the faces for the little person. (If you want to keep that figure then it should be made a seperate object as to see it from both sides you would need to turn off backFaceCulling - no need to do that for the whole mesh.)

3. Removed all those isolated vertices.

4. Removed all the materials and textures, then assigned one simple material for the whole building - purple.

 

It loads into your scene - and does not crash my browser - so even though the mesh topology is not great it can still be loaded.

 

I have been through those materials and textures trying to see what maybe happening materials.

 

1.That mesh has 29 materials that make up one Multimaterial in the .babylon file, and those materials use 19 textures (some of which are massive in size)

2. Very few of the textures are "Power Of Two" (POT) textures. Not sure what impact this has for WebGL and babylon.js as textures for your other models are also rarely POT.

3. Materials  _103, _104, _105, _201 seem to be the worst offenders.

4. The texture for material _201 is 2 MB in size, yet is used to texture only 6 faces that are rather insignicant (horizontal guttering on back of the building). A sheer waste of bandwidth.

 

So in a nutshell, there seem to be  big issues with the materials and textures for this mesh

 

cheers, gryff :)

 

post-7026-0-82823000-1401383026.jpg

Link to comment
Share on other sites

Hi Mira,

 

I watch and I board not a problem with textures.
but I noticed that all your objects does not 'name', (in BABYLON.SceneLoader.ImportMesh("??", .......)) you should give name to each object (real name of the objects when you saved).
You'll have to furnish a scale your objects and can be repositioned. If all of your objects uses the same texture is that they have the same name I think.
 
;)

 

 

Link to comment
Share on other sites

dad72, I create a new scene in Blender now where I define names for two objects like

 

https://www.dropbox.com/s/w6544dbw04i1xx6/%D0%A1%D0%BA%D1%80%D0%B8%D0%BD%D1%88%D0%BE%D1%82%202014-06-06%2015.51.49.png

 

and load with ImportMesh to my web-page  using name of objects , but this models doesn't loadind )

May be I do smth wrong ?

https://www.dropbox.com/s/7q5inf6jlhawmm6/htdocs.rar here is my cod

Link to comment
Share on other sites

One more question: How to change position of object, which was loaded by SceneLoader.ImportMesh?

 

Is exist something like 

newMeshes[0].position = BABYLON.Vector3.Zero();newMeshes[0].position = new BABYLON.Vector3(9,9,-21);

?

Link to comment
Share on other sites

gryff, hello again :)

I know you use Blender for import/export to Babylon, so can you ask for my question again please :) I have created a new model and solved problems with loading, but it still doesnt work with texturing

1212.png 

https://www.dropbox.com/s/ji59k9hccgq64sx/1212.png

 

I  named model in blender

Tried load from one directory and from separate

Textures have different names

What else?

Link to comment
Share on other sites

Mira, where's the link to your .rar or .zip file that contains your textures, your .blender file and your .babylon file?  Are the textures looking good when viewed/rendered in Blender, before export?  (thanks)

Link to comment
Share on other sites

Hi Mira,

 

No, it has no consequence, it's just a cache management and this file is not required.

 

Your problem is either a the export of the models, or improper use of the code.
 
Can be in us showing the part of code that loads your models, you will get more help.
Link to comment
Share on other sites

 https://www.dropbox.com/s/bjmoydrc7rgthge/loadingsc.rar - here is my scene

https://www.dropbox.com/s/x87ph1vhmkve4r3/blen.rar - here is blend files

 

Yep, all is looking good,  but I cant understand what the problem with textures

here is my code and blend files

 

I use ImportMesh function like

BABYLON.SceneLoader.Load("mesh/3/", "3.babylon", engine, function (newScene) {BABYLON.SceneLoader.ImportMesh("tulpan", "mesh/tulpan/", "tulpan.babylon", newScene, function (newMeshes) {newMeshes[0].position = BABYLON.Vector3.Zero();newMeshes[0].position = new BABYLON.Vector3(-6,6,15);newMeshes[0].scaling.x = 0.1;newMeshes[0].scaling.y = 0.1;newMeshes[0].scaling.z = 0.1;             });     BABYLON.SceneLoader.ImportMesh("dfk", "mesh/dfk/", "dfk.babylon", newScene, function (newMeshes) {newMeshes[0].position = BABYLON.Vector3.Zero();newMeshes[0].position = new BABYLON.Vector3(14.5,9,-24.5);             });  
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...