Model not showing image textures

Hi, I’m a novice who is probably making as simple mistake, and appreciate any ideas.
I have a OBJ model that I imported in Blender and exported as a BabylonJS file. I used the fast world builder and the SceneLoader.Append method to load the model. Everything is working very well, except that the image textures aren’t being applied to the meshes. The appropriate texture image files appear to be referenced in the material definitions of the Babylon JSON, and the meshes appear to reference the IDs of the image materials (I include some of the relevant JSON below). I don’t see 404 image requests. Visually, it appears that bump map images are being applied, and I do see the bump map images being requested:

31%20PM

The relevant bits of the .babylon JSON are:

Example of a material (the rendered scene isn’t displaying the surface image, but appears to show the bump image:
{“name”:“cgaxis_models_50_24_02.jpg”,“id”:“succulent.cgaxis_models_50_24_02”,“ambient”:[0,0,0],“diffuse”:[0.8,0.8,0.8],“specular”:[1,1,1],“emissive”:[0,0,0],“specularPower”:64,“alpha”:1,“backFaceCulling”:true,“checkReadyOnlyOnce”:false,“maxSimultaneousLights”:4,
“bumpTexture”:{“name”:“cgaxis_models_50_24_02_NORMALS.jpg”,“level”:1,“hasAlpha”:0,“coordinatesMode”:0,“uOffset”:0,“vOffset”:0,“uScale”:1,“vScale”:1,“uAng”:0,“vAng”:0,“wAng”:0,“wrapU”:0,“wrapV”:0,“coordinatesIndex”:0}},

Example of a mesh:
{“name”:“cgaxis_models_50_24_02”,“id”:“cgaxis_models_50_24_02”,“materialId”:“succulent.cgaxis_models_50_24_02”,“billboardMode”:0,“position”:[0,0,0],

Any ideas would be great, thanks so much!

I can’t say I recognize the problem just from the picture myself, but if you post a playground with your model loaded we could probably take a look for you!

If you need a public place to host the model, a link to the raw on github can be loaded from the playground just fine.

As SeomtimesIMakeThings says, a playground could be fine, and also more details:

  • you import obj into Blender, but do you reexport as obj too?
  • is your Blender scene on Blender Render or Cycles? (or even Eevee if your use 2.8beta)
  • are your textures next to your .obj or in other folder?

A good start could be to use an empty scene and made tests just with a simple cube (or, of course, a Suzanne), you will quick be able to compare what’s wrong with your current object :slight_smile:

Dear Vinc3r,
Thank you very much for the help. I would happily create a BJS playground to show this in, but can’t figure out how to upload the file dependencies. I committed this example to GitHub (github_com/CrowAndSky/BJS-POC), and set it up to display as a static site. But GitHub isn’t serving the .babylon file in the JSON file type (or at least, I think that’s the problem). The site is crowandsky.github_io/BJS-POC/. In any case, you can see all the files there.

Unfortunately, I’m a front-end web dev with no 3D modeling experience at all. I am using Blender 2.79 to export in model as a .babylon file. The Blender UI frankly terrifies me. I tried some different “baking” settings to no avail. I also tried using the model in the .obj format, but that seemed to have other problems. Also, the .obj version was much larger, which matters a lot to a web dev. I do have the images in the same folder with the .babylon file.

Thanks so much again!

A quick doc about external assets:Using External Assets - Babylon.js Documentation

Woops, it seems I’ve made a tips duplication in my last commit on this page Available Meshes to Import - Babylon.js Documentation (section From external storage providers). Should I remove this section and merge it in the external_pg_assets page?

About loading from github, once I’m on the file page, I click on “view raw”, and it is this link I used then : https://www.babylonjs-playground.com/#TH16ID#3

About your textures I suspect it’s just wrong channels assignation in Blender side. See about Texture Influence.

Vinc3r,
Thank you very much for the follow up! I was just trying (and failing) to get the reference to .babylon file in my GH repo to work in a playground when you posted this. Starting with your playground, I was able to create one that looks just like my local: https://playground.babylonjs.com/#N97D59#6

Thank you very much also for pointing me to the documentation on Blender export, that looks very helpful.

I started working with BabylonJS with the intention of spinning up a POC in a few hours. I’ve driven down much further than I expected only because the platform is so exciting and the community support so amazing. I hope that one day my team creates something worthy of the BJS demo page.

Thanks again,
Preston

1 Like

yeah probably

This is the way you can please us the most :slight_smile:

For those who are interested: The Using External Assets - Babylon.js Documentation doc’ page will be soon updated, with many new informations :wink:

It is live!!

1 Like