3 votes Vote

Generate heightmap data

Hi, I am trying to get the heightmap data for my terrain using the method described here: https://gitlab.com/denispahunov/mapmagic/-/wikis/MM1/Scripting_faq but the values in the results.height array seem to be different to the actual terrain? When I use results.heights.array[i] * the terrain height some are close but some are different. Is there something else i need to do to translate the heights array, or is there a special order to iterate through the array?

adrian , 26.04.2020, 07:49
Idea status: under consideration

Comments

Wraith, 26.04.2020, 11:46
Thanks for reporting the issue! Could you please specify:
- Your MapMagic version (could be found in Window - MapMagic - About)
- Steps to reproduce the issue. For example:
1. Start the new scene
2. Drag the attached graph to the scene to create MM object
3. Try linking the Scatter node output with the Curve node input
4. See the error in the console, and no link appear
- If your graph or scene is needed to reproduce the issue - add a link to dropbox/onedrive or other file share (or send it via email)
- If there are errors in the console - copy the first one (the top one)

There are plenty code blocks in the FAQ, what code exactly are you using?
adrian, 26.04.2020, 12:29
Sorry about that, it's the one at the top:
MapMagic.GeneratorsAsset mapMagicGens = MapMagic.instance.gens; //finding current graph asset
MapMagic.Chunk.Results results = new MapMagic.Chunk.Results(); //preparing results
MapMagic.Chunk.Size size = new MapMagic.Chunk.Size(MapMagic.instance.resolution, MapMagic.instance.terrainSize, MapMagic.instance.terrainHeight);
mapMagicGens.Calculate(512, 512, 1024, results, size, 12345);

I am using MapMagic 1, i just tried it with
1. Start new scene
2. Create MM object
3. Attach above script.
adrian, 26.04.2020, 12:36
Here's the script i am using attached to my MapMagic object:
https://hastebin.com/kewemocixo.cpp

It just makes prints the heights array and the terrain heights using SampleHeight to two text files so I can compare them.

Leave a comment