Don't know it the files can be exported to .ter files, but I gonna try...
http://hirise.lpl.arizona.edu/dtm/
Erwan
Quote from: elegac on January 22, 2010, 03:23:44 PM
Don't know it the files can be exported to .ter files, but I gonna try...
http://hirise.lpl.arizona.edu/dtm/
Erwan
Do you have any way to convert .IMG files to .BMP or another "picture" file? This format is Mars Mola format but won't directly load into Terragen 2.
At least TG Light wouldn't load them.
I thought there was a mola-map shader in TG... Yes, there is, in 'displacement shaders'. I've never used it so I'm not sure of the workings or file types.
According to this, 3DEM reads .dtm format. if it works properly, you could then save out a .ter file.
http://www2.cs.uh.edu/~somalley/DemTutorial/#DTM
http://forums.planetside.co.uk/index.php?topic=6767.0
i just downloaded one of the DTM files and tried to open it in 3Dem, after I got past the open/load window i got a error saying: Cannot find MOLA POLAR file
Quote from: dandelO on January 23, 2010, 01:56:00 PM
I thought there was a mola-map shader in TG... Yes, there is, in 'displacement shaders'. I've never used it so I'm not sure of the workings or file types.
I tried using that and it didn't work. It didn't want to load with 3DEM either. It needs to be converted to a .png file or something else.
Quote from: zaai999 on January 23, 2010, 05:50:45 PM
i just downloaded one of the DTM files and tried to open it in 3Dem, after I got past the open/load window i got a error saying: Cannot find MOLA POLAR file
The DTM is a .img file the Mars-Mola format.
I send a mail to Sarah Mattson from HiRISE Contact, here is her answer:
QuoteI am not familiar with Terragen software, but I can answer some of your questions. I am also sharing this email with a few other people who have been experimenting with using our DTMs in various 3D rendering software packages. Maybe they will have some other insights they can share with you.
>> The best would be to export the .IMG files to the .ter format.
This format can be converted to more common image formats and bit depths using the open source gdal software, for example. See http://www.gdal.org/ for more information. I am not an expert gdal user, so my ability to answer questions regarding that software is limited.
You can also use ISIS3 software from the USGS (also freely available) to convert the image data into other image formats. See http://isis.astrogeology.usgs.gov/. There are many commercial image analysis software packages available that can read these files, too.
>> But Terragen 2 can also use black and white images to make the terrain: black for the lowest point, white for the highest.
The associated Extra grayscale browse image displays the DTM this way, but at a much reduced size.
>> But with that solution, we would need to know the highest and the lowest altitude of the terrain to have a correct vertical scale.
This information is contained in the label embedded in the .IMG file. In a Unix Terminal, you can 'more' the file to read the label. Or you can open it in some text readers. It contains the keywords VALID_MINIMUM and VALID_MAXIMUM. We realize that this information is critical to use the DTM, so we will be adding these values soon to the Toolbox on each DTM web page. Our apologies for not having that in place when we released these products.
There are other ways to get at these values, using statistics/histograms of the file, but reading it out of the label is probably the simplest.
I hope some of this is helpful to you. Thank you for your interest in using HiRISE DTMs and for your feedback. We look forward to seeing the results of your work!
Sincerely,
Sarah Mattson
Erwan
Here is a new mail I just received from Trent M Hare:
QuoteErwan,
Well your email was my excuse to test out Terragen 2. I hadn't tried it since v1 (classic). I am still confused by a few thing but I was able to easily get a HiRISE PDS DEM (*.img) into TG2. I am not a TG2 so I may be missing something here.
Confused items (using DTEEC_001918_1735_001984_1735_U01.IMG for my testing):
1.) Even though GDAL support the Terragen output format I am having trouble getting it to work. It runs but on import it is basicall all zeros.
running:
>gdalinfo -mm
-- returns min and max of file which is 782.067,1300.012 so next run:
>gdal_translate -of terragen -co MINUSERPIXELVALUE=782.067 -co MAXUSERPIXELVALUE=1300.012 DTEEC_001918_1735_001984_1735_U01.IMG out.ter
-- returns a file but TG2 doesn't like it. Running gdalinfo on this file shows odd numbers. It might be from the NODATA value?
2.) TG2, like other "globe" applications has a globa at a zero value elevation. This means anything loaded will be merged into the zero elevation. Thus a model with negative values will have an odd bathtub look as the edges get stitched to 0. To complicate this futher all HiRISE DEMs will have NoDATA edge pixels at (-3.4028226550889045e+038). TG2 doesn't appear to support a NoDATA pixel so this will have to remapped or removed. Cropping is the easiest. For DEMs above zero it will stitch from 0 to the lowest elevation which looks like an out-of-place mesa.
3.) TG2 supports placing data onto the correct location of the globe. I have not attempted to see if the DEM I imported was placed correctly? I doubt it but it seemed to honor the 1m/p cellsize.
Anyway, here are a couple method to bring the data in.
HiRISE import examples
1.) convert to 32bit geotiff, Even though TG2 implies it can only read *.ter, *.bmp, *.tga, you can load in tiffs.
>gdal_translate -of gtiff DTEEC_001918_1735_001984_1735_U01.IMG out_DTEEC_001918_1735.tif
--This maintains the large negative NoDATA value in the tiff which TG2 appears to remap to 0 upon reading. Thus you end up with a large mesa in the scene. I'm sure there is a way to fix this in TG2 but I'm not sure how.
--In TG2, New project, terrain "tab", "Add Terrain", Height field (load file), choose all files *,* and select gdal Tiff.
2.) To help with the large extruded DEM, remap elevations down (or up) to 1.
>gdalinfo -mm
-- returns min and max of file which is 782.067,1300.012. So I will use a GDAL option to move the values down near 0. Here is will subtract 781 from both output values and leave enough room for a nodata defined as 0:
>gdal_translate -a_nodata 0 -scale 782.067 1300.012 1.067 519.012 DTEEC_001918_1735_001984_1735_U01.IMG out_DTEEC_001918_1735.tif
-- here nodata gets mapped to 0 and -scale says take min, max input and linearly map to output values. So I am changing the heights but the Z range is the same.
--In TG2, New project, terrain "tab", "Add Terrain", Height field (load file), choose all files *,* and select gdal Tiff.
3.) If you must you can also remap to 8bit (not recommended). This can be done in GDAL or ISIS3
>gdalinfo -mm
-- returns min and max of file which is 782.067,1300.012. So I will use a GDAL option to move the values down near 0. Here is will subtract 781 from both output values and leave enough room for a nodata defined as 0:
>gdal_translate -of PNG -a_nodata 0 -scale 782.067 1300.012 1 255 DTEEC_001918_1735_001984_1735_U01.IMG out_8bit.png
-- here nodata gets mapped to 0 and -scale says take min, max input and linearly map to output values. Elevation values are no longer meaningful.
--Load PNG into TG2 as specified in 1 and 2.
In ISIS3, run pds2isis and then isis2std to create 8bit png (only files under 2GB supported for export in ISIS).
4.) to remove NODATA value here is an example. Find where you want to crop, then you can run gdal_translate
>gdal_translate -of Gtiff -srcwin 650 1050 4097 4097 DTEEC_001918_1735_001984_1735_U01.IMG crop.tif
--but you will probably want to still bring it down to zero elevation (example 3). -srcwin says start at pixel location line,samp and extend so many pixels. Here the output will be 4097x4097.
5.) There are other methods for example using GDAL to convert to a 16bit PNG and then converting that to a 16bit TGA but you need an app that supports 16bit tga creation.
>gdal_translate -of PNG -ot UINT16 -a_nodata 0 -scale 782.067 1300.012 1 65500 DTEEC_001918_1735_001984_1735_U01.IMG out_16bit.png
-- here the range is getting mapped to the full 16bit int range to help maintain the elevation's floating point precision but the elevation values are no longer meaningful.
more gdal tips: https://isis.astrogeology.usgs.gov/IsisSupport/index.php?topic=2172.0
If you have any ideas to help make this easier we would like to know. Attached is a fast example. I used method 2 above for importing.
good luck,
Trent
(http://img684.imageshack.us/img684/7570/tg2candorchasm.jpg)
Erwan
Thanks , Erwan :)
Kadri.
Hi Erwan,
TG2 almost supports these .img files natively, because they are needed by the MOLA Map Shader. However, Terragen's current reader for .img files makes some assumptions about the dimensions and it didn't work with the one file I just tried. I might be able to fix this for inclusion in the next update. I did notice that the files are pretty big though, and TG can run into problems loading very large images.
Matt
BIG SUCCESS!
(http://img122.imageshack.us/img122/3964/tgout0001.png)
I will post a detailed tutorial about how I made it.
Erwan
Quote from: elegac on March 20, 2010, 01:04:33 PM
BIG SUCCESS!
(http://img122.imageshack.us/img122/3964/tgout0001.png)
I will post a detailed tutorial about how I made it.
Erwan
big thanks, i look forward to seeing it/trying it out. :)
Well, most of the work is done, but I still have some problems with zones with no data which give artefacts. Gonna ask some more information. I have also an idea to solve it, but I would need the help of someone who is good with TG2 functions.
Erwan
I love how people ask for help, get help, input and discussion only to forget about the topic when they find the solution.
I think there is a loose end here, and I would not create a new thread to find out: finally, V3.2 can read these data DTM??
I meant, without use any other aplication...
TG has been able to read most IMG files since the release of TG 3.0. 3.3.04.0 is the latest version. The free version supports DEM data loading, so give it a try with the files you're wondering about and see if it works.
- Oshyan
I supposed if V3.2 can load, also must to do V3.3
unfortunately TG crashed after to show me a Warning message
any idea?
What did the warning message say? Did it crash immediately afterward? What was the data you were trying to load?
- Oshyan
Hello Oshyan, I'm so sorry for the delay, but I could not come here recently
I honestly don't remember what the error message said (as well after 5 minutes I cant find the file to test again),
but yes, crashed immediately after to load the default IMG file that you download from HiRISE, after that, I don't back again to this...
buuut, as this thread can be useful to someone in the future, here I am... late but sure ;)
Do you know how big the file was? How much RAM do you have?
- Oshyan
Hi Oshyan
is about 205 MB. I have 8 GB RAM. It should be enough, or it's not?
Well, the size of the file on disk is not necessarily the same as the amount of memory used. I'd be curious to see Task Manager memory use data when you attempt to load it. But if you've moved on, that's OK. It will be reported again if it's a notable issue.
- Oshyan