[Solved] JME 3.1 Android Terrain Texture Problems

Hi there,

I’m currently trying out Android 3.1 alpha and I am having trouble with the Android terrain texture.

I have a scene with a terrain and two texture layers. The bottom being grass and the second being a road texture painted in a strip across it.

Unfortunately on Android this does not display properly. The road texture is spread out across the entire terrain and big yellow words say “Texture Missing” across it.

The grass texture is indeed in the assets folder in the SDK and this makes me believe this is a bug as the road texture should only be on one stripe.

It seems to want to cover the terrain completely with the second layer which definitely does not seem right.

Can you post the logs from the Android application?

I sure would if I knew what those were :stuck_out_tongue:

Where would I find these logs?

<3’s

http://lmgtfy.com/?q=android+get+logs+from+my+app

:stuck_out_tongue:

@Momoko_Fan

Well if it’s not specific to anything JME and you want it all here you go.

http://hastebin.com/nezidugoco.vhdl

Here it is:
E/com.jme3.texture.Texture(26331): SEVERE Cannot locate texture /Textures/terrain-alpha/Scene-terrain-Scene-alphablend2.png

By the way, if you click the link I posted, there’s an explanation on how to filter it so it only shows messages from your app as opposed from all other applications on the device.

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