How to generate a planet surface from a height data file?

Hi All,

I have a file with height data, pretty much like height map but the numbers run from 0 to a few thousand.

Is it possible to create a plane mesh and then modify vertex positions to match the file data and then morph it to a sphere? Or maybe create a mesh sphere right away and then modify it?

I know programming in general but never worked with Blender, so I’d appreciate it if someone point me in the right direction or link a relevant tutorial.

Thank you!

Moved from “General Forums > Blender and CG Discussions” to “Support > Modeling”

If you can convert your height data to a grayscale image, you can use the Displace modifier.

As I mentioned, I have a much bigger range of values that need to be displayed.

Elevation data is typically 16bit (65536 levels). I believe Displace will only use 8bit (256 levels) so its possible you could end up with a stairstep or terraced effect. There are a few free (Wilbur, 3DEM, Microdem etc) or relatively low cost utilities (Daylon Graphics Leveller) that will convert the Elevation file to a triangulated model using the full 16 bit range of values. For $50, Leveller has some really good tools for working with or converting elevation data. Some of the free stuff is pretty good as well, but can be more complicated to use.

I’m new to Blender, its possible someone had created a plugin that will read elevation data. I guess that would be the first thing to look for before trying anything else.

Someone with a bit more familiarity with the code would have to correct me on this, but the Displace modifier will happily accept a 16-bit grayscale (or even floating point) image for displacing your vertices. I don’t think it downsamples them to 8-bit.

That’s good to know, I’ll have to look at that. In that case the elevation data could be converted to a standard 16bit image file format.

Does Blender have a capacity to:

  1. Read data from a file (not an image)?
  2. Manipulate vertex coordinates of an object thru a built-in script language?

If it has, where do I start?

Yes, and yes. You would start by using the Blender Python API. However, since the Displace modifier already exists and it’s relatively simple to convert height data to an image, it makes a lot more sense to use the tools that are already in hand.

Thank you!

what is the file size ?

if you need to read data from file it can be done with a script
but then it will become a mesh data with real data not as an image

ask in python forum for a script to read data but then what do you do make a mesh out of it ?

happy bl

i do that all the time with the height maps i make from the Dawn images of the minor body Ceres

the easiest way is to use a 32 bit float or 16 bit unsigned image ( 0 to 65535 ) though a DEM is normally a SIGNED 16 bit data ( -32768 to +32767 )

use "import image as plain "
subdivide it enough for your needs ( i normally use 1440 divisions )
and use the displacement modifier

this
http://6.t.imgbox.com/wXRXsjXN.jpg
becomes this

http://6.t.imgbox.com/RlSvBkpF.jpg
for Ceres i use 32 bit floating point images ( 0 to 1 values)

  1. Read data from a file (not an image)?

ascii CSV data is really a image type just a text based one
WHAT is this data ?

for a WHOLE planet ( round sphere ) there are a few options
but they ARE data dependent !!!

for example this
http://5.t.imgbox.com/Ho6vja4U.jpg http://2.t.imgbox.com/rYNt06xK.jpg

http://4.t.imgbox.com/UguO6HJA.jpg http://8.t.imgbox.com/vr1TFx7r.jpg

came from
https://4-t.imgbox.com/s4cVDHRd.jpg
that above is a NORMALIZED 8 bit ( 256 tones of gray ) copy of the 16 bit SIGNED LSB height map
using the blender "import PDS dem plugin "

or if the data is say a table of data like" n7larissa( Neptune Moon Larissa)"
this is a table of data
– very short excerpt
Longitude , Latitude , radius


 0  -90     87.354090
    0  -85     89.013210
    0  -80     89.361340
    0  -75     89.808770
    0  -70     90.426900
    0  -65     91.206790
    0  -60     92.136000
    0  -55     93.197910
    0  -50     93.913020
    0  -45     95.432950
    0  -40     98.153970
    0  -35    100.181000
    0  -30    101.065300
    0  -25    101.383100
    0  -20    101.845700
    0  -15    103.226000
    0  -10    104.328800
    0   -5    104.913500
    0    0    104.894900
    0    5    104.328100
    0   10    103.431600
    0   15    102.749800
    0   20    101.845700
    0   25    100.763200
    0   30     99.551350
    0   35     98.260210
    0   40     96.937970
    0   45     95.628720
    0   50     94.371110
    0   55     93.197910
    0   60     92.136000
    0   65     91.206790
    0   70     90.426900
    0   75     89.808770
    0   80     89.361340
    0   85     89.090610
    0   90     89.000000

