IMPORTING DIGITAL ELEVATION MAPS (DEM) IN RS3D-V6
Author : Garry Curtis
APRIL30 2008 .
A tutorial for Realsoft3D V6
Another tutorial in the "Saved From The Abyss" Series . That is , valuable information that has previously passed through the Realsoft mailing list ... straight into the void .
Skill Level Suggested :
Welcome to the world of walls . Realsoft3D has had a .DEM import module for some time now . Originally it was via downloadable plugin , courtesy of Michael Shmelling . V6 comes with a built-in .DEM import module . However , the RS manual does not mention any of the import modules . Visit the plugin area of the RS.info web site for the original .dem import plugin and information on his cool Plugin .
Click Here For The Direct Link To M. Schmelling's Plugin Page
- Import Some .DEM Data
- The Awesome 3DEM Freeware Option
- 3DEM Tips & Tricks & Awesome Links
- The Very Handy MESHLAB Freeware
The Absurdity of Digital Terrain Data
The world of Digital Elevation Data is the modern day equivalent of the Biblical 'Tower Of Babel' . Not kidding ... it's a complete mess . So many different digital formats . Dozens , actually . One S/W program may import 2 or 3 of those many types , another may import one of those and a couple more ... it's absurd , but that is the way it is , unfortunately .
Anyway , forgetting about all that for the moment , let's just focus on the easiest way to get basic earth landscape data into RS .
Let's Get Going
STEP # 1 - Obviously the First Step will be to attain the actual .DEM data . After that , technically , you don't really need me anymore . Go here for USA Data :
Link To The USGS FTP Server
STEP # 2 - All you have to do now is select a folder , download one of these compressed files , extract it to a folder , rename it , then 'Import' it into RS3D . You will need an uncompressor utility such as the very popular Winzip or 7-Zip to decompress it to a folder . The last very important point is to remember to rename the file slightly . RS3D will not load your cool new file unless it ends in *****.dem .
Link To 7 Zip
Tips & Tricks
You have probably successfully loaded the *.DEM file and have noticed how RS3D seems to be very sluggish now . Yes , but no wonder . You have more than likely imported a million polygon object . RS3D was never designed for these kinds of high-geometry 3D objects .
If you visited Michael Shmelling's .DEM Plugin Page (linked above) and downloaded his plugin , then you will see some documentation included (thank you Michael) . Mike has included some polygon reduction tools in the import module . The sliders may not work sometimes , but if you type directly into the numerical field , you will see how easy it is to chop the huge .DEM file up , or use looser samplings .
Remember that the 2 X 5 sampling used above will reduce poly's by a factor of 10 (2x5) . This will smooth the .Dem file , perhaps more than one might care for . I've had good luck and bad luck with Mike's reduction tools , and I think maybe V6 has a little trouble with some meshes , too . Anyway , stay tuned for part 2 and we'll use another method for chopping , and , texturing our .DEM the easy way .
Can We Easily Chop & Texture These Types Of Files ?
Yes . The excellent freeware S/W 3DEM will allow us to easily cut our humongeous million polygon object down to size . This very cool utility will actually do much more than that if needed . In fact , it can actually replace expensive 3D S/W if the user just needs simple , smoothly colored images , or even 3D camera flights around your imported terrains .
Link To 3 DEM
Locate the .exe (from the 'downloads' area) . Install 3DEM , start it and it will automatically ask you for a .dem file (how convienent) . This time , you don't have to point it to your recently uncompressed , renamed file . Just point '3 DEM' to your ****.GZ file , and this cool S/W will decompress and load it . Neat , eh ?
Dig the nicely colored terrain 3DEM is showing you now ! Not bad at all . Our mission here is to select a smaller portion of this landscape , and then import that directly into RS3D . 3DEM will make this a very simple 1, 2, 3 !
Why Isn't Everything This Easy?
Sorry , but you're asking the wrong guy . Let's grab a chunk of this mesh by choosing , from the 'Operations Menu' - 'Select Smaller Area' . Drag a rectangle around a particular area of interest , then hit 'Enter' . Good . Now we can also , very easily export that focused area into RS3D .
Save this smaller chunk as a .Dem (File/Save USGS ASCII DEM) . Now , we can also ask 3DEM to export the texturing we see on screen as a 'Default Map Overlay' . Choose an uncompressed format . (File/Save Map Image) . If you want to get rid of the default overlay lines , choose "Geo Coordinates'/Lat Lon Grid Off' . Note that this is a 'Shaded Relief' texture , mimicking the Sun's shadowing effect . Turn the shading off in 'Color Scale/Shaded Relief/Shade Depth (0%) .
Import this smaller .Dem and we will notice a much quicker Realsoft3D . In the RS 'Materials' Tab , create a new Texturing Shader , using the VSL 'Texture' Wizard . Point the color=texture(map coords) line of your new VSL Shader to the Overlay Mapping you saved in 3DEM .
Note that RS3D imports the .DEM file mirrored backwards . No problem , well just select the 'Flip Y' checkbox and then we can Parallel Map this image mapping to our imported .DEM from an overhead view . If the mountains are not high enough to create the effect you want , just stretch the mesh vertically with the Control Handle . Do not stretch it horizontally until the texture mapping is applied first .
Go back to the 'Geometric Objects' Tab of the 'Select' Window , select the imported .DEM mesh , take a 'Parallel Top-View' , and 'Parallel Map' the new Shader to the mesh . The more accurately you can map this texture , the more realistic the render will appear to be .
Do a test render to make sure the mapping is right-side up , and is being applied exactly . If the mapping is coming from a source other than 3DEM , move the texture around on the .Dem via the mappings handles until it fits accurately , then destroy any .DEM mesh faces that happen to be left without texture , as a result of fitting the mapping properly (Edit Mode / Drag Select Points / Destroy) .
To increase refresh times , we can change several controls in the 'Wire' Tab of our .DEM . Decrease Quality from 128 , or increase it , depending on your OpenGL card's power , and the density of your polygon mesh . You will notice other Controls here for speeding up screen refreshes .
Use The Phong
Go into the .DEM's 'Spec' Tab and look to see how many Polygons your mesh has . This will give you a better idea of what size meshes you can easily work with . Turn Off 'Phong Shading' for much faster OpenGL refreshes (SpecTab/Rendering Panel) with Textures .
Phong Shaded raytracings are smoother looking , so turn it back on for final render tests , once you have your lighting and camera angles worked out . RSV6 does not want to apply a 'Smoothen to /Triangle/Rectangles/Nurbs' operation on imported polygonal meshes with medium-to-high geometry resolutions , for some reason . The option is to import very high geometry meshes and deal with the agonizing OpenGL slowdown .
However , advanced users know how to work with lower res meshes first , then sub the final high res mesh for final renders . Then again , you can make your high res mesh a 'Bounding-Box' when you reach the "lighting and camera angle" stage of the final renderings . See PART 4 below about polygon reduction using the freeware S/W MESHLAB .
More Tips & Tricks
These tips are actually for 3DEM , to help a user get better looking Overlays . 3DEM is a very uncomplicated S/W , and also has an awesome 'Help File' . Just by looking through the Help files you can quickly become a .DEM Master . There are some very cool examples in the Gallery section on the 3DEM web site . Here you can find out what kinds of digital data was used and what kinds of Overlays were also used .
Link To 3DEM
For now , let's just work on creating custom Overlays . In the 'Operation' Menu , select F3 , 'Modify Colors' . Here we will change the default color spread to quickly add some Snow . Depress the top-most button under 'Terrain Colors' heading , and change the RGB value's to 255,255,255 , and click 'OK' . We've added a little snow , but for more we'll have to repeat for the 3 top-most altitude values .
Repeat the above steps to add some Blue-water , green-mid altitudes , and light & dark browns on either side . Click 'OK' and have a look . Another trick is to lower the 'Altitude range' . This will bring the 'Snow Line' down for you , and allow you to free up one or 2 of the top-most snow-white controls .
We can do many different types of coloring here , as well as built-in presets . We can save our texturings too , and load them back in for other .DEMs . Below we see how a "suedo-Contour Lines" effect is applied . Remember also , that we are free now to bring these images into a paint program and increase sharpness , or smoothness , or add some noise , text , shadowing , etc .
Screen Capture Overlay
The Overlay that 3DEM provides is a low resolution screen capture , so increasing your screen size can be important . Also , we can use the 'Operation/Resize Overhead View' and maximize our 3DEM screen . We can also cut up this .DEM into smaller areas , and then paste those areas together in a Paint Program .
Alternatively , there are millions of Digital Terrain Overlays available on the internet for free . Everything from road/railway/pipeline type overlays , to population and crop densities . Some are huge , hundred-megabyte-plus files , and some are several megabytes . 3DEM can import certain types of these files and overlay them according to their latitude/longtitude coordinates , usually automatically for you .
The trick is getting the files you're looking for , in a reasonable size , for the exact area you are trying to render , in a format that you can use . Here's a link to a server that has many such files , complete with GUI front-end .
USGS Seamless Data
Extremely Useful Links
This is another area that 3DEM can be extremely useful , to put it mildly . Many links are made available to 3DEM users in the included 'Help File', which is worth it's weight in gold . Once a person starts looking for information , the amount of useful web sites seem to multiply .
Too much information , in too many different formats is the problem . Hopefully 3DEM can get you going and be able to import some of the data that you collect along the way .
One Of The Many 3DEM Suggested Links
MESHLAB Can Help
The Freeware S/W , MeshLab , may be able to help , also . It will import an .OBJ mesh object exported from Realsoft3D and shrink the number of polygons down to something that RSV6 can handle easily . This will bypass the need for chopping with 3DEM , especially if you have a specific need for a very large .DEM , and have obtained overlay mappings elsewhere .
The Awesome MeshLab Freeware Program
The advantage of using Meshlab for polygon reduction is that it's algorithms are designed to cut geometry by factors of 10 without loosing as much mesh detail as you would when applying the looser samplings of Mike's Plugin options when importing high density .DEMs .
This is especially true if you will be switching on - 'Phong Shading' inside RSV6 , which will do a major smoothing job anyway . Sometimes you'll want a smooth mesh , other times you will want a polygonal high-detail mesh . Trial and error ... horses for courses . Trick is to have the tools and options at your disposal to help you decide which route is best for each particular project .
Well , that's about it for me . Hope this little Tute helps you get going quickly with rendering real-world landscapes in RS3D .
Cheers , and best of luck with your work . If you need further help , just give a shout out !!