heightmap -> .egg

Hi, i’m looking for a script or bin or something, that can make easily a heightmap to a .egg.
Does someone developped something like that ?
Thanks ^^

there already was some code which generated a mesh from an image. which then could be saved to an egg… but the uploaded file doesnt exist anymore. it shouldnt be that hard to write anyway. in worst case you can use blender to workaround. just try searching the forum for “terrain” and you might find the old thread. maybe you can mail or pm the one who posted it

You can have a terrain generated by either the PGMM or the heightfieldTesselator modules and have it written to disk.
I would recommend the PGMM module since heightfieldTesselator is hard to configure for bruteforce terrains.
I would do it like this:

from libpgmm import PGMM
self.terrain=PGMM("myTerrain")
self.terrain.setHeightfield(Filename("myterrain.png"))
self.terrain.setBlocksize(4)
self.terrain.setFactor(99999)
self.terrain.generate()
self.terrain.flattenStrong()
self.terrain.writeBamFile(Filename("myterrain.bam"))
print "done!"
del self.terrain

And, you have a myterrain.bam with the terrain mesh in it. You can make the mesh have textures too, just put self.terrain.setTexture somewhere before the generate() call.

Yes, that’s a good solution, but in game whe use the heightfield tesseltor, in fact i need to make a .egg froma heightfield, for converting into .x and then loading it into the editor (Kworld6) editor who give me a XML file with all objets on the scene.
I’m afraid that creating an egg(or bam) from PGMM will be différent from the heightfield tesselator version in game, then the positions of objets in éditor will be différent from the game.
Hope you havec understand my bad english ^^

Not sure if we get you right here, so is this what you want to say:

(1) You have a heightmap as an image file, e.g. png.
(2) During runtime of your game you are using HeightfieldTesselator to create a LOD mesh of your terrain, from the image file.
(3) Before you run the game, to place objects on your game world, you are using a world editor (Kworld6). But this editor accepts only meshes in .x format (and not heightfield images).

Before I spend another 15 minutes on writing such a script: search for EarchSculptor, create a new project, import a heightmap image, export it as .obj (without optimization), and then convert .obj to .x

enn0x

Ok, thanks ennox ,and sorry to have bothered you, i didn’t know that earthscultor could save to .obj…
sorry for my boolz attitude.

Hey there are various Blender Scripts (ANT Landscape Generator to name one) that turn height map images into models and then you could use the fantastic Chicken Exporter to turn it into an Egg.

Just a reminder…Earthsculptor is no longer free…its a nice app but now its $50, unless you dont mind dealing with 257x257 maps…

ANT would be a great alternative indeed :wink:)

cheers
nl

Thx i look at it ^^