Started by elegac, January 22, 2010, 03:23:44 pm
Quote from: elegac on January 22, 2010, 03:23:44 pmDon't know it the files can be exported to .ter files, but I gonna try...http://hirise.lpl.arizona.edu/dtm/Erwan
Quote from: dandelO on January 23, 2010, 01:56:00 pmI 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.
Quote from: zaai999 on January 23, 2010, 05:50:45 pmi 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
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
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
Quote from: elegac on March 20, 2010, 01:04:33 pmBIG SUCCESS!I will post a detailed tutorial about how I made it.Erwan