Forum

Textures disappearing after building in project manager

13 July 2017 05:17
Hi all,

apologies for absolutely bashing this forum over the last couple days, but I can get a bit obsessed and I like to learn stuff really, really fast.

However, it seems the more 'aggressively' I use B4W, the more I seem to break it… This always the way with me.

OK, so I'm working on a mini-project to help me learn the API, and it looks great in fast preview, but when I hit the dev.html link in project manager, after compiling my build, the objects are not showing their textures.

…They're showing the material characteristics just fine (specular, alpha, diffuse properties etc etc), but the textures are just gone!

I've tried lots of different methods of compiling, including straight to web-players, but nope. Gone.

It only seems to have started doing it today, so have I 'switched something off' by accident? I dunno, this is strange one.

Any help gratefully appreciated.

All the very best

Charlie
13 July 2017 05:29
Your dev HTML file will always be your pre-compiled version. Even after you use Build, it will remain unchanged. It sounds like you are missing a texture image. Any error in the browser console log? It will throw an error if it can't find an image file. Make sure your image textures are PNG or JPG.
You can 'reload' them in the materials tab.
Also packing external files can help if you are moving your .blend file around.
13 July 2017 05:35
I'll test now. Back in mo'.
13 July 2017 05:39
Yes there's an error: "Could not load image", it's a PNG and I've used the image before, lots of times.

I reloaded, and still no joy. I might make a small video fir this one.

C
13 July 2017 05:45
Is the image in your asset directory?
(your_project/assets/texture.png)
If not, put it there and reload the image.
13 July 2017 05:51
Let me know if you spot anything:

link

Thanks again
13 July 2017 06:01
I think I've solved it.

You may remember yesterday that my Node Trees weren't saving. A big problem for executing my JS callback.

I used the 'welsh guys' file as a start file as his didn't have the problem, and there is probably file dependencies in the hierarchy that lead to his local machine, which may be confusing Blender.

I'll come back to this in the morning.

G'night and thanks.
13 July 2017 06:14
Placing your texture file in the asset directory of your project before you open and apply it in your .blend file will probably solve this.
13 July 2017 06:31
I tried automatically packing it as external data as you suggested. This works! However, it's a little bit of a concern as my project will consist of dynamically loading materials (which will contain textures), with the whole idea being to keep the 'active' blend files as light as possible whilst using inherit_material with an external library (blend file)

It's only confusing because B4W hasn't always done this, it's a really recent occurrence. I made this link after using B4W for just 2 days, and I knew ABSOLUTELY nothing about it, and I'm pretty sure I didn't build, put my textures in assets and THEN apply them. I think I should get some sleep and come back to it.

As always, thanks for your help. If you're not an employed Ambassador for B4W, you probably should be :-)
13 July 2017 07:42
It took me a while to get used to the B4W file structure and the Project Manager. For complex projects it is especially important to follow the existing file structure rather them than use your own file structure you are used to. If you load your texture files into the asset directory, your .blend files in the blend directory (I also put my image editing files here, photoshop, or whatever you use.). Nothing in the blend directory gets built and deployed. It is for source files only. All JSON files, images and sounds go in the asset directory. Then when you hit the Build function, it grabs all these files, if they are where they are supposed to be, and compiles them to a functional app that can be deployed on the web.
If you are going to be swapping materials dynamically, the material will be part of a JSON object. The image textures will still load from the asset directory.
When you pack your files in the .blend, it will actually make a new copy of this image with a long name like fg7fd6heie8rjfjhd8irhd8eie.png that will appear in your asset directory. So packing your textures might not always be what you want to do. I suggested it because it makes a new copy where it is supposed to be. If you are going to send your .blend file to somebody, packing the files is useful.
 
Please register or log in to leave a reply.