Can't apply texture to Node

After a CVS update a little while ago, I got an interesting bug - models which had previously loaded (with JmeBinaryReader) and worked correctly (.jme files made from .xml exported from blender by Hevee’s script) were now a lovely pink and yellow colour. After a little looking around, I found this was the “Missing Texture”  texture. This happened with two of the four airplane models in my game, on all parts of the model (there are several nodes in each). I’m pretty sure the UV is fine, since the “missing” texture is applied about how I’d expect it to be. The geometry is fine too.

I’ve been trying to fix this for some time now, but I can’t think of anything more to try. I have a simple class that loads the model, then applies textures and environment etc. to all children of the model root node, which I’ve checked covers all the nodes. but whatever I do, the pink and yellow texture is stuck. I’ve tried updateRenderStates, and I’ve checked that applying other states like CullState works, but TextureState never does.

The model is here: I’d be surprised if anyone manages to get a texture to stick to it. Note that the textures in the .jme are incorrect, I manually apply the correct texture myself, but basically if you can get any texture at all displayed on the Node named “plane”, you are doing better than I did :wink:

I assume the recommended way to do this now is with Collada? I’ve had trouble with this as well, trying it as a replacement to see if I can get textures. I get most of the mesh in jME, but missing some polygons from some meshes in the model. I’ve tried exporting from blender then reimporting, and the mesh looks absolutely fine, but in jME I get (for example) only the end-caps of cylinders. There were some cylinders in the original model, and I added more, they always get only the end-cap in jME. This happens in ModelLoader and in aircarrier with the loading modified to load a DAE file. The model is also rotated 90 degrees compared to the xml to jme route, interestingly when I rotate the model parent node 90 degrees, not all child nodes (some with no polygons) are rotated, I’m sure I must have got something wrong here since this seems bizarre.

BTW (yet another question), I assume there are now multiple formats with the extension .jme? I used to use XMLToBinary, so I have multiple .jme files I load with JmeBinaryReader, but ModelLoader rejects these (when using BinaryImporter it seems), since they are not a GZIP? Is there any documentation on the different formats and workflows? The wiki is a little vague on this, and the various previous threads on forums have just confused me terribly :slight_smile: If I get a clear answer, I could put something up on the wiki?

I always seem to find out that these things are my fault just after posting :slight_smile: Ah well.

Actually, I still don't know quite why texturing won't stick to that Node, so it might still be worth looking at, since it used to work and now doesn't. However, one way to fix it is to delete the mesh materials in blender (not the REAL materials, the ones on the edit pane). Something about the materials applied to the meshes leads to them not accepting texturing. Just deleting the materials so the meshes have no material at all fixes this. I assume some of the mesh material settings are exported by Hevee's script, although since there isn't a "Fail to texture properly" button in blender I don't know which one causes the trouble. I can provide the .blend files if anyone wants to check, for now I'm happy to just delete materials :wink:

Setting the texture at the root node will not override texture states already set lower in the scenegraph (it's how states in our scenegraphs work by default.)  You could write a recursive function that clears out the bad texture (perhaps as a little tool and then resave it with the BinaryExporter) and then apply the Texture at the root node and it should stick just fine.

Ah yes I was aware that the texture wouldn't go to children - I should have said, but I have a method already to apply the texture to all children, although removing it and applying at the root would have been more elegant :slight_smile: So there is something else going on there (the models were fine until a CVS update), I still don't know what though :wink: