3D terrains with satellite imagery

I

iloveusernames

  • iloveusernames

This is a step by step process on how to create external 3d terrains with satellite imagery derived from Digital Elevation Model files to use in btb. For those who are unfamiliar with DEMs start here. http://www.emrl.byu.edu/gsda/data_tips/tip_using_gis_data_depot.html

Required software:
Microdem http://www.usna.edu/Users/oceano/pgu...e/microdem.htm DEM terrain editor viewer
MeshLab http://meshlab.sourceforge.net/ Clean/edit models for exporting to other modeling programs
SasPlanet http://sasgis.com/sasplanet/ Used to retrieve high resolution satellite maps
Anim8or http://www.anim8or.com/main/index.html Single excitable modeler for mapping and exporting.

The first step is to install Microdem. If you’re instructed to install the BDE executable at any stage be sure to do so. There’s been a report that the viewer shortcut causes problems when executed so be advised. It’s non essential for this demonstration.

Begin by launching Microdem and opening a terrain file. Uncompressed files have *.dem *.ddf. or *.asc extensions. Compressed files end either in *.tar *.tgz or *gz. They can all be loaded just the same. If you download a zip with multiple *.ddf files within, click on any one of them to built the dem…it’s in parts.
Once the dem is loaded you’ll see the color topography image. Moving your mouse about the map will indicate your lat/long coordinates visible below. For the most part you’ll only be interested in a small portion of the map.
On top of the map window you’ll see various tabs. To cut the map you want to select ‘Subset/zoom’ which is the 5th tab from the left. Click the tap then left click your mouse stretching over the area you intend to cut then let go. The file will reload again immediately after. If you want to change what you did click on the Undo Subset tab next to it. To be able to export to 3d format you must save the cut area first.
Go to ‘File’ > ‘Save DEM’ > ‘Current subset MD DEM’
When saved, close the file and reopen the cut dem. Now you’re ready to export the terrain image in a 3d format.
Go to ‘File’ > ‘Save DEM’ > ‘3D (OBJ)’. A mesh description will appear asking to proceed. You can generate millions of polygons if you want, although I don’t recommend anything past 4M because I’ve had trouble simplifying 200mb files.
The result is a mesh that needs to be reduced, repositioned and mapped before it can be of any practical use. For this, Meshlab and Anim8tor do the job superbly.

Install Meshlab and import the *.obj either through ‘File’ > ’Open’ or dragging.
Step 1) Prepare the mesh BEFORE reducing the face count by selecting ‘Filters’ > ‘Cleaning and Repairing’ > ‘Remove Duplicated Vertex’.
Step 2) Select ‘Filters’ > ‘Remeshing, Simplifying and Reconstruction’ > ‘Quadric Edge Collapse Decimatior'.
On the ‘Target number of faces’ line enter the desired number of faces you want your model to display then ‘Apply’. You might have to click Apply twice. 65000 faces is the maximum 3ds files can support here so set the value anywhere below that amount.
Now you’re ready to save the file.
Go to File > Save As.. and highlight the name including the extension and enter both manually (not in CAPS). There’s a slight bug when saving file names so enter the file extension of the format manually, in this case *.obj.
The file is ready to be repositioned and mapped in Anim8tor.

Unzip Anim8tor to a suitable directory and execute it.
When the title screen disappears click on 'Object' > 'Import' and load the *.obj file. You might have to pick the obj format from the drop-down list first. Select 'View' and make sure it’s set to Front. DON'T try and move the model around in the viewer to see what's taking place because you can shift its position. If you need to see then click on the Orbit view icon below 'View'(4spheres around a circle)
1)Click 'Settings' > 'Component' > 'Texture UV'. In the popout menu check Z under Axis then OK
2)Go to 'Edit' > 'Rotate' > 'Rotate Custom' and enter -90 for the X-axis then OK
3)Go to' Edit' > 'Locate' > 'Center around Origin'.
4)Go to 'Object' > 'Export' select the 3ds format and name your file
The mesh is now ready to be imported to XPacker or any other modeling app

The final stage is creating a high resolution satellite map for the model.
For this use SasPlanet. Basically it’s a tile stitcher that can retrieve images from a host of online map servers including saved Google Earth images. The Help file is in Russian but most of the menu is in English…It’s fairly easy to navigate.

The first step in creating a matching map is to locate the precise lat/long coordinates from the dem file you cut and saved earlier.
To do this, load the file in Microdem select the ‘Info’ tab from the main tool bar and choose ‘Map window corners’. The internal text editor will produce a file with lat/long for each corner. By default Microdem lat/long units are displayed in Decimal degrees. SASPlant inputs are in decimal seconds so before you generate the text file in Microdem switch to ‘Decimal seconds’ in ‘Options’ > ‘Units’ > Lat/Long.

How to create a high res map texture.
Unzip SasPlanet to a directory and open (no install necessary, I believe it’s portable)
‘Choose source from which program will take maps’ > ‘Internet’ > ‘Choose type of the map’.
This will let you connect to the selected server. Use your pointer and touch the tab icons to see information. Zoom roughly to the position of your dem coordinates and start capturing at the desired scale level until the entire area from corner to corner is filled. The scale range is 20X for Google, Virtual Earth and Yahoo satellite images.
Sasplanet can use Google earth imagery to work with as well by directing it to the Goggle Earth dbCache.dat file stored on your drive.
Location: C:\Documents and Settings\YOUR_USER_ACCOUNT\Local Settings\Application Data\Google\GoogleEarth.
To display GE dbCache images select ‘Parameters’ > Settings’ >‘Cache’.
Search by directory or cut/past your GE dbcache.dat file address on the ‘Path to cache Google Earth’ line then ‘Apply’.

Go to ‘Operations’ > ‘select’ > ‘ On coordinate’ and manually enter the exact Lat/Long degrees for left top and right corners as displayed in the Microdem coordinate text. Be certain to enter the North South East West Lat/longs correctly as well.
When the popup menu appears select ‘Stick’ to adjust image quality/output image file format and finally scale. You’ll be able to see and adjust the actual dimension of the final map before creating it. The map is in projection form so it will position on the mesh accordingly. The result is a geocoded texture of sorts that will fit without any editing. You can make it as large as you want. Clearly a 10000X10000 image on a single mesh isn’t practical for games, but it does speed things during the modeling stages. This is merely a starting point for referencing and placing objects although you can be creative and incorporate the model to.

Now you have a map and 3ds mesh you can place in Xpacker. When you add the *.3ds you’ll get the no texture warning, click ok anyway.
Go to Materials select the terrain object then the material in the tree list.
Load your map from file then save. If you get the invalid image height/width warning you can still use it in btb. If you intend to export to a game then correct it before loading it in Xpacker. Say you made a *jpg @ 5000X3000, load it in an image editor and resize it to 4096X2048.

The only thing left is to create or load a track and drag over the terrain into the scene. Try not to push it off the road and let go. Also uncheck ‘rest on the ground’ for ease of movement. It’s a bit tricky to grab at times but you get the hang of it.

There are bunch of other uses these apps have such as simplifying complex shapes to display in your final production...

Examples..
lake_carmfe2Snap00.jpglake_carmfe2Snap01.jpgtest1.jpgtestw.jpg
pencil.png
pencil.png
pencil.png
 
This looks good but three things:

1) Don't use the Microdem Quick Viewer shortuct. It will cock everything up.

2)In MeshLab I can only get the Quadratic Edge Decimation to work if I click on Apply twice.

3) I can't get MeshLab to save the simplified file. It says it has done, but no new files are created when I used Save As, the the original file is not modified if I select Save.

edit: for 3) I can save it as a 3ds (or presumably any other file format). If I load the 3ds I regain the obj saving ability. I have to save as a new obj file rather than overwriting the original. LithUnwrap cannot load the 3ds but it can load the new obj.
 
  • iloveusernames

I unpacked Microdem with unpacker so I wasn’t aware of the shortcut problem, but I’m glad you pointed that out!

I noticed I had to multi click as well but that ceased when I removed the duplicate vertex first. Another thing you can try is setting the Percentage reduction to 0 in the Quadric Edge options.

Odd thing about that obj not being written cos that happened to me as well. What you have to do is highlight the extension after the file name, clear it, then enter it again when saving.

I have to see about getting that obj in lithunwrap the way you explained cos so far I’ve never been able to.


Yes SPERGER, this is useful for everyone. I mention the USA because high resolution DEM's are harder to locate outside the US. 7.5 minute DEMs at 10 meters is about as good as it gets, especialy when they're availible at no cost. Outside the US it's more like 30X30 meters and above. This isnt the case everywhere tho.
 
3ds limit is 65535 vertices.

Very good info, I've thought of using the same method. Filtering all DEM data regardless of where it is always seems wrong to me. What is needed is the ability to step down the resolution of the terrain mesh the further away from the path of the road.

Something like:
On the road-full detail
3m from road-90%
10m-70%
20m-50%
40m-30%

It is too bad that rF/RBR doesn't automatically do vertex filtering based on location. I believe Dirt2 does.
 
  • iloveusernames

edit: for 3) I can save it as a 3ds (or presumably any other file format). If I load the 3ds I regain the obj saving ability. I have to save as a new obj file rather than overwriting the original. LithUnwrap cannot load the 3ds but it can load the new obj.


Whenever you save a file from Meshlab enter the extension manually.
You can’t save in obj when the letters are capitalized. Also, there’s no point selecting a file format from the list when saving because the extension won’t change

Had hoped your trick might work but no dice! I’ll keep trying things. I’d like to avoid opening additional programs converting from on to another. What version of lithunwarp are you using Soul?


yes lordpantsington, lever of detail is something I’m trying to figure out. I can do it manualy in meshlab tho
 
What you have to do is highlight the extension after the file name, clear it, then enter it again when saving.
That's good. Saves having to mess around with all that format switching nonsense.

I have to see about getting that obj in lithunwrap the way you explained cos so far I’ve never been able to.
LithUnwrap was a bit slow with the first mesh I tried because it was so large. It often seemed like the program had crashed but it was just taking a long time.

I was able to get the obj from MeshLab into Anim8or. It was just miles away from 0,0,0. When the object is imported it'll become selected, so you can just go to Edit > Locate > Center about Origin. Or zoom out really far until you see the white bounding box.

Anim8or can do some basic UV mapping.
 
  • iloveusernames

Thanks for the tip man…haven’t used Anim8or in bit. Be slick if I can go from meshlab right to Lithunwrap cos I can literately map the mesh blindfolded.

[FONT=&quot]I’ve tried some additional settings for the quadric edge filter at various levels of detail and notice some beneficial though subtle differences when checking ‘Preserve Normal’ and ‘Planer Simplification’. So try and see. If you don’t like it you can always reload from the file menu[/FONT]
 
Here's another tip: If you use Anim8or, don't save it in the an8 format - it may well simplify the mesh because it can't handle too much data. The file can be exported without losing anything.

I've followed the instructions, obtained a mesh and a full texture etc, but the mesh itself is rotated and skewed:
meshlab1.jpg


Did your terrain look like that? It's not just rotated, it's not rectangular either. There are tons of settings in MicroDem but I don't understand most of them. :/

I just tried using Anim8or's Skew modifier. Coupled with manual rotation it's almost correct. But still, it would be nice to start with a proper rectangle.
 
  • iloveusernames

EDIT#
Well I did manage to make a bit of headway. I can get the obj into Lithunwrap from Meshlab if enter these lines anywhere in the .obj

vt 0.0 0.0
g null
usemtl Unassigned

Lith doesn’t like to load if there isn’t at least one Texture vertice, Group and Material name.
However, the object is to far from 0,0,0 to even be viewed.



Here’s a list of the data types that are being produced in these files. it's possible to edit the mesh manually.

v Geometric vertices
vt Texture vertices
vn Vertex normals
vp Parameter space vertices
f Face
g Group name
usemtl Material name


SOUL, I used Sketchup to do the conversion and it all went smoothly. Didn't have to adjust anything, nor did I change settings in Microdem. If the shape didn't look like it did in meshlab then something went wrong after in the conversion process.

The geometric verts seem to indicate the object is in outer space, well away from 0,0,0 and on its side. The values are from Microdem.



Ok, I managed to do this in Anim8or. Your mesh is tilted cos’ you must’ve moved it at some point.

Import the obj mesh. Don’t touch the object in the viewer...you don’t even need to see what’s taking place

Go to Edit > Rotate > Rotate Custom.
Enter 270 degrees for the X axis then OK

Go Back to Edit > Locate > Center About Origin
Then export…. Worked for me.
 
  • iloveusernames

I’ve completely revised the process on the first page with additional details and info for laymen folks who want to give this a go.
 
I appreciate the advice but that's what I've been doing. It doesn't matter though because I've found a slightly different method. A while ago I found these instructions, but there are a few differences so I'll write up what I do:

Required Programs:
Anim8or
Terranim8or - specialises in terrain-like meshes, but only saves in the Anim8or file format.
Microdem
and
Google earth plugin - double click the .kmz and GE will open with a grid over the planet. Click on a green mountain icon to get heightmap data for that region. You may have to look at your 'My places' sidebar and select the 'elevation' item.

A window will open and you need to select one of the "Download the DATA tile in zipped ARCASCII format" links. You'll get a zip file with an .asc file in it. That can be opened with Microdem.

Use the 'Subset & Zoom' button to focus on a small area and then go to File > Save DEM > Current Subset...

[This bit is for getting a B&W heightmap for Terranim8or to use]
On the coloured image, right click and select 'Grid...'. In the 'grid' area, select 'Neither'. Right click again and select 'Legends...' and clear the 4 checkboxes.

Right click again and select 'Display parameter' and then 'Elevation'. From the list of colour options, select 'Grey Scale'.

Nearly there...go to File > Save Image. For 'File Type' select either BMP or JPG.

Finally, go to the Info menu and select 'Full DEM Info'. The numbers you need are z-range (you want the difference between the highest and lowest points), Screen Pixels (the size of the image) and Screen pixel size (number of meters covered by each pixel). Use the last number to work out how many meters the image covers.

Load Terranim8or, and go to Build > Terrain > From Height Map. The X and Z sizes are the width and height of the image (converted from pixels to meters) and the Y value is the height difference, also in meters.

The Divisions numbers can be used to make the terrain more or less detailed.

Once the terrain has been generated, go to File > Save as. The .an8 file can be opened with Anim8or.

I'll leave it there since the first post deals with anim8or. The advantage of this method is that the mesh will already be centred at the origin and will have the correct orientation. It just needs to be textured and exported. And of course a Sasplantet texture can be used.
 
  • iloveusernames

[FONT=&quot]Damn Soul, this is exactly how I started out doing this!…Either of these methods are effective:cool:[/FONT]
 
maybe i'm being a bit thick, but because this is just a 3D object, you couldn't just lay track down on top of this without it floating above or clipping through the terrain mesh... would you use BTB's Terrain function to merge in with the large terrain mesh? It doesn't look like how it was done in the attached images...
 
  • iloveusernames

I’m not aware of merging objects with the existing terrain functions in btb.

There will always be some clipping between the track and terrain with the method I described. In my example the road waypoints and terrain were all derived from the same dem so everything mated up very closely…not perfectly.
You can use these imported terrains as a 3d reference opposed to a flat image under your track. Further use of the terrain would involve additional software to merge the track and terrain vertex eliminating clipping altogether.

