Page 1 of 3

[Mod] Real Terrain [0.1.0] [realterrain]

PostPosted: Mon Jun 22, 2015 07:40
by bobomb
Use an image as a heightmap, use another image as a biome map, edit map settings and even biomes in-game, overlay river and road layers, do raster analysis. Effectively this is a WorldPainter mod. You can use spatial files for elevation and landcover or you can paint your own using any paint program. You can also persist structures using in-game tools.

use a grayscale image as a heightmap:
Image

use in-game settings tool (r,g,b color band overlay shown in background)

Image

configure biome interpretation in-game:
Image

results:
Image

perform on-the-fly raster analysis such as slope and aspect:
Image

overlay an image onto the map (here a grayscale version of the same image is used as the heightmap) in 216 colors:
Image

dependencies: requires mod security disabled, for more specific and advanced features an image library will be required, see below...

download latest zip: https://github.com/bobombolo/realterrain/archive/master.zip
github: https://github.com/bobombolo/realterrain
youtube tutorial: https://www.youtube.com/watch?v=66pehrH6Bh0

license: original content is WTFPL

includes several lua libraries including: magick, imagesize, imlib2, graphicsmagick, lua-socket, lunatic-python (not all are used). ImageMagick is the most tested library for this mod, and until recently was a requirement. GraphicksMagick is recommended for speed and automatic bit-depth detection and handling of strange GIS rasters.

thanks to paramat for the skeletal mapgen mod code: https://gist.github.com/paramat/389ee65ce9378d9dad25

Re: [Mod] Real Terrain [0.0.1] [realterrain]

PostPosted: Mon Jun 22, 2015 16:22
by TG-MyinaWD
Oh my that is crazy.
Very nicely done to.
Might be interesting to see on an server.

Re: [Mod] Real Terrain [0.0.1] [realterrain]

PostPosted: Mon Jun 22, 2015 16:29
by Krock
Whoa, that's a great mod!
It would be interesting to generate ores and trees automatically to make it look even better.

I looked at the source code and just want to point out, the chunk/mapblock size is not fixed to 80x80x80 nodes, use "local sidelen" instead.

Re: [Mod] Real Terrain [0.0.1] [realterrain]

PostPosted: Mon Jun 22, 2015 21:09
by paramat
Krock, I wrote the basic code assuming a large image or heightmap would be pre-prepared by splitting into 80x80 arrays, although that's not how it currently works.

Re: [Mod] Real Terrain [0.0.1] [realterrain]

PostPosted: Wed Jun 24, 2015 12:22
by Minetestforfun
Awesome 0_o !

Re: [Mod] Real Terrain [0.0.1] [realterrain]

PostPosted: Wed Jun 24, 2015 16:13
by cd2
looks great :D

Re: [Mod] Real Terrain [0.0.1] [realterrain]

PostPosted: Sat Jun 27, 2015 09:40
by Gael de Sailly
How can I get this kind of tiff images for a given region ?
I would like to have a Minetest world that represents the Vosges region (in France, between Nancy and Mulhouse).

Re: [Mod] Real Terrain [0.0.1] [realterrain]

PostPosted: Sat Jun 27, 2015 14:44
by Diamond knight
this will tottaly be in ultimatetest (viewtopic.php?f=50&t=11901) when it is done

Re: [Mod] Real Terrain [0.0.1] [realterrain]

PostPosted: Sun Jun 28, 2015 16:39
by bobomb
Gael de Sailly wrote:How can I get this kind of tiff images for a given region ?
I would like to have a Minetest world that represents the Vosges region (in France, between Nancy and Mulhouse).

look for a Digital Elevation Model of your region in GeoTIFF format, then just take it into photoshop and reduce the color mode to 8 bit, save as TIFF with no compression.

here is a low resolution dem of most of europe, however it has been colorised and the pallete would need to be restored to a grey scale http://www.eea.europa.eu/data-and-maps/data/digital-elevation-model-of-europe

anyway most countries have websites for obtaining this data, here is a site that might help, i can't get the map interface to work but maybe it will for you: https://www.ngdc.noaa.gov/dem/squareCellGrid/map?theme=DDP

finally try this software (there is a tutorial) http://www.usna.edu/Users/oceano/pguth/website/microdem/microdem.htm

Re: [Mod] Real Terrain [0.0.1] [realterrain]

PostPosted: Mon Aug 03, 2015 21:56
by Gael de Sailly
I've found how to proceed, with free softwares (I have not Photoshop) :
  1. Download the maps from SRTM Data Search
  2. Open the map with ImageMagick
  3. Go to "Enhance ~> Brightness" and set it to 200. You will need to do it several times (at least 3 times) until the map is light enough (or else it will be too flat).
  4. Save the image
  5. Open it with GIMP. It will convert it into 8-bits image. You can "stick" several images and select the desired zone.
  6. The map is distorted by the projection. You can correct this problem by changing the length of the image. Resize the length to old_length × cos average_latitude (take your calculator). Not needed if you're close to the equator or if you don't expect a good precision.
  7. Save it into .tif image without compression, even lossless !

So after this adventure I've finally got my map of the Vosges. But I haven't found how to use it :/

Re: [Mod] Real Terrain [0.0.1] [realterrain]

PostPosted: Tue Aug 04, 2015 01:23
by ExeterDad
Gael de Sailly would you please post both images (before and after) so we can get a idea what we need to achieve if we were to make one of our own?

