Hey,
When I draw the heightmap it will be a flat land instead of hills:
[java]
mat_terrain = new Material(assetManager,"Common/MatDefs/Terrain/Terrain.j3md");
mat_terrain.setTexture("Alpha", assetManager.loadTexture("test.png"));
Texture grass = assetManager.loadTexture("Textures/Terrain/splat/grass.jpg");
grass.setWrap(WrapMode.Repeat);
mat_terrain.setTexture("Tex1", grass);
mat_terrain.setFloat("Tex1Scale", 64f);
Texture dirt = assetManager.loadTexture("Textures/Terrain/splat/dirt.jpg");
dirt.setWrap(WrapMode.Repeat);
mat_terrain.setTexture("Tex2", dirt);
mat_terrain.setFloat("Tex2Scale", 32f);
Texture rock = assetManager.loadTexture("Textures/Terrain/splat/road.jpg");
rock.setWrap(WrapMode.Repeat);
mat_terrain.setTexture("Tex3", rock);
mat_terrain.setFloat("Tex3Scale", 128f);
AbstractHeightMap heightmap = null;
Texture heightMapImage = assetManager.loadTexture("village512.png");
heightmap = new ImageBasedHeightMap(heightMapImage.getImage(), 1f);
heightmap.load();
terrain = new TerrainQuad("Village", 65, 513, heightmap.getHeightMap());
terrain.setMaterial(mat_terrain);
terrain.setLocalTranslation(0, -100, 0);
terrain.setLocalScale(2f, 1f, 2f);
rootNode.attachChild(terrain);
List<Camera> cameras = new ArrayList<Camera>();
cameras.add(getCamera());
TerrainLodControl control = new TerrainLodControl(terrain, cameras);
terrain.addControl(control);
CollisionShape terrainShape = CollisionShapeFactory.createMeshShape((Node) terrain);
landscape = new RigidBodyControl(terrainShape, 0);
terrain.addControl(landscape);
[/java]
And this is the heightmap(testing heigthmap its ugly i know :P):
http://updo.nl/file/bf5f2c1d.png
For testing you can:
Load the image into the SDK terrain editor and see what that looks like.
Try terrain.setLocalScale(2f, 128f, 2f); - it might just be that the scale is to low.
Oh yeah, why do you translate the terrain (terrain.setLocalTranslation(0, -100, 0);)?
Can you post a screenshot of what you are seeing?
And try what @jmassing suggests: changing the scale
@jmaasing said:
For testing you can:
Load the image into the SDK terrain editor and see what that looks like.
Try terrain.setLocalScale(2f, 128f, 2f); - it might just be that the scale is to low.
Oh yeah, why do you translate the terrain (terrain.setLocalTranslation(0, -100, 0);)?
Thnx it works :)