setHeightMapValue TerrainPage has no effect?

        AbstractHeightMap map = null;
        try {
            map = new ImageBasedHeightMap(resizeImage(ImageIO.read(heightMapImg), heightMapSize, heightMapSize));
        } catch (IOException ex) {
            Logger.getLogger(LoadGeoMap.class.getName()).log(Level.SEVERE, null, ex);
        }
        // Dynamic scaling
        float baseScale = (float) (0.1f * Math.pow(2, i - 1));
        Vector3f terrainScale = new Vector3f(baseScale, 0.01f, baseScale);  
        TerrainPage page = new TerrainPage(fileName, 33, map.getSize(), terrainScale, map.getHeightMap());
        page.setLocalTranslation((east - 5) * (heightMapSize - 1) * baseScale, // X
                0, // Y
                (north - 45) * -(heightMapSize - 1) * baseScale);   // Z
        page.setHeightMapValue(1, 1, 0.5f);
        page.updateFromHeightMap();


Im using a imagebasedheightmap, but if i set a heightmap value, it has no effect, the height of the specific point doesnt change.
Any help on this? Thanks!

Lets see…



You set the coordinate (1,1) in the TerrainPage with the height of 0.5f.

page.setHeightMapValue(1, 1, 0.5f);



Then you overwrite all values in the TerrainPage with the ones from the height map.

page.updateFromHeightMap();



geee, wonder what the problem could be?

Okay…


      
System.out.println("Loading heightmap: " + heightMapPath + ", level: " + lod.get(i));
        // Url is valid, create page and add it to the root.
        int heightMapSize = lod.get(i) + 1;
        AbstractHeightMap map = null;
        try {
            map = new ImageBasedHeightMap(resizeImage(ImageIO.read(heightMapImg), heightMapSize, heightMapSize));
        } catch (IOException ex) {
            Logger.getLogger(LoadGeoMap.class.getName()).log(Level.SEVERE, null, ex);
        }
        // Dynamic scaling
        float baseScale = (float) (0.1f * Math.pow(2, i - 1));
        Vector3f terrainScale = new Vector3f(baseScale, 0.01f, baseScale);
 TerrainPage page = new TerrainPage(fileName, 33, map.getSize(), terrainScale, map.getHeightMap());
        page.setLocalTranslation((east - 5) * (heightMapSize - 1) * baseScale, // X
                0, // Y
                (north - 45) * -(heightMapSize - 1) * baseScale);   // Z
        page.setHeightMapValue(1, 1, 0.9f);
        System.out.println(page.getHeight(1, 1));



But still no effect. Log:
Loading heightmap: data/heightmap/germany/deN46E06.png, level: 32
0.38

And no visual change?

Ohmari,



You'll have to debug and step through the method in TerrainPage for setHeightMapValue() as it could be that it doesn't propagate the set to the appropiate TerrainBlock (which is holding the heightmap).

Ohmari wrote:
And no visual change?
You will be dissapointed if you're expecting to update the terrain mesh after creation, as I'm pretty sure it's fixed (as I cannot see a recreate mesh method on the TerrainPage / TerrainBlock).