http://t.imgbox.com/vVEPdSaM.jpg http://t.imgbox.com/b16R8g4g.jpg

Very nice images!

The data comes from my C++ program, internally it’s 4 byte signed floating point height (z) values for an x,y integer grid, normally 1024x1024, I can round these values and/or shift them up so it’s unsigned 4 byte integer/float for example. As to the file output, I can produce any format, preferably not a legit image file as it will require extra coding/libraries used.

Z-values range across a few thousand units, so I don’t want to reduce it to 256 grey scale.

Can you please elaborate on how I could load those values in Blender, the easiest way, and apply them to a plane surface or a sphere?

if the ascii data is gridded X and Y with Z the height
many programs can read it

i can convert the simple cylindrical map i posted
http://imgbox.com/s4cVDHRd
to a CSV or a newline for each tone
– part of just the top line of that image


0.4973382353782654,0.4973375201225281,0.4973369240760803,0.4973363280296326,0.4973357319831848,0.4973350465297699,0.497334361076355,0.4973337352275848,0.4973330199718475,0.4973322153091431,0.4973317980766296,0.4973309934139252,0.4973304271697998,0.4973297715187073,0.4973290860652924,0.4973283708095551,0.4973277747631073,0.4973270893096924,0.4973263144493103,0.497325599193573,0.4973250329494476,0.4973240792751312,0.4973237216472626,0.4973227381706238,0.4973220229148865,0.4973213076591492,0.497320830821991,0.4973200261592865,0.4973195195198059,0.4973185062408447,0.4973178803920746,0.4973173141479492,0.4973164796829224,0.4973156154155731,0.4973149299621582,0.4973142743110657,0.4973134398460388,0.4973129034042358,0.4973121285438538,0.4973110854625702,0.4973106384277344,0.4973097741603851,0.4973090589046478,0.4973083436489105,0.4973075091838837,0.497306764125824,0.4973058700561523,0.4973052442073822,0.4973045289516449,0.4973037242889404,0.4973028898239136,0.4973023533821106,0.4973014295101166,0.4973005652427673,0.4972999095916748,0.4972991943359375,0.4972983300685883,0.4972977042198181,0.4972968697547913,0.4972958564758301,0.4972952604293823,0.4972945153713226,0.4972938001155853,0.4972928762435913,0.497292160987854,0.4972914457321167,0.4972905814647675,0.4972895979881287,0.4972890317440033,0.4972880780696869,0.4972874522209167,0.4972865283489227,0.497285783290863,0.4972848892211914,0.497283935546875,0.4972833096981049,0.4972825050354004,0.497281551361084,0.4972808957099915,0.4972798526287079,0.497279167175293,0.4972785711288452,0.4972774386405945,0.4972766637802124,0.4972758293151855,0.4972750544548035,0.4972738921642303,0.4972734153270721,0.4972724616527557,0.4972715377807617,0.497270792722702,0.4972701072692871,0.4972692430019379,0.4972682595252991,0.4972674548625946,0.4972667396068573,0.4972659349441528,0.4972649216651917,0.4972639977931976,0.4972631931304932,0.4972624182701111,0.4972615838050842,0.4972606897354126,0.4972597360610962,0.4972587823867798,0.4972581267356873,0.4972572326660156,0.4972562193870544,0.49725541472435,0.4972544610500336,0.4972538352012634,0.4972525537014008,0.4972518384456635,0.4972511529922485,0.4972499012947083,0.4972490966320038,0.4972485303878784,0.4972475171089172,0.4972467124462128,0.497245728969574,0.4972449541091919,0.497244119644165,0.4972431063652039,0.4972421526908875,0.4972416162490845,0.4972409009933472,0.4972397685050964,0.4972389340400696,0.4972377717494965,0.497236967086792,0.4972359836101532,0.4972351789474487,0.4972341954708099,0.4972333908081055,0.4972323775291443,0.4972315430641174,0.4972304701805115,0.4972297549247742,0.4972288012504578,0.4972279071807861,0.4972269535064697,0.4972260594367981,0.4972252249717712,0.4972240924835205,0.497223436832428,0.4972224235534668,0.4972214698791504,0.4972206056118011,0.4972196817398071,0.4972189366817474,0.4972178936004639,0.4972167909145355,0.4972158372402191,0.4972151219844818,0.4972141981124878,0.4972132444381714,0.4972125887870789,0.4972111582756042,0.4972104728221893,0.4972095489501953,0.4972086548805237,0.4972077310085297,0.4972065687179565,0.4972058236598969,0.4972048997879028,0.497203916311264,0.4972028434276581,0.4972020089626312,0.4972010850906372,0.4972003698348999,0.4971993565559387,0.4971980452537537,0.4971973299980164,0.4971965253353119,0.4971955418586731,0.4971946179866791,0.4971936345100403,0.4971926212310791,0.4971917569637299,0.4971908330917358,0.497189998626709,0.497188925743103,0.4971879422664642,0.4971869885921478,0.4971861839294434,0.4971853494644165,0.4971843659877777,0.4971832931041718,0.497182309627533,0.4971814751625061,0.4971804618835449,0.4971795678138733,0.4971785545349121,0.4971773624420166,0.4971766471862793,0.4971757531166077,0.4971747994422913,0.4971737265586853,0.4971727728843689,0.4971719682216644,0.4971708953380585,0.4971700310707092,0.497169017791748,0.4971680641174316,0.49716717004776,0.4971664547920227,0.4971652925014496,0.497164249420166,0.4971633851528168,0.4971624612808228,0.4971614480018616,0.4971605241298676,0.497159481048584,0.4971586167812347,0.4971577525138855,0.4971567094326019,0.4971559047698975,0.4971548020839691,0.4971538484096527,0.4971527755260468,0.4971518516540527,0.4971508681774139,0.4971498847007751,0.4971491992473602,0.4971481561660767,0.4971472024917603,0.4971462190151215,0.4971451759338379,0.4971444606781006,0.4971432685852051,0.497142493724823,0.4971414506435394,0.4971405863761902,0.4971396327018738,0.4971384406089783,0.4971376359462738,0.4971365630626678,0.4971355795860291,