I'm merely demonstrating how to make an accurate 3D terrain mesh of a particular area that can be used in many modeling programs for game use.
 
It would be easier if you could show us on a series of short videos:veryhappy: the main problem being the instructions and help files for sas planet are in russian....and i'm sure i'm not the only person that prefers to see whats going on as i find it easier to remember things that way. thanks
 
I appreciate the advice but that's what I've been doing. It doesn't matter though because I've found a slightly different method. A while ago I found these instructions, but there are a few differences so I'll write up what I do:

Required Programs:
Anim8or
Terranim8or - specialises in terrain-like meshes, but only saves in the Anim8or file format.
Microdem
and
Google earth plugin - double click the .kmz and GE will open with a grid over the planet. Click on a green mountain icon to get heightmap data for that region. You may have to look at your 'My places' sidebar and select the 'elevation' item.

A window will open and you need to select one of the "Download the DATA tile in zipped ARCASCII format" links. You'll get a zip file with an .asc file in it. That can be opened with Microdem.

Use the 'Subset & Zoom' button to focus on a small area and then go to File > Save DEM > Current Subset...

[This bit is for getting a B&W heightmap for Terranim8or to use]
On the coloured image, right click and select 'Grid...'. In the 'grid' area, select 'Neither'. Right click again and select 'Legends...' and clear the 4 checkboxes.

Right click again and select 'Display parameter' and then 'Elevation'. From the list of colour options, select 'Grey Scale'.

Nearly there...go to File > Save Image. For 'File Type' select either BMP or JPG.

Finally, go to the Info menu and select 'Full DEM Info'. The numbers you need are z-range (you want the difference between the highest and lowest points), Screen Pixels (the size of the image) and Screen pixel size (number of meters covered by each pixel). Use the last number to work out how many meters the image covers.

Load Terranim8or, and go to Build > Terrain > From Height Map. The X and Z sizes are the width and height of the image (converted from pixels to meters) and the Y value is the height difference, also in meters.

The Divisions numbers can be used to make the terrain more or less detailed.

Once the terrain has been generated, go to File > Save as. The .an8 file can be opened with Anim8or.

I'll leave it there since the first post deals with anim8or. The advantage of this method is that the mesh will already be centred at the origin and will have the correct orientation. It just needs to be textured and exported. And of course a Sasplantet texture can be used.


Hey thanks for the post. looks like a good plan for doing terrain. Having a problem though. I have the heightmap as a bmp but when I put it into Terranim8or using the build terrain and enter values and press ok, nothing happens!! Any idea what I'm doing wrong. Also the values that I got to enter, I don't fully understand which is which and how to work it out. Excuse my stupidity ;) Please can you describe that procedure a bit more? Thanks!!
 
I have the heightmap as a bmp but when I put it into Terranim8or using the build terrain and enter values and press ok, nothing happens!!
Did you select the Load Image button? That's the only thing I didn't specifically mention.

The other parameters will define the size of the terrain object. The image saved from Microdem covers an area, square miles/kilometers. In Microdem you can zoom in on an area and go to Info > Full Dem Info. The first thing you need is the z range (min height and max height). The difference is what you need for the Y value in Terranim8or.

In the next section you have Screen Pixels and Screen pixel size, i.e. each pixel covers so many feet/meters. You can use that to calculate the X and Z values in Terranim8or. You should convert everything to meters because that's what XPacker and BTB use. Terranim8or can only cope with numbers up to a limit, so you might have to divide your numbers by 10 or 100 etc, then scale up the object later on.
 

Latest News

Online or Offline racing?

  • 100% online racing

    Votes: 96 7.8%
  • 75% online 25% offline

    Votes: 130 10.5%
  • 50% online 50% offline

    Votes: 175 14.2%
  • 25% online 75% offline

    Votes: 348 28.2%
  • 100% offline racing

    Votes: 480 38.9%
  • Something else, explain in comment

    Votes: 5 0.4%
Back
Top