Re: [Mod] Real Terrain [0.0.1] [realterrain]

PostPosted: Tue Aug 04, 2015 12:20
by Gael de Sailly
I've tried to upload it, but they're too large (36 MB).

Re: [Mod] Real Terrain [0.0.1] [realterrain]

PostPosted: Wed Aug 05, 2015 00:39
by ExeterDad
Gael de Sailly wrote:I've tried to upload it, but they're too large (36 MB).

Wow! Okay! Disregard that request.
Thanks anyway :)

Re: [Mod] Real Terrain [0.0.1] [realterrain]

PostPosted: Mon Aug 24, 2015 16:36
by bobomb
imageloader mod now has a pure lua png library that I am working on integrating, this should allow for 16 bit images... as well as png and bmp support also lifted from imageloader.

Re: [Mod] Real Terrain [0.0.1] [realterrain]

PostPosted: Thu Sep 10, 2015 19:05
by Ryster
bobomb wrote:imageloader mod now has a pure lua png library that I am working on integrating, this should allow for 16 bit images... as well as png and bmp support also lifted from imageloader.


very nice!

please let us know when you have 16bit support, so I can gen maps higher than 256 :)

Re: [Mod] Real Terrain [0.0.1] [realterrain]

PostPosted: Wed Oct 14, 2015 20:45
by bobomb
https://trac.osgeo.org/gdal/wiki/GdalOgrInLua

using gdal we can stop worrying about image formats and use proper GIS raster formats complete with spatial metadata such as projection, real world extent, pixel scale, elevation scale, etc.

Re: [Mod] Real Terrain [0.0.1] [realterrain]

PostPosted: Sat Oct 17, 2015 03:09
by Splizard
Trying to get this to work, really nice mod here, but I get an error.. (latest git minetest)
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
minetest/mods/realterrain/init.lua:125: attempt to index a nil value
--This line is not working.
return demtiff:read(1):byte() - 32, covertiff:read(1):byte()

Re: [Mod] Real Terrain [0.0.1] [realterrain]

PostPosted: Sat Oct 17, 2015 15:55
by bobomb
maybe your cover.tif is not present? there should be one in the dem folder, if you don't want to use cover replace that line with

return demtiff:read(1):byte() - 32, 0

this mod is under heavy development right now so there will be improvements to the "cover" system

Re: [Mod] Real Terrain [0.0.1] [realterrain]

PostPosted: Mon Oct 19, 2015 22:46
by bobomb
this mod is now moving towards using external libraries to enable the use of any image file format including 16-bit color depths. that means that mod security has to be disabled for this mod in minetest.conf and you must have luarocks installed as well as the lua-imlib2 library.

next steps in development will include better land cover, and an in-mod menu system for tweaking scale settings and reloading the map (which will destructively reset the map.sqlite file). Now that the mod has access to external lua libraries, I will also begin experimenting with downloading DEM tiles and/or other data directly from the internet using luasocket.

Image

16 bit tiff used

Re: [Mod] Real Terrain [0.0.1] [realterrain]

PostPosted: Mon Oct 19, 2015 23:39
by Don
That is awesome. I can't imagine the maps this could make.

Re: [Mod] Real Terrain [0.0.1] [realterrain]

PostPosted: Tue Oct 20, 2015 00:40
by MineYoshi
Looks good and is good is awesome than can make maps

Re: [Mod] Real Terrain [0.0.2] [realterrain]

PostPosted: Tue Oct 20, 2015 19:16
by bobomb
Image

working on strata as discussed in the original thread:

Re: [Mod] Real Terrain [0.0.2] [realterrain]

PostPosted: Tue Oct 20, 2015 22:29
by bobomb
biome, water and road "painting"

Image

Image
this branch has switched to using luarocks magick library (from imlib2) for true 16-bit support

https://github.com/bobombolo/realterrain/tree/sixteen

Re: [Mod] Real Terrain [0.0.2] [realterrain]

PostPosted: Thu Oct 22, 2015 12:39
by Gael de Sailly
How could I install luarocks imlib2 ?

Re: [Mod] Real Terrain [0.0.2] [realterrain]

PostPosted: Fri Oct 23, 2015 03:08
by bobomb
install imlib2
install luarocks
then
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
luarocks install lua-imlib2

Re: [Mod] Real Terrain [0.0.2] [realterrain]

PostPosted: Fri Oct 23, 2015 03:14
by bobomb
Since the luarocks magick package is now fixed (there was a path issue) I am switching the master branch to the magick version, one library is as tricky as another...

Re: [Mod] Real Terrain [0.0.4] [realterrain]

PostPosted: Sun Oct 25, 2015 05:12
by bobomb
luafilesystem is also a dependency now (for now)

Re: [Mod] Real Terrain [0.0.4] [realterrain]

PostPosted: Sun Oct 25, 2015 19:42
by bobomb
"trees" branch

Image

Re: [Mod] Real Terrain [0.0.4] [realterrain]

PostPosted: Sun Oct 25, 2015 21:07
by bobomb
trees merged into master branch:

Image

Image

Re: [Mod] Real Terrain [0.0.4] [realterrain]

PostPosted: Mon Oct 26, 2015 23:47
by Splizard
Looking great! looks like Minetest will become the new Google Earth :D