Page 1 of 1
Is it possible to convert an image into a minetest map?

Posted:
Fri Mar 29, 2013 17:52
by 12Me21
I was wondering if it is possible to convert an image into a minetest map, where one pixel is one block, and have different colors mean different heights and maybe transparency could be what type of block it is. that would be cool because I want to make a minetest map be like earth, (except not round) by finding a map where different colors mean different heights and converting it to a minetest map.
Example: (with smaller numbers/less colors so it's easier)
blue= -10 - -1
green= 0 - 9
yellow= 10 - 19
orange= 20 - 29
red= 30 - 39
Height could be generated the way it is now, but only within the limits of the color, like for green, there would be anything from 0 - 9.
It would also be cool if you could convert a map to an image, either in black and white (lighter=higher) or color, and instead of colors like "red" "yellow" "blue"... it would probably use hexadecimal colors (or RGB, but with hexadecimal it is easier because it's only one number, and you could just make it higher for higher elevations), which would allow for a height range of 16,777,216 ,which is WAY more than enough for the height range of 62000 (31000 in each direction) we have in minetest now.
The transparency could mean different blocks, like transparency 200 (out of 255) could mean grass, or something. the only problem is that it would only work for 256 types of blocks (at the most), but you could use RGB colors and have red and green mean height and blue+transparency mean type of block.

Posted:
Fri Mar 29, 2013 18:09
by VanessaE
If one were to do this, I would suggest that saturation be the height of the map at any given point, normalized to say zero saturation being 100m below sea level, and full saturation being 100m above sea level. Then, hue would be linked to the block to place at the surface, since you would only need a few block types, with the assumption that everything below the surface would be stone or desert stone.
That way the image file would still be more or less human readable.

Posted:
Fri Mar 29, 2013 18:12
by stu
+1
I am currently working on something very like this. Essentially what you are describing here is known as a 'height map'.
Re: converting a minetest map to an image, see minetestmapper.py in /minetest/util

Posted:
Fri Mar 29, 2013 21:10
by sfan5
You could convert the image to a worldedit schematic and import it

Posted:
Fri Mar 29, 2013 21:35
by stu
sfan5 wrote:You could convert the image to a worldedit schematic and import it
Sure, you could do that but it would be quite limited and probably rather slow.
What I am thinking of is basically reversing the mapper process to generate the sqlite map from an image.
It really shouldn't be that difficult...If only I could get my head around the db structure and the zlib stuff.

Posted:
Fri Mar 29, 2013 21:45
by prestidigitator
Looking at the mapgen code, I think it would be pretty easy to create a new mapgen that just pulls from a file. Then you could just change the mapgen settings in minetest.conf while creating the world, or just insert them into a map_meta.txt file for a new world directly, of course. I might give that a try at some point.

Posted:
Fri Mar 29, 2013 22:00
by stu
prestidigitator wrote:Looking at the mapgen code, I think it would be pretty easy to create a new mapgen that just pulls from a file. Then you could just change the mapgen settings in minetest.conf while creating the world, or just insert them into a map_meta.txt file for a new world directly, of course. I might give that a try at some point.
Do you mean the c++ mapgen or lua?
This is another approach I have considered, however, for very large maps like the poster is suggesting, I fear file size may become something of a problem.

Posted:
Sat Mar 30, 2013 00:52
by prestidigitator
stu wrote:prestidigitator wrote:Looking at the mapgen code, I think it would be pretty easy to create a new mapgen that just pulls from a file. Then you could just change the mapgen settings in minetest.conf while creating the world, or just insert them into a map_meta.txt file for a new world directly, of course. I might give that a try at some point.
Do you mean the c++ mapgen or lua?
This is another approach I have considered, however, for very large maps like the poster is suggesting, I fear file size may become something of a problem.
C++. The file size shouldn't be any bigger than an image.... ;-)
Anyway, if you require that the image file be saved in a simple format (raw image tuples, for example) you wouldn't have to suck the whole thing into memory; just skip to the parts corresponding to the chunk you are currently loading.

Posted:
Sat Mar 30, 2013 03:24
by BrandonReese
I've been wondering about this myself since discovering Minecraft Worldpainter, I don't have Minecraft so I immediately tried to figure out if there was a way to use it with Minetest.
http://www.minecraftforum.net/topic/231255-worldpainter-v124-graphical-interactive-map-creatorgenerator/ It exports directly to minecraft files, or it can export a height map, and a color image of the map. I thought combining the height map and color image somebody could write something that would directly create a SQLight map database for minetest.

Posted:
Fri Jun 07, 2013 18:47
by Marya Clare
Finally, someone other then me has seen world painter and plays minetest! I have world painter on my computer, I think that it may be possible to do this provided you nix the other realms (end, nether). I am aware there is a nether mod but I don't think it would be stable enough or too complicated to put in at the moment. Also to be nixed are minecraft textures from said realms along with the mushroom ones. All these things can be added once an established stable recreation can be found. So at best it would be good to remove and replace all textures with minetest ones. Alter the code to except the new ones. Also give credit to original creator of world painter and hopefully get permission so that someone can alter it and release to minetest players. I see lots of potential with this thing. I suck at coding at the moment but I can see if I can configure it to accept minetest textures. Yes, I will also email creator.

Posted:
Fri Jun 07, 2013 18:49
by Marya Clare
Also I know the above post sounds a tad bit ambitous, I think this can work if the world painter is done over like minetest, update by update starting with minetest textures first. I don't currently own minecraft unfortunatley so I can't test my created worlds yet. This would give me the opportunity:) Sorry for the TL; DR:P

Posted:
Fri Jun 07, 2013 19:01
by Marya Clare
Ok...bad news the guy who made is from the netherlands and I am not sure if he knows english or had someone translate it for him to release to minecraft players. I think he may actually english but I can't be sure. I found his website
http://www.pepsoft.org/index.html which has his email, you may have to use google translate to help navigate through it.

Posted:
Fri Jun 07, 2013 21:44
by severak
Great Idea. It will be fine to generate realistic terrain with rivers etcetera from heightmap of real terrain. I will watch progress here :-)

Posted:
Sat Jun 08, 2013 18:23
by Mossmanikin
I like this idea a lot.
Marya Clare wrote:Ok...bad news the guy who made is from the netherlands and I am not sure if he knows english or had someone translate it for him to release to minecraft players. I think he may actually english but I can't be sure.
Although I'm quite sure the author speaks English, I'd like to offer my help, just in case a readable translation of more complex text is needed.
(I know google translate results aren't always satisfying.)

Posted:
Sat Jun 08, 2013 18:30
by rubenwardy
You could have two images.
One is grey scale, and is a height map.
The other is coloured and represents the type of block.
1 pixel = one block.
Of course you would only be able to do one layer thick maps this method.

Posted:
Sun Jun 09, 2013 17:55
by severak
@rubenwardy: good idea about two images
I feel that there should be some inteligence in converting.
For example if you have ocean, you probable have some sand on the ocean floor and under the sand there is usually stone.
The same comes with "dirt_with_grass" on hills. Usualy there are two or three blocks of plain dirt under it and later there is stone under it all.
Unfortunately,
minetest map format seems to be bit hard for me to convert in it.

Posted:
Sun Jun 09, 2013 22:30
by Dan Duncombe
This would be cool if you could convert real life maps (eg ordnance survey) to this kind of image then import it
Re: Is it possible to convert an image into a minetest map?

Posted:
Sun Dec 20, 2015 22:37
by bobomb
Realterrain mod does exactly this.
viewtopic.php?f=11&t=12666