How to do a terrain??

Started by
11 comments, last by sit 19 years, 3 months ago
I do a project that do a terrain which load from file DEM (digital elevation models) using method TIN(triangulated irregular networks)???This project use visual c++ and opengl. 1.How i load a dem file?How i know i sucessfully load the file? 2.How big the DEM file is suitable for use?Where to find? 2.How i implement a 3D Max model into the terrain?? Pls help me to give a comments,tips,source code(better).thanks your helping hand.
Advertisement
Angtau,

Believe it or not, you got some good replies in the same thread you posted over at flipcode.

Pay particular attention to this link, which gives links to the file format, and to actual DEM files.

Are you sure this is a project at the right level for you though?
Quote:Original post by angtau
1.How i load a dem file?How i know i sucessfully load the file?


for file formats: http://www.wotsit.org/
+-+-+-+-+-STR
Quote:Original post by angtau
I do a project that do a terrain which load from file DEM (digital elevation models) using method TIN(triangulated irregular networks)???This project use visual c++ and opengl.

1.How i load a dem file?How i know i sucessfully load the file?
2.How big the DEM file is suitable for use?Where to find?
2.How i implement a 3D Max model into the terrain??

Pls help me to give a comments,tips,source code(better).thanks your helping hand.


1. If you write a loader, you also know if the file is loaded correctly.
Find the format, like stroma said, on wotsit.

2. Make it the size you need. If you are really smart, you'd try to load a big .dem file (possibly downloaded from the net) before making your own beatiful terrian. Then you can check the time it takes to load a big file, and if it takes to long, either 1. optimize your code (I bet you can make much faster if you try a little) or 2. switch to another format.

3. Write you own .3ds loader... (wotsit again).
If you don't bother to write your own .3ds loader (which you should, else you won't learn half as much), then check http://www.gametutorials.com for a(really simple) .3ds loader.
Killers don't end up in jailThey end up on a high-score!
You maybe want to check out 3DEM by Visualization Software LLC. This program should be able to load DEM files and convert them to greyscale bitmaps. Maybe you also find other information about DEM on their site.
1. If you write a loader, you also know if the file is loaded correctly.
Find the format, like stroma said, on wotsit.

How i write a loader??

Quote:Original post by angtau
1. If you write a loader, you also know if the file is loaded correctly.
Find the format, like stroma said, on wotsit.

How i write a loader??
If you have the format you can write a loader by using C++ file reading mechanimsims...

Honestly dude, I am not sure your C/C++ skills are up to this if you dont know about file IO. I think you should take a look at opening and reading binary and text files in C++ as your next step.
Honestly dude, I am not sure your C/C++ skills are up to this if you dont know about file IO. I think you should take a look at opening and reading binary and text files in C++ as your next step.


I know to load .dat,.txt.....but i not sure the format dem.Isn't it using the same method to load this file(.dem)???

consist of the dem file which i open with notepad,how i load this??

ARDMORE, AL-TN DEM GENERATED WITH LT4X DRAINEF -8645 0.0000 345230.00005 CONT 2 1 1 16 0.000000000000000D+00 0.000000000000000D+00 0.000000000000000D+00 0.000000000000000D+00 0.000000000000000D+00 0.000000000000000D+00 0.000000000000000D+00 0.000000000000000D+00 0.000000000000000D+00 0.000000000000000D+00 0.000000000000000D+00 0.000000000000000D+00 0.000000000000000D+00 0.000000000000000D+00 0.000000000000000D+00 2 2 4 0.511424042306817D+06 0.385899112205972D+07 0.511406723712501D+06 0.387285263724731D+07 0.522813466160431D+06 0.387287404807098D+07 0.522848103601298D+06 0.385901249852873D+07 0.198000000000000D+03 0.287100000000000D+03 0.000000000000000D+00 10.100000E+020.100000E+020.100000E+00 1 1144 00 10119462001I5 0 2 1 1 0 1 1 1 3

[Edited by - angtau on January 1, 2005 4:22:21 AM]
You need a description of what all the components of the file mean and how the data is structured. No one here is going to simply be able to tell you what all the data in that file represents. A link to such a resource has already been posted by someone above.

Once you know the format you can write a loader for it because you know what all the data in the file means. If you say you have loaded files before then you should be able to do this.
Quote:Original post by angtau
I know to load .dat,.txt.....but i not sure the format dem.Isn't it using the same method to load this file(.dem)???


No, you don't (know how to load .dat and .txt in generel) because the file extension doesn't matter! It's the data inside the file that counts. If you read every single byte into your program, then yes, they (all files) are alike. But then you've got string(s), that you need to parse to collect the needed data (vertices etc.). To parse the strings (well, parse them correctly) you need the format specification (from wotsit).

Example: a .tga file could consist of a header (some data that describe the size and different offsets of the file) and then the image data. But in the header the id length (just a byte) could be set to > 0, which would mean that there is a string (array of chars) between the header and the actual image data. That's what you need to know, what bytes means what and how does the rest of the structure look like if they're set (and what their value tells you about the file/image/model/whatever).
Killers don't end up in jailThey end up on a high-score!

This topic is closed to new replies.

Advertisement