Jump to content

A mesh with uv mapping from blender does not appear in Babylon.js...


Recommended Posts

Hi gentlemen !


I need your help again...


Like the title sai it... i would like import a mesh from Blender in Babylon.js with uv mapping.


But with the material and texture, the mesh doesn't appear... and of course without the material and texture, the mesh appears correctly.


I see that Blender have two kind of material options : "Data" and "Object".In first, I tried to create the material and texture with the option "Data" only, after with the option "Object" only and to finish with the two options but always nothing in Babylon.js... To create this material and texture, I took my inspiration of the exemple made by Deltakosh here : 






But i don't see that I made wrong... because except the option "Use alpha" and "Diffuse", all of the checkbox are uncheked... I tried to chek many option at random but nothing better...


So my request... Is it possible to have an exemple of mesh creation with uv mapping to import in Babylon.js from Blender?



After my job, I will post my file or screeshot of my material and texture set up...



Thanks you for your help !!





Link to comment
Share on other sites

Hello Zino, 


It would be nice to share a live example of your problem, or the babylon file you try to import.


However, my first guess is I think the problem is not from blender but in your texture path :)

Are you sure the texture and the babylon file are in the same folder ? Do you have any errors in the javascript console ?


Thanks :)

Link to comment
Share on other sites

Yes the files are in the same folder...


I 'll try tonight to see if firebug see a problem with the path or anything else...


I upload my babylon and blender files as soon as possible and I will put many .gif to show you my material's and texture's set up ... 


Thank you very much for your fast reply Temechon :) !

Link to comment
Share on other sites

Here, my files :








- Striker_Tete_1_tex.blend is my Blender file with uv mapping, material's and texture's set up,

- Striker_Tete_1_tex.babylon is my babylon file exported with the exporter of babylon.1.7.3.js ,

- Striker_Tete_1_tex.png is my texture file created with uv editing of Blender and modify with Gimp.




I precise many useful things (...maybe... ^^ )


- I use Blender v2.67,

- In the link that I posted primarly, I don't see the sphere at the end of page... and I saw that Deltakosh speaks about drivers to anyone in a topic... Is it the problem ?





Link to comment
Share on other sites

Nothing is wrong with these files.. Can you please try to upload the zip here : http://babylonviewer.herokuapp.com/

I just did it and I can see this : http://i.imgur.com/HisHfFC.png


When the scene is loaded, hit the 'back' arrow of your keyboard until you see the head.


If you cannot see it, it sure is a problem with your computer...

Link to comment
Share on other sites

I took a look at your blend file and your babylon file.


The blend file is fine except you have your model and camera way up above the baseline.


In the babylon file is this code:





The Camera is 9.2 units up in the air but it is looking at a spot .9958 units up in the air - IE. it is looking down.


Fix: Select your light, camera and model and drag them down so that the model just touches the 0,0,0 point. Now export your scene as a .babylon file.


It should work.


cheers, gryff :)

Link to comment
Share on other sites

Damned... I put a zip with my two files but I have an error "The babylon file cannot be found" ..... :huh:


Then, more explication on my project...


This mesh is a part of different meshes which are on a skeleton. Every mesh has it position calculated to be linked to the bone's skeleton interested (...the head's bone in this case...). So I don't think that is a problem of camera because I see all of my skeleton in my babylon scene...


Normaly, I delete the light and the camera in Blender because I lead that in my babylon's code... I used it to do the verification of the uv texture position...  


With the post of Temechon, I think more that is a problem with my computer... :wacko:


Is it my graphic card drivers ???


I'm in spleen... :(

Link to comment
Share on other sites

So I don't think that is a problem of camera because I see all of my skeleton in my babylon scene...



Well, the blend file only contains one part -what appears to be a head.


When I apply the fix I described above this is what I see in the babylon sandbox:




Without trying the fix above, load your babylon file and the texture into the sandbox - the screen will be mainly black. Now hit the down arrow key a couple of times - the model should appear.



cheers, gryff :)

Link to comment
Share on other sites

Sorry my fault for the folder  :)


Yes it's good in the babulon viewer, I see my object...so why it doesn't appear in my game ??


There is many special code's lines for the RGBA texture ?? an boolean or anything like this ??  


Or it's my version of babylon.js (v1.7.3) ???


P.S :


I m using firefox and opera to do my test... of course it's the same result...

Link to comment
Share on other sites

Temechon find the answer !


The problem didn't came  of Babylon or Blender but in my code...


To realise an import I use the method : 

BABYLON.SceneLoader.ImportMesh("spaceship", "Scenes/SpaceDek/", "SpaceDek.babylon", scene, function (newMeshes, particleSystems) {});

But my fault was that I write the path in the third param, like this in this example :



..."spaceship", "Scenes", "/SpaceDek/SpaceDek.babylon"...


Babylon.js go to the folder "Scenes" to catch the texture but there was placed in "Scenes/SpaceDek/" for me... but without texture, the mesh displauyed correctly  :)


So be careful to your path in the seconde param.



Thanks you again Temechon and gryff!










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.

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.


  • Recently Browsing   0 members

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