Problem loading textures

Jmonkey 3.0

I recently made changes to one of my models. I deleted the previous model and imported the updated model into my project. Now I’m getting an error that the texture can not be found and I’m asked if I want to search for it. After locating texture and adding it , the model loaded with a critical error “asset path is outside asset manager root”.

The model will display in the scene but the texture coordinates are off. I thought maybe my model was corrupted so I tried importing a simple cube and received the same error. I’m not sure what is going on here. I haven’t made any changes to my code and this is my first time seeing this error. I tried generating tangents / normals but that did nothing.

Here is a screen shot of a test scene I loaded. This is now happening any time I try to load a model into any project.

*** As a side note I would like to point out if you don’t close and reopen Jmonkey after importing an updated model Jmonkey will still show the original model in the preview pane and will not load the new textures at all.

Cube with light map. The cube texture is drawn on the default position however the light map seems to be following the UV coordinates I unwrapped. I added the light map using the scene editor by making a custom material. With or without the custom material the cube texture doesn’t follow the unwrapped coordinates.

What file format are you using to import the model?

It seens your UV mpas are wrong, did you confirm this is ok rendering on blender ?

Everything renders correctly in blender. I’m importing .blend files directly.

Well it does look like UV is messed up. rendering in blender… you’re certain its using a correct uv map when it renders in blender? I only ask since there are a number of different ways it could be rendering fine in blender even with a broken uv map

Here is the test scene rendered in blender. I UV unwrapped the cube. I used the same process previously and my models loaded flawlessly this is a new error to me and I’m not sure what I did. I may have fat fingered a hot key in blender or Jmonkey.

Well that UV is obvs different to the one JME is using… I’m sure you’ve done it right, and I have no knowledge of how experienced you are with blender, but that render does not discount broken UV or multiple UVs.

Either way unless someone else knows I’d need either code or a closer look at the model to help you. I’m sure its something simple, just not sure what.

Nothing special about loading.

 sceneModel = assetManager.loadModel("Models/test/test.j3o");
    
 TangentBinormalGenerator.generate(sceneModel);

I can’t upload the blend file to the server so I’ll find a host for it later and if you’re bored you can check it out. Until then I’m going to keep using a scientific method called guessing to see if I can make some progress.

Does removing the tagent generation change anything? Also if you dont get it working, http://www.filedropper.com/, model or .blend id be happy to look.

Removing the tangent generation causes the cube to render black.

Here is a zip folder with the blend file and the rock + normal texture. Google drive isn’t very intuitive. To download the file click the white download arrow at the top center of the screen.

https://drive.google.com/file/d/0BzNiNddNcUlcd2hlaGpZaXBNSkU/view?usp=sharing

Removing that shouldnt make it black afaik…

The uvs are fine in the blend as you said. I exported to ogre and got the following

Spatial cube = Main.assetManager.loadModel("Models/test/cube.j3o"); 
TangentBinormalGenerator.generate(cube);
Material mat2 = new Material(Main.assetManager,"Common/MatDefs/Light/Lighting.j3md");
mat2.setTexture("DiffuseMap", assetManager.loadTexture("Textures/bricks1.jpg"));
mat2.setTexture("NormalMap", assetManager.loadTexture("Textures/bricks1bump.png"));  
cube.setMaterial(mat2);
rootNode.attachChild(cube);


Which is what I expected (the normal map wasnt that similar to the texture hence the funny result)
Nothing like yours though. Have you tried exporting to obj or ogre?

I personally have never gone straight through .blend so I’m not sure how it gets hold of the UV map.

Yep , I just did that. I exported to .obj and lo and behold it loaded fine. The .blend files also have the bad habit of not saving ambient data either. Guess I’ll be using more .obj files for now.

I corrected the normal map and using an .obj file I have success. Lesson of the day “use .obj files”.

1 Like