Regenerate heightmaps question

Hi, I’m looking to replace the heightmap of a terrain with another heightmap. The original heightmap is used to create a new one. I then want to replace the old one with the new one. I don’t know how this affects the terrain tho, or what the best way is.



I figure I could just copy the new values into the old array, but I’m not sure what that does to the terrain, and if I have to run some sort of updates (seems like kind of a hack, there ought to be a better method).



Speed is not essential here. This is done as a pre-processing step, not in real time. Don’t know if that matters.



Appreciate any advice. Thanks. // Androlo

Can you create a new terrain and just take the material and the previous terrain size parameters?



You could also use Terrain.setHeight() and set every height value at integer points so they match up exactly. (start with the terrain unscaled, do the height adjustment, then scale back).



If you copy the height values into the TerrainPatches, you will have to recalculate all the normals, this is easy with TerrainQuad.recalculateAllNormals();

@sploreg

Ok, I suppose creating a new terrain would be the best alternative. Then the program can mess it up all it wants and the original terrain isn’t destroyed (I want to read/write, forgot to mention that).



Thanks.



Great noise lib btw.

Thanks, I didn’t write it :stuck_out_tongue: Credits go to Gabor.