POV-Ray : Newsgroups : povray.newusers : converting DEM to height field : Re: converting DEM to height field Server Time
5 Sep 2024 14:20:27 EDT (-0400)
  Re: converting DEM to height field  
From: Vahur Krouverk
Date: 14 Jul 2000 11:35:00
Message: <396F3333.7FBCE45@aetec.ee>
Eric Fielding wrote:
> 
> Does anyone have a program or code fragment (C or Fortran) to convert a
> "raw" Digital Elevation Model to one of the height_field formats that
> POV can use? I have MacDEM, but it only reads the standard USGS DEM
> format or ASCII text PGM files.
> 
> It seems a bit inefficient to store a DEM with 16 bits per sample in a
> 24-bit per pixel TARGA or PNG or PPM image, but I guess those formats
> contain the image size in a convenient form.
> 
>                                         ++Eric

I've made simple conversion program DEM->16-bit TGA. It's source code
could be found in this news server:
From: Vahur Krouverk <vah### [at] fvaeteceenospam>
Newsgroups: povray.binaries.utilities
Subject: Re: Problem DEM2POV/DEM2TGA?
Date: Sat, 09 May 1998 19:42:00 +0300

news://news.povray.org/35548758.265F2F5B%40fv.aetec.ee.nospam

Feel free to use it as You like.
Note, that it has defect: it opens input file in text mode, which causes
output data corruption in Windows systems. If You are in *IX world, then
it shouldn't be problem, but on windows there should be instead of:
   if ((inf = fopen(filename, "r")) == NULL) {
     fprintf(stderr,"Error opening input file %s\n",filename);
     exit(1);
   } 
                                |----- add this!
this code:                      v
   if ((inf = fopen(filename, "rb")) == NULL) {
     fprintf(stderr,"Error opening input file %s\n",filename);
     exit(1);
   }


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.