Jump to content

Load texture from .babylon


Uniform
 Share

Recommended Posts

Hello,

 

I'd like to know how to load a mesh produced with blender (textures and animations included) with a .babylon file. I am new to this and haven't found the information in the tuts. 

I have this but it is loading the 3d geometry only, no textures.

var rt = [];

BABYLON.SceneLoader.ImportMesh("", "", "raiten.babylon", scene, function (newMeshes){
    rt = newMeshes[0];
    rt.showBoundingBox = true;
    rt.scaling = new BABYLON.Vector3(0.4,0.5,0.4);
    rt.position = new BABYLON.Vector3(3,1.5,-4);
});

Thanks,

Link to comment
Share on other sites

@gryff

 

and also have any errors in the console like failed to load texture? mostly a cross origin problem. you are running your file locally from the browser, you can set a switch in or browser it depends, something like : -allow-cross-orgin/load file from disk etc.

also

 

Link to comment
Share on other sites

@Uniform : try checking the "inline "box outlined (below in the image) when you are exporting your .babylon file.

I have never tried it - as I'm always adjusting and tweaking my images. But it is supposed to "turn textures into encoded strings for inclusion in the source code"

On 2016-07-25 at 7:17 PM, Nabroski said:

add [at]gryff he knows everything about it (maybe)

@Nabroski

I would put the emphasis on the "maybe":lol:

cheers, gryff :)

:

 

 

inline1.png

Link to comment
Share on other sites

But how do you load textures from the .babylon file?

How do you get it from with code? Do you need to load the texture separately or you can just use it if you export  the mesh with .babylon format?

 

Basically do we have any code fetching the texture from .babylon file containing the textured mesh?

Link to comment
Share on other sites

Usually, when people report something like this, they forgot to add a UVmap.  You do not need to in-line.  That is for possibly reducing load time, and optional.  You should not have to do anything other than to make sure the texture file is is located where you say it is.  I do not use a .babylon very often & never ImportMesh.  Where is ""?  Shouldn't this be something like "./"?

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