Terrain doesnt render on Android

Hello!
On my Scene node I have added a terrain, then imported it by:

//CODE FOR the blue default cube here!

//add terrain
terrain = assetManager.loadModel(“Scenes/Level.j3o”);
rootNode.attachChild(terrain);

It runs fine on desktop and renders perfectly. But on android it does not render at all (I do see the blue default cube but no terrain only black). This is really weird, any idea?
So on android -> not rendering terrain, on dekstop -> renders terrain. Ive tried it on both my Nexus 7 and HTC Sensation

Simon!

I’m afraid you’re going to have to give us some more details in order to figure out what is going on:

What version of the engine are you using (RC2, latest SVN, somewhere inbetween)?

Are you using the Lighting Material or Unshaded?

Is there anything in the output log?

etc…

@iwgeric said: I'm afraid you're going to have to give us some more details in order to figure out what is going on:

What version of the engine are you using (RC2, latest SVN, somewhere inbetween)?

Are you using the Lighting Material or Unshaded?

Is there anything in the output log?

etc…

Im using nightly and RC2 yes. All I did was created a new flat Terrain with TerraMonkey and then added a directional Light other than that I havent dont anything and its works om my mac with no problem. It doesnt crash and no really output information that is usefull yet

Thanks

Have you tried loading the j3o without TerraMonkey to see if it renders? I want to isolate if it is a rendering issue or a TerraMonkey issue.

@iwgeric said: Have you tried loading the j3o without TerraMonkey to see if it renders? I want to isolate if it is a rendering issue or a TerraMonkey issue.

It renders perfectly in SDK, It renders perfectly on dekstop, it does NOT render on Android. So its something wrong on the android part.

That’s good information, but that’s not what I asked. Does it render on Android without TerraMonkey? If not, then if you could provide a simple test case with your j3o I’ll take a look to see if I can figure out what is going on.

BTW, if you are using Blender and converting the .blend file to a .j3o file in the SDK, try checking the “Shadeless” box in the Material section of Blender for you object materials and see if that helps.

@iwgeric said: That's good information, but that's not what I asked. Does it render on Android without TerraMonkey? If not, then if you could provide a simple test case with your j3o I'll take a look to see if I can figure out what is going on.

BTW, if you are using Blender and converting the .blend file to a .j3o file in the SDK, try checking the “Shadeless” box in the Material section of Blender for you object materials and see if that helps.

How do you mean without terramonkey? And my models loads fine, its just the terrain that is generated in SDK that doesnt render.

The latest nightly version of JME has fixes for terrain on android, 3.0RC2 does not. Also some android devices have issues with lighting materials (which the Terrain shader essentially is).
TerraMonkey is the terrain system: TerrainQuad, the shaders, the editor, etc.

@Sploreg said: The latest nightly version of JME has fixes for terrain on android, 3.0RC2 does not. Also some android devices have issues with lighting materials (which the Terrain shader essentially is). TerraMonkey is the terrain system: TerrainQuad, the shaders, the editor, etc.

I have nightly. So how do I fix lightning and materials then? any idea?

Thanks

I don’t know if it is the terrain lighting material that is causing the problems. If you answer @iwgeric’s questions we can help better.

Also, are there any errors? Terrain cannot be larger than 256x256 on android.

@Sploreg said: I don't know if it is the terrain lighting material that is causing the problems. If you answer @iwgeric's questions we can help better.

Also, are there any errors? Terrain cannot be larger than 256x256 on android.

I didnt really understand his question. And no the terrain is not larger than 256x256. And there is no error, the input works and i can see other models attatched to rootNode.

Okey, I put a skybox and it turns out that the terrain render but its all black on android because i can see the mountains black sillouette with the help of the skybox

any idea why my terrain doesnt light up?

@simme909 :
Some Android devices don’t support ligthned materials (with shaders). You should give the terrain an unshaded material.

You can adept this code for that:
terrain_geo = (Node)getParent().getChild(“terrain-terrain_1_node”);
if(terrain_geo != null) {
Material mat = new Material(getAssetManager(), “Common/MatDefs/Misc/Unshaded.j3md”);
// mat.setColor(“Color”, ColorRGBA.Red);
Texture default_text = assetManager.loadTexture(“Tracks/Level_1/Textures/Terrain/simple/grass.jpg”);
mat.setTexture(“ColorMap”, default_text);
terrain_geo.setMaterial(mat);
}

@simme909, I had a similar issue with terrain materials. I did several things to finally correct it, hope one of them helps you::

-All textures must be power of 2 (128x128, 256x256, 512x256). My textures are 512x512 and run fine (on 4.2.2) so I’m not aware of a 256x256 limit.
-Use vertex lighting
-Not sure how you’re lighting, but spots and ambient didn’t work for me. Directional lights did the trick.

I’ve tested both on the Nexus 7 & Nexus 10, both running Jelly Bean 4.2.2.

@Blockhouse said: @simme909, I had a similar issue with terrain materials. I did several things to finally correct it, hope one of them helps you::

-All textures must be power of 2 (128x128, 256x256, 512x256). My textures are 512x512 and run fine (on 4.2.2) so I’m not aware of a 256x256 limit.
-Use vertex lighting
-Not sure how you’re lighting, but spots and ambient didn’t work for me. Directional lights did the trick.

@Blockhouse I’ve tested both on the Nexus 7 & Nexus 10, both running Jelly Bean 4.2.2.

Ive done all that except I dont really know how to change to vertex lightning. And Im using Directional light.

Thanks!

@Blockhouse said: @simme909, I had a similar issue with terrain materials. I did several things to finally correct it, hope one of them helps you::

-All textures must be power of 2 (128x128, 256x256, 512x256). My textures are 512x512 and run fine (on 4.2.2) so I’m not aware of a 256x256 limit.
-Use vertex lighting
-Not sure how you’re lighting, but spots and ambient didn’t work for me. Directional lights did the trick.

I’ve tested both on the Nexus 7 & Nexus 10, both running Jelly Bean 4.2.2.

The 256 x 256 limit is for the terrain heightmap and thats because IntBuffer is not compatible on Android, so a ShortBuffer had to be used

@wezrule, then I misunderstood that part of the conversation. Sorry about that.

1 Like