or


0.4973382353782654
0.4973375201225281
0.4973369240760803
0.4973363280296326
0.4973357319831848
0.4973350465297699

so to convert the first example into a image i use Gmic in the terminal ( NOT the gimp plugin)


gmic data,txt -o ImageOfData.tif,float 

Gmic can also change the values ( normalize it )


gmic ImageOfData.tif -n 0,1 -o normalized.tiff

and the min is now 0 and the max 1
or for 16 bit values


gmic ImageOfData.tif -n 1,65535 -o normalized.16U.tiff,ushort

( i like a tinny bit of padding 1 value on each end )

the second is a bit harder and i have a rather big and complex set of programs that already handle that ( raw2isis)

but for a 1024x1024 image OpenOffice Calc ( excel) can change it to a coma separated instead of a NEW LINE
and imagemagick ( custom Q32 build) can import a text image

once you have a 32 bit tiff or a 16 bit tiff it is easy to import it
or if you are good at python you can write a program

i also use Nip2 – a GUI to the VIPS image library
it has math functions also ( like gmic) but is less complex to use .

now the tricky part IF the image is NOT in a simple cylindrical 2x1 format
see the wikipedia page

if NOT a lot of work will need to be done otherwise it will not even remotely look good

if it is then
make a UV sphere with a TON of subdivisions i used 2880 x 1441 for the 4 images i posted above - 550 MiB mesh

and use a displacement mod
fallow any of the model earth ( using displacement mod on the mesh )

or
once you get the hang of it
( rather complex but easy once you understand it )

“NASA LRO Lola & MGS Mola IMG Importer”

but that needs a custom label created for the raw 16 bit signed integer raw image

for practice importing here are 3 heightmaps of the earth ( without water )
https://5-t.imgbox.com/P5qXy8Vu.jpg
a 16 bit Unsigned
a 16 bit Signed
and a ascii text CSV of the unsigned image
https://drive.google.com/file/d/0B6ZYAd08tZL-cGg0ZllZdnNEaWc/view?usp=sharing
each tone is 1 Meter in height - sealevel is set to 0 zero in the signed integer tiff

Thanks a lot everyone! I looked around and ended up simply exporting my data as a .txt file and with a help of a simple python script I was able to produce the desired result :wink: It looks like an unholy mix of a death star and a virus and it’s stretched latitude-wise because the data is essentially a square but that has nothing to do with Blender.


what does it represent ?
did NASA got data from some ET LOL

happy bl

:wink: Not really, I’m writing a procedural surface generator, needed some quick way to visualize the data

Nice finish. I’d like to be the first to welcome our new spiky planet overlord. :spin: