[Solved] JME 3.1 Android Terrain Texture Problems

After deleting the scene and remaking it the exact same message appears again.

The texture is built into the .apk and it works fine on pc.

This has to be an issue with loading the terrain materials for Android in 3.1

The slash on the front looks a little suspicious. Is this texture set in code by any chance?

Yah, looks like: Asset paths that begin with "/" don't work on Android · Issue #352 · jMonkeyEngine/jmonkeyengine · GitHub.

Try removing the lead “/” if you can;

Any advice on how to do this?

The fact that this is only in the Android asset manager and to work on pc it needs the / makes it a little more difficult of a task.

Can you answer my question?

Is the texture set in code or?? Can we see the code?

3.1 pc doesn’t require a leading “/”. I had such a problem on android 3.1, removed all “/” and now it works on pc and android on 3.1.

Neither did 3.0 pc. A leading slash for assets is kind of a bug in user code that I guess we should detect and complain about.

True, but I was answering a claim made specifically about 3.1.

I think the jira issue has recorded problems linked to a leading trail in 3.1 android as a bug or a regression.
Zzues kindly tried to correct it but it seems it’s still there. Anyway, I simply removed the leading trail from all my asset paths and works fine.

Yes, asset paths should not have a leading slash. We should probably throw an IllegalArgumentException if we detect that they do.

Totally up to you peeps.

@pspeed

I didn’t know that question was aimed at me as it was directed at MoMoko Fan’s comment.

No I have nothing to do with the creation of this material it is using the Terrain Editor.

I open scene composer → add terrain → edit terrain → add layer → paint road stripe on → save.

The scene and terrain is built into the ,j3o.

So no it’s not set in code by me in any way shape or form.

I wouldn’t have taken to the forums if I did not truly believe this was a bug behind the scenes.

Yeah, the question I was for you.

Sounds like the terrain editor has a bug. The good thing is that you could work around it in code by re-setting the texture yourself.

Imgur

After attempting to fix this for awhile I can’t seem to find the solution. The first image is the game being run on Desktop, The second is a screenshot from Android.

The map says “Texture Missing” in the texture that should be the stone path.

I believe it may be the leading / issue but I don’t know how to change the path the asset manager is looking for in relation to just the textures for terrains. All other textures in the same folder to load just fine.

geom.getMaterial().getTextureParam( [Layer Name] ).getTextureValue()).getName()

Here is my current method.

http://hastebin.com/jixelisehe.avrasm

So far removing the starting slash has no effect on how the terrain looks in Android.

OKAY SOLVED

I’ve found the Issue.

It is a leading slash issue but this bug is ONLY in the alpha map texture of a terrain created in the scene composer.

On Desktop this leading slash is not a problem but on Android it causes the map not to be found.

This method was what finally solved it.

http://hastebin.com/icilizozok.avrasm

As you can see only the alphamap layer must have the opening slash removed.

1 Like

Hello BigBob,

The content of the above URL is gone. Could you please post the content in this thread so your solution is still available?

Thanks,
Jacob

Hi there,

http://hastebin.com/xokodusava.java

This I believe is the method you’re looking for. If put your root node through that and it will make the entire scene the unshaded material.

1 Like

Kind of odd not to just use a code block, though.

I never know how to get them right.

They always look awful.

Hi there,
Thanks for the code.
A much easier fix is to fix the wrong path in the Android Assetmanager:
assetManager.unregisterLocator("/", AndroidLocator.class);
assetManager.registerLocator("",AndroidLocator.class);

Yours,
Jacob

1 Like